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]

[Patch] Mark the thread_event breakpoint as "not inserted" before calling thread_mourn_inferior


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

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