This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]