This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Disable thread specific breakpoints when thread dies
- From: Andrew STUBBS <andrew dot stubbs at st dot com>
- To: Andrew STUBBS <andrew dot stubbs at st dot com>, gdb-patches at sources dot redhat dot com
- Date: Fri, 13 Jan 2006 17:33:26 +0000
- Subject: Re: [PATCH] Disable thread specific breakpoints when thread dies
- References: <43723446.7000903@st.com> <20051113184515.GG3599@nevyn.them.org> <437875B0.4000007@st.com> <20051114155659.GA25717@nevyn.them.org> <437A19DE.6040905@st.com> <437B47A1.4040705@st.com> <20051117034811.GB3057@nevyn.them.org> <437CA66B.9060201@st.com> <20060112162659.GA16141@nevyn.them.org>
Daniel Jacobowitz wrote:
You shouldn't need to use the target method here. Does valid_thread_id
work?
Also, please remember the space before opening parentheses.
The thread still seems to have a valid ID after it has died. You can
even do 'b 8 t 4' after the program has exited. It does give an error
for threads which never existed though.
Why does that happen? It is presumably a bug.
I have looked into this. The problem is that the threads are only
deleted from the table when 'info threads' is used. The target method
works because that queries the target, not GDB's internal state, and
always gets the right answer (at least in our target interface).
I am happy, therefore, that the attached patch, with valid_thread_id(),
is correct, and will work once this other problem has been solved (or if
the user types 'info threads').
OK to commit?
I'll have a look for real problem next week probably.
Andrew Stubbs
2006-01-13 Andrew Stubbs <andrew.stubbs@st.com>
* breakpoint.c (insert_breakpoints): Check that a thread exists
before inserting thread specific breakpoints.
Index: src/gdb/breakpoint.c
===================================================================
--- src.orig/gdb/breakpoint.c 2006-01-03 18:23:49.000000000 +0000
+++ src/gdb/breakpoint.c 2006-01-13 16:34:50.000000000 +0000
@@ -1142,6 +1142,12 @@ insert_breakpoints (void)
if (!breakpoint_enabled (b->owner))
continue;
+ /* There is no point inserting thread-specific breakpoints if the
+ thread no longer exists. */
+ if (b->owner->thread != -1
+ && !valid_thread_id (b->owner->thread))
+ continue;
+
/* FIXME drow/2003-10-07: This code should be pushed elsewhere when
hardware watchpoints are split into multiple loc breakpoints. */
if ((b->loc_type == bp_loc_hardware_watchpoint