From: Andrew STUBBS <andrew.stubbs@st.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Disable thread specific breakpoints when thread dies
Date: Mon, 16 Jan 2006 16:19:00 -0000 [thread overview]
Message-ID: <43CBC6EB.9080904@st.com> (raw)
In-Reply-To: <43CB97A2.20205@st.com>
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
Andrew STUBBS wrote:
> Now onto figuring out why it doesn't work....
The smoking gun seems to be here:
[From linux-thread-db.c]
static void
detach_thread (ptid_t ptid, int verbose)
{
struct thread_info *thread_info;
if (verbose)
printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (ptid));
/* Don't delete the thread now, because it still reports as active
until it has executed a few instructions after the event
breakpoint - if we deleted it now, "info threads" would cause us
to re-attach to it. Just mark it as having had a TD_DEATH
event. This means that we won't delete it from our thread list
until we notice that it's dead (via prune_threads), or until
something re-uses its thread ID. */
thread_info = find_thread_pid (ptid);
gdb_assert (thread_info != NULL);
thread_info->private->dying = 1;
}
The attached patch fixes the problem, but I don't know if it does it the
best way.
What do you think?
Andrew Stubbs
[-- Attachment #2: prune_threads.patch --]
[-- Type: text/plain, Size: 1949 bytes --]
2006-01-16 Amdrew Stubbs <andrew.stubbs@st.com>
* gdbthread.h (prune_threads): Add prototype.
* infrun.c (normal_stop): Call prune_threads().
* thread.c (prune_threads): Remove 'static'.
Index: src/gdb/gdbthread.h
===================================================================
--- src.orig/gdb/gdbthread.h 2006-01-16 16:08:57.000000000 +0000
+++ src/gdb/gdbthread.h 2006-01-16 16:13:57.000000000 +0000
@@ -80,6 +80,9 @@ extern struct thread_info *add_thread (p
/* Delete an existing thread list entry. */
extern void delete_thread (ptid_t);
+/* Delete all dead threads from the list. */
+extern void prune_threads (void);
+
/* Delete a step_resume_breakpoint from the thread database. */
extern void delete_step_resume_breakpoint (void *);
Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c 2006-01-16 16:08:57.000000000 +0000
+++ src/gdb/infrun.c 2006-01-16 16:13:57.000000000 +0000
@@ -3037,6 +3037,9 @@ Further execution is probably impossible
if (stopped_by_random_signal)
disable_current_display ();
+ /* Delete any threads which have died. */
+ prune_threads ();
+
/* Don't print a message if in the middle of doing a "step n"
operation for n > 1 */
if (step_multi && stop_step)
Index: src/gdb/thread.c
===================================================================
--- src.orig/gdb/thread.c 2006-01-16 16:08:57.000000000 +0000
+++ src/gdb/thread.c 2006-01-16 16:13:57.000000000 +0000
@@ -64,7 +64,6 @@ static void info_threads_command (char *
static void thread_apply_command (char *, int);
static void restore_current_thread (ptid_t);
static void switch_to_thread (ptid_t ptid);
-static void prune_threads (void);
void
delete_step_resume_breakpoint (void *arg)
@@ -382,7 +381,7 @@ thread_alive (struct thread_info *tp)
return 1;
}
-static void
+void
prune_threads (void)
{
struct thread_info *tp, *next;
next prev parent reply other threads:[~2006-01-16 16:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-09 19:06 Andrew STUBBS
2005-11-13 21:13 ` Daniel Jacobowitz
2005-11-14 16:34 ` Andrew STUBBS
2005-11-14 17:11 ` Daniel Jacobowitz
2005-11-15 18:55 ` Andrew STUBBS
2005-11-16 16:23 ` Andrew STUBBS
2005-11-17 4:22 ` Daniel Jacobowitz
2005-11-17 16:34 ` Andrew STUBBS
2006-01-12 16:25 ` Andrew STUBBS
2006-01-13 4:19 ` Michael Snyder
2006-01-13 4:31 ` Daniel Jacobowitz
2006-01-12 16:27 ` Daniel Jacobowitz
2006-01-13 17:35 ` Andrew STUBBS
2006-01-13 20:11 ` Mark Kettenis
2006-01-14 15:46 ` Daniel Jacobowitz
2006-01-14 15:56 ` Mark Kettenis
2006-01-14 16:06 ` Daniel Jacobowitz
2006-01-16 12:57 ` Andrew STUBBS
2006-01-16 16:19 ` Andrew STUBBS [this message]
2006-01-20 14:56 ` Andrew STUBBS
2006-01-20 15:00 ` Daniel Jacobowitz
2006-01-20 22:41 ` Daniel Jacobowitz
2006-02-02 2:30 ` 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=43CBC6EB.9080904@st.com \
--to=andrew.stubbs@st.com \
--cc=drow@false.org \
--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