Apply patch #1078: Expand the GDB exceptionhandler.

With our current backtrace dumps I quite oftenly find that in case of segfaults, which combined with assert failures are the most common crash cause, I cannot easily see what value the dereferenced pointer held.

To be able to see this the exception handler will now invoke the "disassemble" and "info registers" commands when producing a back trace using GDB. This gives us the ability to see the precise assembly instruction that triggered the crash, together with the value of the register that was used as pointer.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5352 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-07-01 20:40:40 +00:00
parent 45b8413abf
commit fd6b6262ba
1 changed files with 8 additions and 2 deletions

View File

@ -461,10 +461,16 @@ static void posixExceptionHandler(int signum, siginfo_t * siginfo, WZ_DECL_UNUSE
}
else if (pid > (pid_t)0)
{
static const char gdbCommands[] = "backtrace full\n"
"frame 3\n"
"disassemble\n"
"info registers\n"
"quit\n";
close(gdbPipe[0]); // No input from pipe
write(gdbPipe[1], "backtrace full\n" "quit\n",
strlen("backtrace full\n" "quit\n"));
write(gdbPipe[1], gdbCommands,
sizeof(gdbCommands));
if (waitpid(pid, NULL, 0) < 0)
{