Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] fix crasher on detach command
@ 2010-06-07 18:11 Michael Snyder
  2010-06-07 18:28 ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Snyder @ 2010-06-07 18:11 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

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.


[-- Attachment #2: null.txt --]
[-- Type: text/plain, Size: 637 bytes --]

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)

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-06-08 16:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-07 18:11 [RFA] fix crasher on detach command Michael Snyder
2010-06-07 18:28 ` Pedro Alves
2010-06-07 18:31   ` Michael Snyder
2010-06-07 18:37     ` Pedro Alves
2010-06-07 19:00       ` Michael Snyder
2010-06-07 19:09         ` Pedro Alves
2010-06-07 19:12           ` Pedro Alves
2010-06-07 23:50             ` Michael Snyder
2010-06-08 12:56               ` Pedro Alves
2010-06-08  0:11             ` Michael Snyder
2010-06-08 12:59               ` Pedro Alves
2010-06-08 16:52                 ` Michael Snyder
2010-06-08  2:42   ` Hui Zhu
2010-06-08 12:54     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox