Changeset 9114 for code/branches/testing/src
- Timestamp:
- Apr 22, 2012, 10:36:09 AM (13 years ago)
- Location:
- code/branches/testing/src/libraries/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/testing/src/libraries/util/SignalHandler.cc
r8858 r9114 21 21 * 22 22 * Author: 23 * Christoph Renner 23 * Christoph Renner (Linux implementation) 24 * Fabian 'x3n' Landau (Windows implementation) 24 25 * Co-authors: 25 26 * ... … … 139 140 orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Try to write backtrace to file orxonox_crash.log" << endl; 140 141 141 142 142 143 // First start GDB which will be attached to this process later on 143 144 144 145 int gdbIn[2]; 145 146 int gdbOut[2]; 146 147 int gdbErr[2]; 147 148 148 149 if ( pipe(gdbIn) == -1 || pipe(gdbOut) == -1 || pipe(gdbErr) == -1 ) 149 150 { … … 151 152 exit(EXIT_FAILURE); 152 153 } 153 154 154 155 int gdbPid = fork(); 155 156 // this process will run gdb 156 157 157 158 if ( gdbPid == -1 ) 158 159 { … … 160 161 exit(EXIT_FAILURE); 161 162 } 162 163 163 164 if ( gdbPid == 0 ) 164 165 { 165 166 // start gdb 166 167 167 168 close(gdbIn[1]); 168 169 close(gdbOut[0]); 169 170 close(gdbErr[0]); 170 171 171 172 dup2( gdbIn[0], STDIN_FILENO ); 172 173 dup2( gdbOut[1], STDOUT_FILENO ); 173 174 dup2( gdbErr[1], STDERR_FILENO ); 174 175 175 176 execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(NULL)); 176 177 } 177 178 178 179 179 180 // Now start a fork of this process on which GDB will be attached on 180 181 181 182 int sigPipe[2]; 182 183 if ( pipe(sigPipe) == -1 ) … … 202 203 { 203 204 getInstance().dontCatch(); 204 205 205 206 // make sure gdb is allowed to attach to our PID even if there are some system restrictions 206 207 #ifdef PR_SET_PTRACER … … 208 209 orxout(user_error) << "could not set proper permissions for GDB to attach to process..." << endl; 209 210 #endif 210 211 211 212 // wait for message from parent when it has attached gdb 212 213 int someData; -
code/branches/testing/src/libraries/util/SignalHandler.h
r8351 r9114 21 21 * 22 22 * Author: 23 * Christoph Renner 23 * Christoph Renner (Linux implementation) 24 * Fabian 'x3n' Landau (Windows implementation) 24 25 * Co-authors: 25 26 * ...
Note: See TracChangeset
for help on using the changeset viewer.