Changeset 9322 in orxonox.OLD
- Timestamp:
- Jul 18, 2006, 12:01:55 PM (18 years ago)
- Location:
- branches/proxy/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/orxonox.cc
r9240 r9322 453 453 if ( Preferences::getInstance()->getString("misc", "bt-to-file", "1") == "1" ) 454 454 { 455 SignalHandler::getInstance()->doCatch( argv[0] );456 455 SignalHandler::getInstance()->doCatch( argv[0], "orxonox.backtrace" ); 456 SignalHandler::getInstance()->registerCallback( EventHandler::releaseMouse, NULL ); 457 457 } 458 458 -
branches/proxy/src/util/signal_handler.cc
r9240 r9322 27 27 } 28 28 29 void SignalHandler::doCatch( std::string appName ) 29 /** 30 * register signal handlers for SIGSEGV and SIGABRT 31 * @param appName path to executable eg argv[0] 32 * @param fileName filename to append backtrace to 33 */ 34 void SignalHandler::doCatch( const std::string & appName, const std::string & fileName ) 30 35 { 31 36 this->appName = appName; 37 this->fileName = fileName; 38 39 // make sure doCatch is only called once without calling dontCatch 40 assert( sigRecList.size() == 0 ); 32 41 33 42 catchSignal( SIGSEGV ); … … 35 44 } 36 45 46 /** 47 * restore previous signal handlers 48 */ 37 49 void SignalHandler::dontCatch() 38 50 { … … 45 57 } 46 58 59 /** 60 * catch signal sig 61 * @param sig signal to catch 62 */ 47 63 void SignalHandler::catchSignal( int sig ) 48 64 { … … 58 74 } 59 75 76 /** 77 * sigHandler is called when receiving signals 78 * @param sig 79 */ 60 80 void SignalHandler::sigHandler( int sig ) 61 81 { … … 240 260 bt.insert(0, timeString); 241 261 242 FILE * f = fopen( GDB_BT_FILE, "a" );262 FILE * f = fopen( getInstance()->fileName.c_str(), "a" ); 243 263 244 264 if ( !f ) 245 265 { 246 perror( "could not append to " GDB_BT_FILE);266 perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() ); 247 267 exit(EXIT_FAILURE); 248 268 } … … 250 270 if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() ) 251 271 { 252 printf( "could not write %d byte to " GDB_BT_FILE, bt.length());272 printf( ( std::string("could not write %d byte to ") + getInstance()->fileName ).c_str(), bt.length()); 253 273 exit(EXIT_FAILURE); 254 274 } -
branches/proxy/src/util/signal_handler.h
r9240 r9322 9 9 #include <list> 10 10 #include <string> 11 12 13 #define GDB_BT_FILE "orxonox.backtrace"14 11 15 12 typedef int (*SignalCallback)( void * someData ); … … 44 41 void registerCallback( SignalCallback cb, void * someData ); 45 42 46 void doCatch( std::string appName );43 void doCatch( const std::string & appName, const std::string & fileName ); 47 44 void dontCatch(); 48 45 … … 58 55 59 56 std::string appName; 57 std::string fileName; 60 58 }; 61 59
Note: See TracChangeset
for help on using the changeset viewer.