* [commit] Fix bsd-uthread.c
@ 2007-07-06 12:05 Mark Kettenis
2007-07-06 11:58 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2007-07-06 12:05 UTC (permalink / raw)
To: gdb-patches, drow
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,
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [commit] Fix bsd-uthread.c
2007-07-06 12:05 [commit] Fix bsd-uthread.c Mark Kettenis
@ 2007-07-06 11:58 ` Daniel Jacobowitz
2007-07-06 13:18 ` Mark Kettenis
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-07-06 11:58 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Fri, Jul 06, 2007 at 01:39:49PM +0200, Mark Kettenis wrote:
> 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.
This is at the tail end of wait, i.e. before we've popped the current
target, right? Thanks, I see why it broke now.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [commit] Fix bsd-uthread.c
2007-07-06 11:58 ` Daniel Jacobowitz
@ 2007-07-06 13:18 ` Mark Kettenis
0 siblings, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2007-07-06 13:18 UTC (permalink / raw)
To: drow; +Cc: gdb-patches
> Date: Fri, 6 Jul 2007 07:58:02 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> On Fri, Jul 06, 2007 at 01:39:49PM +0200, Mark Kettenis wrote:
> > 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.
>
> This is at the tail end of wait, i.e. before we've popped the current
> target, right? Thanks, I see why it broke now.
Right
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-06 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-06 12:05 [commit] Fix bsd-uthread.c Mark Kettenis
2007-07-06 11:58 ` Daniel Jacobowitz
2007-07-06 13:18 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox