From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1593 invoked by alias); 27 Sep 2005 22:10:35 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 1223 invoked by uid 22791); 27 Sep 2005 22:10:23 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 27 Sep 2005 22:10:23 +0000 Received: from Relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 729A11D96D for ; Wed, 28 Sep 2005 00:10:19 +0200 (CEST) From: Andreas Schwab To: gdb-patches@sources.redhat.com Subject: PR threads/2015: Fix adjust_pc_after_break for thread debugging X-Yow: Talking Pinhead Blues: Oh, I LOST my ``HELLO KITTY'' DOLL and I get BAD reception on channel TWENTY-SIX!! Th'HOSTESS FACTORY is closin' down and I just heard ZASU PITTS has been DEAD for YEARS.. (sniff) My PLATFORM SHOE collection was CHEWED up by th'dog, ALEXANDER HAIG won't let me take a SHOWER 'til Easter.. (snurf) So I went to the kitchen, but WALNUT PANELING whup me upside mah HAID!! (on no, no, no.. Heh, heh) Date: Tue, 27 Sep 2005 22:10:00 -0000 Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2005-09/txt/msg00256.txt.bz2 adjust_pc_after_break is doing the wrong thing during thread debugging when the current thread is different from the thread when the debuggee was stopped last. The problem is that it calls currently_stepping, which accesses global variables that are part of the thread context. But the context switch will only happen much later on. The proposed fix will skip the call when the current infrun context does not match the thread to be examined. This has been tested on x86_64-suse-linux and fixes 32 testcases without any regressions. Andreas. 2005-09-28 Andreas Schwab PR threads/2015 * infrun.c (adjust_pc_after_break): Don't use the state from a non-matching thread context. --- gdb/infrun.c 01 Aug 2005 11:52:13 +0200 1.203 +++ gdb/infrun.c 28 Sep 2005 00:03:47 +0200 @@ -1200,8 +1200,12 @@ adjust_pc_after_break (struct execution_ /* When using hardware single-step, a SIGTRAP is reported for both a completed single-step and a software breakpoint. Need to differentiate between the two as the latter needs - adjusting but the former does not. */ - if (currently_stepping (ecs)) + adjusting but the former does not. + + When the thread to be examined does not match the current thread + context we can't use currently_stepping, so assume no + single-stepping in this case. */ + if (ptid_equal (ecs->ptid, inferior_ptid) && currently_stepping (ecs)) { if (prev_pc == breakpoint_pc && software_breakpoint_inserted_here_p (breakpoint_pc)) -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."