From patchwork Wed Apr 20 18:01:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 11823 Received: (qmail 66841 invoked by alias); 20 Apr 2016 18:01:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 66792 invoked by uid 89); 20 Apr 2016 18:01:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:209.85.220.67, H*RU:209.85.220.67, Things, qiyaoltc@gmail.com X-HELO: mail-pa0-f67.google.com Received: from mail-pa0-f67.google.com (HELO mail-pa0-f67.google.com) (209.85.220.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 20 Apr 2016 18:01:19 +0000 Received: by mail-pa0-f67.google.com with SMTP id yl2so2062017pac.1 for ; Wed, 20 Apr 2016 11:01:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:references:cc:date:in-reply-to :message-id:user-agent:mime-version; bh=0Wr0SGQYFz535fA8dTYiSHuHLbUPU2QAYyrOo0+Tqjo=; b=Vq5PaCl2FZZlHm5VWyJansVxFT0zPG/w5pvbSC9VxARmhhwIk+Ld0gq/veJmiDIOXQ kyYdpd9ZTPLv9OMBjwSAkE0fVsg6Qza2LngL/tJ/fD6IoOI07UGgdvWAVnDrjoPyuQ1x nedICsZvIR7c6XzZkL6NK52TxW6FHQnEkeeG0WCOI7SSfbx5ZBrnOfUIFtrwFJPn99uW AprUfP4oyo2SQ1PZXvr39g0cJxtPloL/gHG8hZkuBV9vmS2OypNx7Xy5OAqbDaiwqxNU Gh3iRoG03GYqbqOxdAdN7QYw/tzI9NPCLEGop/oLMQzbBFijwPJrlKZ+0HB/+WBqIXGZ x2SA== X-Gm-Message-State: AOPr4FVbaPI7IiNJ0A7Q4+oM84BVg+XyINmW1JqxFKnFNYKBUx1ZoMwykC4XdXZ6RFvxcQ== X-Received: by 10.66.141.144 with SMTP id ro16mr14077000pab.137.1461175276646; Wed, 20 Apr 2016 11:01:16 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by smtp.gmail.com with ESMTPSA id a205sm32185829pfa.6.2016.04.20.11.01.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Apr 2016 11:01:15 -0700 (PDT) From: Doug Evans To: Yao Qi , Pedro Alves Subject: Re: [PATCH 2/2] Replace address and aspace with thread in struct step_over_info References: <1460726961-27486-1-git-send-email-yao.qi@linaro.org> <1460726961-27486-3-git-send-email-yao.qi@linaro.org> <57160BDA.4090104@redhat.com> <86a8kpk8k1.fsf@gmail.com> cc: gdb-patches@sourceware.org Date: Wed, 20 Apr 2016 11:01:14 -0700 In-Reply-To: <86a8kpk8k1.fsf@gmail.com> (Yao Qi's message of "Tue, 19 Apr 2016 14:54:54 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Yao Qi writes: > Pedro Alves writes: > >> I think this is problematic. >> >> While a thread is being stepped past a breakpoint, it's possible that the >> user sets some other breakpoint, and then we end up in >> stepping_past_instruction_at >> deciding whether we can insert that new breakpoint, while the step-over thread >> is running. >> >> As soon as the step-over thread is resumed for the actual step-over, it's >> regcache is flushed (target_resume -> registers_changed_ptid). From that point >> and until the thread stops again, trying to fetch its regcache will error out, >> because you can't read registers from a thread that is running. > > OK, that is a good case. I didn't think of it. I withdraw the patch. A good place for a comment explaining Why Things Are The Way They Are. Not sure how you want to word this. 2016-04-20 Doug Evans * infrun.c (set_step_over_info): Add comment. diff --git a/gdb/infrun.c b/gdb/infrun.c index 696105d..c7ea5e2 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1325,7 +1325,9 @@ struct step_over_info static struct step_over_info step_over_info; /* Record the address of the breakpoint/instruction we're currently - stepping over. */ + stepping over. + N.B. We record the aspace and address now, instead of say just the thread, + because when we need the info later the thread may be running. */ static void set_step_over_info (struct address_space *aspace, CORE_ADDR address,