From patchwork Sat Mar 11 17:03:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 19533 Received: (qmail 5054 invoked by alias); 11 Mar 2017 17:04:01 -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 2603 invoked by uid 89); 11 Mar 2017 17:03:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=21516, Hx-languages-length:1421 X-HELO: barracuda.ebox.ca Received: from barracuda.ebox.ca (HELO barracuda.ebox.ca) (96.127.255.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 11 Mar 2017 17:03:57 +0000 X-ASG-Debug-ID: 1489251835-0c856e65d4183dcf0001-fS2M51 Received: from smtp.electronicbox.net (smtp.electronicbox.net [96.127.255.82]) by barracuda.ebox.ca with ESMTP id mZH7Mv6wfdFkNHD6 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 11 Mar 2017 12:03:55 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.lan (173-246-11-162.qc.cable.ebox.net [173.246.11.162]) by smtp.electronicbox.net (Postfix) with ESMTP id 736F4440E7D; Sat, 11 Mar 2017 12:03:55 -0500 (EST) From: Simon Marchi X-Barracuda-Effective-Source-IP: cable-11.246.173-162.electronicbox.net[173.246.11.162] X-Barracuda-Apparent-Source-IP: 173.246.11.162 X-Barracuda-RBL-IP: 173.246.11.162 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v1.99 1/6] Introduce regcache_get_ptid Date: Sat, 11 Mar 2017 12:03:49 -0500 X-ASG-Orig-Subj: [PATCH v1.99 1/6] Introduce regcache_get_ptid Message-Id: <20170311170354.18468-2-simon.marchi@polymtl.ca> In-Reply-To: <20170311170354.18468-1-simon.marchi@polymtl.ca> References: <20170311170354.18468-1-simon.marchi@polymtl.ca> X-Barracuda-Connect: smtp.electronicbox.net[96.127.255.82] X-Barracuda-Start-Time: 1489251835 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 1465 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.37151 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-IsSubscribed: yes This patch introduces the regcache_get_ptid function, which can be used to retrieve the ptid a regcache is connected to. It is used in subsequent patches. gdb/ChangeLog: * regcache.h (regcache_get_ptid): New function. * regcache.c (regcache_get_ptid): New function. --- gdb/regcache.c | 10 ++++++++++ gdb/regcache.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/gdb/regcache.c b/gdb/regcache.c index 0728a03b65..58d4f56292 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -215,6 +215,16 @@ struct regcache ptid_t ptid; }; +/* See regcache.h. */ + +ptid_t +regcache_get_ptid (const struct regcache *regcache) +{ + gdb_assert (!ptid_equal (regcache->ptid, minus_one_ptid)); + + return regcache->ptid; +} + static struct regcache * regcache_xmalloc_1 (struct gdbarch *gdbarch, struct address_space *aspace, int readonly_p) diff --git a/gdb/regcache.h b/gdb/regcache.h index e1495f6142..d0107cd76e 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -39,6 +39,10 @@ struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache); struct regcache *regcache_xmalloc (struct gdbarch *gdbarch, struct address_space *aspace); +/* Return REGCACHE's ptid. */ + +extern ptid_t regcache_get_ptid (const struct regcache *regcache); + /* Return REGCACHE's architecture. */ extern struct gdbarch *get_regcache_arch (const struct regcache *regcache);