Changeset 8858 for code/trunk/src/libraries/util/SignalHandler.cc
- Timestamp:
- Aug 23, 2011, 12:45:53 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 1 build 2 2 codeblocks 3 vs 3 4 dependencies
-
- Property svn:mergeinfo changed
/code/branches/output (added) merged: 8739-8740,8765,8771-8772,8774-8780,8787-8789,8794-8799,8801,8803-8812,8814,8816-8817,8820,8822,8825-8837,8840,8844,8846,8848-8850,8853-8854
- Property svn:ignore
-
code/trunk/src/libraries/util/SignalHandler.cc
r8351 r8858 39 39 #include <cstdio> 40 40 41 #include " Debug.h"41 #include "Output.h" 42 42 43 43 namespace orxonox … … 127 127 if( SignalHandler::singletonPtr_s == 0 ) 128 128 { 129 COUT(0) << "Received signal " << sigName.c_str() << std::endl << "Can't write backtrace because SignalHandler is already destroyed" << std::endl;129 orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl; 130 130 exit(EXIT_FAILURE); 131 131 } … … 137 137 138 138 139 COUT(0) << "Received signal " << sigName.c_str() << std::endl << "Try to write backtrace to file orxonox_crash.log" << std::endl;139 orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl; 140 140 141 141 … … 206 206 #ifdef PR_SET_PTRACER 207 207 if( prctl(PR_SET_PTRACER, gdbPid, 0, 0, 0) == -1 ) 208 COUT(0) << "could not set proper permissions for GDB to attach to process..." << endl;208 orxout(user_error) << "could not set proper permissions for GDB to attach to process..." << endl; 209 209 #endif 210 210 … … 213 213 214 214 if( read( sigPipe[0], &someData, sizeof(someData) ) != sizeof(someData) ) 215 COUT(0) << "something went wrong :(" << std::endl;215 orxout(user_error) << "something went wrong :(" << endl; 216 216 217 217 if ( someData != 0x12345678 ) 218 218 { 219 COUT(0) << "something went wrong :(" << std::endl;219 orxout(user_error) << "something went wrong :(" << endl; 220 220 } 221 221 … … 328 328 if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() ) 329 329 { 330 COUT(0) << "could not write " << bt.length() << " byte to " << getInstance().filename << std::endl;330 orxout(user_error) << "could not write " << bt.length() << " byte to " << getInstance().filename << endl; 331 331 exit(EXIT_FAILURE); 332 332 } … … 364 364 _UtilExport void __cdecl abort() 365 365 { 366 COUT(1) << "This application has requested the Runtime to terminate it in an unusual way." << std::endl; 367 COUT(1) << "Please contact the application's support team for more information." << std::endl; 366 using namespace orxonox; 367 orxout(user_error) << "This application has requested the Runtime to terminate it in an unusual way." << endl; 368 orxout(user_error) << "Please contact the application's support team for more information." << endl; 368 369 DebugBreak(); 369 370 exit(0x3); … … 373 374 _UtilExport void __cdecl _assert(const char* expression, const char* file, int line) 374 375 { 375 COUT(1) << "Assertion failed: " << expression << ", file " << file << ", line " << line << std::endl; 376 COUT(1) << std::endl; 376 using namespace orxonox; 377 orxout(user_error) << "Assertion failed: " << expression << ", file " << file << ", line " << line << endl; 378 orxout(user_error) << endl; 377 379 abort(); 378 380 } … … 423 425 bExecuting = true; 424 426 425 COUT(1) << std::endl;427 orxout(user_error) << endl; 426 428 427 429 // if the signalhandler has already been destroyed then don't do anything 428 430 if (SignalHandler::singletonPtr_s == 0) 429 431 { 430 COUT(1) << "Caught an unhandled exception" << std::endl << "Can't write backtrace because SignalHandler is already destroyed" << std::endl;432 orxout(user_error) << "Caught an unhandled exception" << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl; 431 433 exit(EXIT_FAILURE); 432 434 } 433 435 434 COUT(1) << "Caught an unhandled exception" << std::endl << "Try to write backtrace to orxonox_crash.log..." << std::endl;436 orxout(user_error) << "Caught an unhandled exception" << endl << "Try to write backtrace to orxonox_crash.log..." << endl; 435 437 436 438 // write the crash log … … 439 441 time_t now = time(NULL); 440 442 441 crashlog << "=======================================================" << std::endl;443 crashlog << "=======================================================" << endl; 442 444 crashlog << "= Time: " << std::string(ctime(&now)); 443 crashlog << "=======================================================" << std::endl;444 crashlog << std::endl;445 crashlog << "=======================================================" << endl; 446 crashlog << endl; 445 447 446 448 const std::string& error = SignalHandler::getExceptionType(pExceptionInfo); 447 449 448 crashlog << error << std::endl;449 crashlog << std::endl;450 crashlog << error << endl; 451 crashlog << endl; 450 452 451 453 const std::string& callstack = SignalHandler::getStackTrace(pExceptionInfo); 452 454 453 crashlog << "Call stack:" << std::endl;454 crashlog << callstack << std::endl;455 crashlog << "Call stack:" << endl; 456 crashlog << callstack << endl; 455 457 456 458 crashlog.close(); 457 459 458 460 // print the same information also to the console 459 COUT(1) << std::endl;460 COUT(1) << error << std::endl;461 COUT(1) << std::endl;462 COUT(1) << "Call stack:" << std::endl;463 COUT(1) << callstack << std::endl;461 orxout(user_error) << endl; 462 orxout(user_error) << error << endl; 463 orxout(user_error) << endl; 464 orxout(user_error) << "Call stack:" << endl; 465 orxout(user_error) << callstack << endl; 464 466 465 467 bExecuting = false; … … 467 469 else 468 470 { 469 COUT(1) << "An error occurred while writing the backtrace" << std::endl;471 orxout(user_error) << "An error occurred while writing the backtrace" << endl; 470 472 } 471 473
Note: See TracChangeset
for help on using the changeset viewer.