This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Fix bsd-uthread.c


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,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]