From patchwork Mon Mar 31 02:21:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 349 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 96C8B3606ED for ; Sun, 30 Mar 2014 19:21:33 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 413C6621AF178; Sun, 30 Mar 2014 19:21:33 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 250A6621AF170 for ; Sun, 30 Mar 2014 19:21:33 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=ke3kmmm17bOL9a6b0LPbwqPEDjMMO j/ztarjC8Sl64wFHLrF3UE4IAcCEwlbY/agx72qbUZUllmxeN66wQJ4lB1oTuK9s WV+qDSBrGFMtW94Cw9MQLOy1oIt18JC3UGt6n+Jbbr+6N83w7u/KRiFx8VoAmSaK 6WGlxnOJE0/uMo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=5y84QhfT6nbwYiyg9xpX1TeRigE=; b=XmL HrWrQfFQNhbC40C2lmwEyKVB3gb2hOHuP1WnCLl6K8x6Cfq1IZxoC7idyqkJT3LK /YVfwUYY11HW7e2CRDWFdN/WjQoJigxmbaJSG6VeFoEIIHB4w5cPXy+uG1zO642B 2E+hYZC9c0WKk1x36d2tJ4ae01MUln6XCORGs6/s= Received: (qmail 3445 invoked by alias); 31 Mar 2014 02:21:30 -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 3434 invoked by uid 89); 31 Mar 2014 02:21:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f202.google.com Received: from mail-qc0-f202.google.com (HELO mail-qc0-f202.google.com) (209.85.216.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 31 Mar 2014 02:21:27 +0000 Received: by mail-qc0-f202.google.com with SMTP id m20so1028581qcx.3 for ; Sun, 30 Mar 2014 19:21:25 -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:date:message-id:mime-version :content-type; bh=VskOlswjBaUl8jY/z8ko/T4irm8xWQKrjr/Guz0kaGo=; b=JA9JCCu0s7JlTCGI7vzkO/6rRGRkWYSsSfMz/YRLJf9jXBNOhDsilN41i7Yk1h8iwR lWcpqJ3LaiKd1NqniV9G46mMeFgFh/zkCmriqZBZSTRbS2r/OzIqGlAOZB9rZ8//uU2O xaJM8gepFzFIJKpe0zajL3fhUmIbiBexA6YY5y4TjrJmQitmwV7ABwyuJE5xMt+S+V0M Oa3dhCC25A67CXysuSSwTJyxaRc4lipynGmOdgGWEXsGZgEKpt067knMnyFHv1w0OrqF szLBQ4PypB1vXI2Fp16ljOuzLZUc68uezUQkAQXe7qmIEv035Ddp1zDL5mculWBPgaCM 0VzA== X-Gm-Message-State: ALoCoQlcIioGtZmjA7SVswQDbdBTORUernjxvC3fETEXyXLsNQzfF7qp6jdLK0epFYd3WhNmzh9Uit5BooBvThQTxbMEjl72xiecppNy5bsA5/c16jBnP+EMPwQ7+OHrmHyO9bF0VX80Z22E2la5Rh10k9UurCdPGUTTPvSimS0rDd5LLGPTS/dFw55vW3mUcVlR5UaTLU8hW3HOi+/HmgFqb7vcc6dpcqX6062uoZl8YOSgzfPCC8k= X-Received: by 10.58.91.196 with SMTP id cg4mr1984043veb.41.1396232485034; Sun, 30 Mar 2014 19:21:25 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id g21si2393373yhe.3.2014.03.30.19.21.25 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Mar 2014 19:21:25 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 9AB3031C145 for ; Sun, 30 Mar 2014 19:21:24 -0700 (PDT) From: Doug Evans To: gdb-patches@sourceware.org Subject: [commit] infrun.c (set_last_target_status): New function. Date: Sun, 30 Mar 2014 19:21:24 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in Hi. While working on fixing pr 14236 I found it useful to know where target_last_wait_ptid was set. It's only set in one place but it's easier to see that with a setter. Plus it's easier (for me anyway) to understand the plethora of state variables if they're accessed through API calls (at least where such calls feel obvious, as this one does - there is already a getter here). 2014-03-30 Doug Evans * infrun.c (set_last_target_status): New function. (handle_inferior_event): Call it. diff --git a/gdb/infrun.c b/gdb/infrun.c index 8f9e820..31bb132 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2965,6 +2965,15 @@ init_thread_stepping_state (struct thread_info *tss) tss->step_after_step_resume_breakpoint = 0; } +/* Set the cached copy of the last ptid/waitstatus. */ + +static void +set_last_target_status (ptid_t ptid, struct target_waitstatus status) +{ + target_last_wait_ptid = ptid; + target_last_waitstatus = status; +} + /* Return the cached copy of the last pid/waitstatus returned by target_wait()/deprecated_target_wait_hook(). The data is actually cached by handle_inferior_event(), which gets called immediately @@ -3272,8 +3281,7 @@ handle_inferior_event (struct execution_control_state *ecs) } /* Cache the last pid/waitstatus. */ - target_last_wait_ptid = ecs->ptid; - target_last_waitstatus = ecs->ws; + set_last_target_status (ecs->ptid, ecs->ws); /* Always clear state belonging to the previous time we stopped. */ stop_stack_dummy = STOP_NONE;