From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: gdb-patches@sourceware.org, drow@false.org
Subject: [commit] Fix bsd-uthread.c
Date: Fri, 06 Jul 2007 12:05:00 -0000 [thread overview]
Message-ID: <200707061139.l66BdnrB022359@brahms.sibelius.xs4all.nl> (raw)
This fixes the problem with threads debugging I reported a few days
ago. The problem is that the code reads from target memory to look up
the thread ID. This used to be ago, since if reading from the live
target failed, it would read from the object file, and things would be
ok (even though what it read from the object file was probably just a
bunch of zeroes). However, with the change that Daniel recently made,
that no longer happens, error() gets called, and we end up in a
hopelessly confused state.
The fix is to skip the lookup if we now the process is no longer
alive.
Mark
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.8535
diff -u -p -r1.8535 ChangeLog
--- ChangeLog 5 Jul 2007 22:47:27 -0000 1.8535
+++ ChangeLog 6 Jul 2007 11:27:37 -0000
@@ -1,3 +1,8 @@
+2007-07-06 Mark Kettenis <kettenis@gnu.org>
+
+ * bsd-uthread.c (bsd_uthread_wait): Don't try to fetch thread IDs
+ for terminated processes.
+
2007-07-05 Michael Snyder <msnyder@access-company.com>
* event-top.c (cli_command_loop): Prompt string can (and should)
Index: bsd-uthread.c
===================================================================
RCS file: /cvs/src/src/gdb/bsd-uthread.c,v
retrieving revision 1.9
diff -u -p -r1.9 bsd-uthread.c
--- bsd-uthread.c 6 May 2007 14:34:37 -0000 1.9
+++ bsd-uthread.c 6 Jul 2007 11:27:37 -0000
@@ -337,6 +337,12 @@ bsd_uthread_wait (ptid_t ptid, struct ta
/* Pass the request to the layer beneath. */
ptid = find_target_beneath (bsd_uthread_ops_hack)->to_wait (ptid, status);
+ /* If the process is no longer alive, there's no point in figuring
+ out the thread ID. It will fail anyway. */
+ if (status->kind == TARGET_WAITKIND_SIGNALLED
+ || status->kind == TARGET_WAITKIND_EXITED)
+ return ptid;
+
/* Fetch the corresponding thread ID, and augment the returned
process ID with it. */
addr = read_memory_typed_address (bsd_uthread_thread_run_addr,
next reply other threads:[~2007-07-06 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-06 12:05 Mark Kettenis [this message]
2007-07-06 11:58 ` Daniel Jacobowitz
2007-07-06 13:18 ` Mark Kettenis
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=200707061139.l66BdnrB022359@brahms.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/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