Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9322 in orxonox.OLD


Ignore:
Timestamp:
Jul 18, 2006, 12:01:55 PM (18 years ago)
Author:
rennerc
Message:

release mouse on tardis

Location:
branches/proxy/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/orxonox.cc

    r9240 r9322  
    453453  if ( Preferences::getInstance()->getString("misc", "bt-to-file", "1") == "1" )
    454454  {
    455     SignalHandler::getInstance()->doCatch( argv[0] );
    456 
     455    SignalHandler::getInstance()->doCatch( argv[0], "orxonox.backtrace" );
     456    SignalHandler::getInstance()->registerCallback( EventHandler::releaseMouse, NULL );
    457457  }
    458458
  • branches/proxy/src/util/signal_handler.cc

    r9240 r9322  
    2727}
    2828
    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 */
     34void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
    3035{
    3136  this->appName = appName;
     37  this->fileName = fileName;
     38 
     39  // make sure doCatch is only called once without calling dontCatch
     40  assert( sigRecList.size() == 0 );
    3241
    3342  catchSignal( SIGSEGV );
     
    3544}
    3645
     46/**
     47 * restore previous signal handlers
     48 */
    3749void SignalHandler::dontCatch()
    3850{
     
    4557}
    4658
     59/**
     60 * catch signal sig
     61 * @param sig signal to catch
     62 */
    4763void SignalHandler::catchSignal( int sig )
    4864{
     
    5874}
    5975
     76/**
     77 * sigHandler is called when receiving signals
     78 * @param sig
     79 */
    6080void SignalHandler::sigHandler( int sig )
    6181{
     
    240260  bt.insert(0, timeString);
    241261 
    242   FILE * f = fopen( GDB_BT_FILE, "a" );
     262  FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
    243263
    244264  if ( !f )
    245265  {
    246     perror("could not append to " GDB_BT_FILE);
     266    perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
    247267    exit(EXIT_FAILURE);
    248268  }
     
    250270  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
    251271  {
    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());
    253273    exit(EXIT_FAILURE);
    254274  }
  • branches/proxy/src/util/signal_handler.h

    r9240 r9322  
    99#include <list>
    1010#include <string>
    11 
    12 
    13 #define GDB_BT_FILE "orxonox.backtrace"
    1411
    1512typedef int (*SignalCallback)( void * someData );
     
    4441    void registerCallback( SignalCallback cb, void * someData );
    4542
    46     void doCatch( std::string appName );
     43    void doCatch( const std::string & appName, const std::string & fileName );
    4744    void dontCatch();
    4845
     
    5855
    5956    std::string appName;
     57    std::string fileName;
    6058};
    6159
Note: See TracChangeset for help on using the changeset viewer.