From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 749 invoked by alias); 6 Jul 2007 12:05:57 -0000 Received: (qmail 649 invoked by uid 22791); 6 Jul 2007 12:05:56 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 06 Jul 2007 12:05:52 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0) with ESMTP id l66BdnkS016209; Fri, 6 Jul 2007 13:39:49 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0/Submit) id l66BdnrB022359; Fri, 6 Jul 2007 13:39:49 +0200 (CEST) Date: Fri, 06 Jul 2007 12:05:00 -0000 Message-Id: <200707061139.l66BdnrB022359@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: gdb-patches@sourceware.org, drow@false.org Subject: [commit] Fix bsd-uthread.c Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00106.txt.bz2 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 + + * bsd-uthread.c (bsd_uthread_wait): Don't try to fetch thread IDs + for terminated processes. + 2007-07-05 Michael Snyder * 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,