[PATCH] fix error sending signal to dead process
"Patrick Monnerat" <[email protected]> Thu, 5 Apr 2012 14:45:49 +0200
| Newsgroups | gmane.comp.debugging.insight |
|---|---|
| Message-ID | <AB5E58B87EB73C46A38073D8F459F113D9F882@dataspheresrv01> |
Using insight-7.4.50 (cvs snapshot 20120403), continuing or stepping after a fault (i.e. segfault) occurred results in sending a signal to the dead process. This is due to hook gdbtk_annotate_signal() trying to get thread_info structure with a null pid. Continuing in the same insight session (by re-running the program) finally ends in insight segfaulting. The attached patch fixes this problem. It simply do not pass signal to tcl if the pid is null. Cheers, Patrick P.S.: the bug report system linked from your web site (http://sources.redhat.com/cgi-bin/gnatsweb.pl?database=insight&user=gue st&password=guest&cmd=login) is down (HTTP error 500).
insight-7.4.50-sig2dead.patch
(application/octet-stream, 912 B)
diff -Naur insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-hooks.c insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-hooks.c
--- insight-7.4.50.orig/gdb/gdbtk/generic/gdbtk-hooks.c 2012-03-28 15:09:12.000000000 +0200
+++ insight-7.4.50.new/gdb/gdbtk/generic/gdbtk-hooks.c 2012-04-05 12:44:20.284306992 +0200
@@ -804,7 +804,7 @@
gdbtk_annotate_signal (void)
{
char *buf;
- struct thread_info *tp = inferior_thread ();
+ struct thread_info *tp;
/* Inform gui that the target has stopped. This is
a necessary stop button evil. We don't want signal notification
@@ -812,6 +812,11 @@
timeout. */
Tcl_Eval (gdbtk_interp, "gdbtk_stop_idle_callback");
+ if (ptid_equal(inferior_ptid, null_ptid))
+ return;
+
+ tp = inferior_thread ();
+
buf = xstrprintf ("gdbtk_signal %s {%s}",
target_signal_to_name (tp->suspend.stop_signal),
target_signal_to_string (tp->suspend.stop_signal));