Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [Patch] Mark the thread_event breakpoint as "not inserted" before  calling thread_mourn_inferior
@ 2006-01-17 15:35 Girish Shilamkar
  2006-01-17 15:40 ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Girish Shilamkar @ 2006-01-17 15:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: girish

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

Hi,
	While running gdb-6.4 on Fedora Core 3 for multithread application we
encountered following problem:
-----------------------------------------------------------------------
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db
library "/lib/tls/libthread_db.so.1".

(gdb) r
Starting program: /home/girish/gdbl/build-6.4/multithread
[Thread debugging using libthread_db enabled]
[New Thread -151132480 (LWP 10793)]
Thread 0
[New Thread -151135312 (LWP 10796)]
Thread 1
Starting thread 1
[New Thread -161625168 (LWP 10797)]
Starting thread 0
Finishing thread
[Thread -151135312 (LWP 10796) exited]
Finishing thread
[Thread -161625168 (LWP 10797) exited]

Program exited normally.
Couldn't get registers: No such process.
(gdb) q
The program is running.  Exit anyway? (y or n) y
------------------------------------------------------------
	This problem was also seen on powerpc board. 
This problem occurs since gdb tries to remove thread_event breakpoint
after the thread has exited and tries to read the address space since
the breakpoint is still marked as updated.
	In the attached patch we mark the thread_event breakpoint as "not
inserted" before calling thread_mourn_inferior.
	Is this the right way?	
	If yes do we also need to do the same thing when target has been
terminated by a signal?

-Girish

[-- Attachment #2: mark_bpt_clean.patch --]
[-- Type: text/x-patch, Size: 1566 bytes --]

Index: gdb-6.4/gdb/infrun.c
===================================================================
--- gdb-6.4.orig/gdb/infrun.c	2005-11-14 21:05:16.000000000 +0530
+++ gdb-6.4/gdb/infrun.c	2006-01-17 20:57:44.431069776 +0530
@@ -1367,6 +1367,7 @@
 		       value_from_longest (builtin_type_int,
 					   (LONGEST) ecs->ws.value.integer));
       gdb_flush (gdb_stdout);
+      mark_thrd_event_bpt_clean();
       target_mourn_inferior ();
       singlestep_breakpoints_inserted_p = 0;	/*SOFTWARE_SINGLE_STEP_P() */
       stop_print_frame = 0;
Index: gdb-6.4/gdb/breakpoint.c
===================================================================
--- gdb-6.4.orig/gdb/breakpoint.c	2005-05-29 08:43:17.000000000 +0530
+++ gdb-6.4/gdb/breakpoint.c	2006-01-17 21:00:00.899323448 +0530
@@ -4289,6 +4289,17 @@
       delete_breakpoint (b);
 }
 
+void
+mark_thrd_event_bpt_clean (void)
+{
+
+      struct breakpoint *b, *temp;
+
+      ALL_BREAKPOINTS_SAFE (b, temp)
+        if (b->type == bp_thread_event)
+	   b->loc->inserted = 0;
+}
+
 struct captured_parse_breakpoint_args
   {
     char **arg_p;
Index: gdb-6.4/gdb/breakpoint.h
===================================================================
--- gdb-6.4.orig/gdb/breakpoint.h	2005-05-27 02:18:57.000000000 +0530
+++ gdb-6.4/gdb/breakpoint.h	2006-01-17 21:01:07.244237488 +0530
@@ -763,6 +763,8 @@
 
 extern void remove_thread_event_breakpoints (void);
 
+extern void  mark_thrd_event_bpt_clean (void);
+
 extern void disable_breakpoints_in_shlibs (int silent);
 
 extern void re_enable_breakpoints_in_shlibs (void);

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

end of thread, other threads:[~2006-01-24 21:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-17 15:35 [Patch] Mark the thread_event breakpoint as "not inserted" before calling thread_mourn_inferior Girish Shilamkar
2006-01-17 15:40 ` Daniel Jacobowitz
2006-01-18  9:11   ` Girish Shilamkar
2006-01-18 13:57     ` Daniel Jacobowitz
2006-01-20 14:14       ` Girish Shilamkar
2006-01-20 14:35         ` Daniel Jacobowitz
2006-01-23  9:21           ` Girish Shilamkar
2006-01-24 21:52             ` Daniel Jacobowitz

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