Commit de4b9ef2 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Have the gdb watcher try to match exit code better

You can't use exit() to exit in the same way as if you had
died with a signal; we tried to do some exit-code munging
but we did it one way and our tester script expected another
way.  we could resolve that, or use the approach here: try
to die with the same signal by sending it to ourselves.
parent 9e2c6741
......@@ -155,8 +155,16 @@ static void enableGdbSegfaultWatcher() {
int rtncode = 0;
if (WIFEXITED(status))
rtncode = WEXITSTATUS(status);
else
rtncode = 128 + WTERMSIG(status);
else {
int from_signal = WTERMSIG(status);
// Try to die in the same way that the child did:
signal(from_signal, SIG_DFL);
raise(from_signal);
// If somehow that didn't work, fall back to this:
exit(128 + from_signal);
}
exit(rtncode);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment