This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] fix crasher on detach command
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 07 Jun 2010 11:11:02 -0700
- Subject: [RFA] fix crasher on detach command
Hi,
The circumstances are, detach from a remote target that doesn't have
threads. Remote.c leaves the PID arbitrarily as "42000", and
target_detach calls remove_breakpoints_pid, which crashes because
find_inferior_pid returns NULL.
The patch just adds a test for NULL.
2010-06-07 Michael Snyder <msnyder@vmware.com>
* breakpoint.c (remove_breakpoints_pid): Check for null.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.488
diff -u -p -r1.488 breakpoint.c
--- breakpoint.c 7 Jun 2010 13:38:25 -0000 1.488
+++ breakpoint.c 7 Jun 2010 18:05:28 -0000
@@ -2041,6 +2041,9 @@ remove_breakpoints_pid (int pid)
int val;
struct inferior *inf = find_inferior_pid (pid);
+ if (inf == NULL) /* bail out */
+ return 0;
+
ALL_BP_LOCATIONS (b, b_tmp)
{
if (b->pspace != inf->pspace)