From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15122 invoked by alias); 16 Aug 2010 18:41:06 -0000 Received: (qmail 15113 invoked by uid 22791); 16 Aug 2010 18:41:06 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.17.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Aug 2010 18:41:01 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.1/8.13.1) with ESMTP id o7GIen4p001471 for ; Mon, 16 Aug 2010 18:40:49 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o7GIenkZ3989584 for ; Mon, 16 Aug 2010 20:40:49 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o7GIembL024239 for ; Mon, 16 Aug 2010 20:40:48 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id o7GIel4W024223; Mon, 16 Aug 2010 20:40:47 +0200 Message-Id: <201008161840.o7GIel4W024223@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 16 Aug 2010 20:40:47 +0200 Subject: Re: Fixes for a couple of infrun bugs (thread hop, revert to step thread). To: pedro@codesourcery.com (Pedro Alves) Date: Mon, 16 Aug 2010 18:41:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <201008161930.20550.pedro@codesourcery.com> from "Pedro Alves" at Aug 16, 2010 07:30:20 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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: 2010-08/txt/msg00233.txt.bz2 Pedro Alves wrote: > Replacing the "next" by a "continue" should work. I've looked over the > original description of the problem this is covering, and, that > would still exercise the problem (which is gdb trying to step > the other (main) thread with inferior_ptid still pointing at > the thread that was being "next"ed, and in the process failing > to remove breakpoints from memory because inferior_ptid pointed > at an inferior thread. But isn't the code your patch changes under an if that's only true if another thread is currently being stepped or nexted? If we just do "continue" here, that's no longer the case, and the code wouldn't be exercised at all ... @@ -3483,7 +3486,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME ( if (!non_stop) { struct thread_info *tp; - tp = iterate_over_threads (currently_stepping_callback, + tp = iterate_over_threads (currently_stepping_or_nexting_callback, ecs->event_thread); if (tp) { @@ -3498,6 +3501,21 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME ( return; } + /* If the stepping thread exited, then don't try reverting + back to it, just keep going. We need to query the target + in case it doesn't support thread exit events. */ + if (is_exited (tp->ptid) + || !target_thread_alive (tp->ptid)) + { + if (debug_infrun) + fprintf_unfiltered (gdb_stdlog, "\ +infrun: not switching back to stepped thread, it has vanished\n"); + + delete_thread (tp->ptid); + keep_going (ecs); + return; + } + /* Otherwise, we no longer expect a trap in the current thread. Clear the trap_expected flag before switching back -- this is what keep_going would do as well, if we called it. */ Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com