Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Girish Shilamkar <girish@linsyssoft.com>
To: gdb-patches@sources.redhat.com
Cc: girish@linsyssoft.com
Subject: [Patch] Mark the thread_event breakpoint as "not inserted" before 	calling thread_mourn_inferior
Date: Tue, 17 Jan 2006 15:35:00 -0000	[thread overview]
Message-ID: <1137512294.3217.29.camel@krypton> (raw)

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

             reply	other threads:[~2006-01-17 15:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-17 15:35 Girish Shilamkar [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1137512294.3217.29.camel@krypton \
    --to=girish@linsyssoft.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox