Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 22, 2012, 10:36:09 AM (13 years ago)
Author:
landauf
Message:

added tests for several classes and functions in util

Location:
code/branches/testing/src/libraries/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/testing/src/libraries/util/SignalHandler.cc

    r8858 r9114  
    2121 *
    2222 *   Author:
    23  *      Christoph Renner
     23 *      Christoph Renner (Linux implementation)
     24 *      Fabian 'x3n' Landau (Windows implementation)
    2425 *   Co-authors:
    2526 *      ...
     
    139140      orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl;
    140141
    141      
     142
    142143      // First start GDB which will be attached to this process later on
    143      
     144
    144145      int gdbIn[2];
    145146      int gdbOut[2];
    146147      int gdbErr[2];
    147      
     148
    148149      if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 )
    149150      {
     
    151152        exit(EXIT_FAILURE);
    152153      }
    153      
     154
    154155      int gdbPid = fork();
    155156      // this process will run gdb
    156      
     157
    157158      if ( gdbPid == -1 )
    158159      {
     
    160161        exit(EXIT_FAILURE);
    161162      }
    162      
     163
    163164      if ( gdbPid == 0 )
    164165      {
    165166        // start gdb
    166        
     167
    167168        close(gdbIn[1]);
    168169        close(gdbOut[0]);
    169170        close(gdbErr[0]);
    170        
     171
    171172        dup2( gdbIn[0], STDIN_FILENO );
    172173        dup2( gdbOut[1], STDOUT_FILENO );
    173174        dup2( gdbErr[1], STDERR_FILENO );
    174        
     175
    175176        execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(NULL));
    176177      }
    177      
    178      
     178
     179
    179180      // Now start a fork of this process on which GDB will be attached on
    180      
     181
    181182      int sigPipe[2];
    182183      if ( pipe(sigPipe) == -1 )
     
    202203      {
    203204        getInstance().dontCatch();
    204        
     205
    205206        // make sure gdb is allowed to attach to our PID even if there are some system restrictions
    206207#ifdef PR_SET_PTRACER
     
    208209          orxout(user_error) << "could not set proper permissions for GDB to attach to process..." << endl;
    209210#endif
    210        
     211
    211212        // wait for message from parent when it has attached gdb
    212213        int someData;
  • code/branches/testing/src/libraries/util/SignalHandler.h

    r8351 r9114  
    2121 *
    2222 *   Author:
    23  *      Christoph Renner
     23 *      Christoph Renner (Linux implementation)
     24 *      Fabian 'x3n' Landau (Windows implementation)
    2425 *   Co-authors:
    2526 *      ...
Note: See TracChangeset for help on using the changeset viewer.