attach gdbserver to itself
Bin Chen
binary.chen@gmail.com
Wed Jan 24 12:48:00 GMT 2007
Hi,
Current I am doing a trick that attach the gdbserver to itself when the
process encounter the segment fault, like this:
void segv_handler(int no)
{
int pid, status;
VoIPLog("segv_handler.");
char buf[128];
pid = getpid();
sprintf(buf, "/usr/bin/gdbserver :9988 --attach %d", pid);
pid = fork();
if (pid == 0) {
system(buf);
} else
::wait((int *)&status);
return;
}
But in most of time this can't get useful information, especially in
multi threading env, most of time the result is wrong, of course, I am
saying the backtrace.
But if I start program by gdbserver :9988 program, it can catch the
error. What is the difference? How can I revise my code to make above
code has same effect like starting the program by gdbserver?
I am debugging in ARM platform.
Any help appreciated!
Bin Chen
More information about the Gdb
mailing list