From: Philipp Rudo <prudo@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Omair Javaid <omair.javaid@linaro.org>,
Yao Qi <qiyaoltc@gmail.com>,
arnez@linux.vnet.ibm.com
Subject: [RFC PATCH v5 3/9] Add scoped_restore_regcache_ptid
Date: Mon, 12 Mar 2018 15:31:00 -0000 [thread overview]
Message-ID: <20180312153115.47321-4-prudo@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180312153115.47321-1-prudo@linux.vnet.ibm.com>
When a target and its target beneath use different ptids to identify a
thread the regcaches ptid has to be set/restored when calls are passed down
to the target beneath to e.g. fetch_registers. Add a scoped_restore to
simplify this.
gdb/ChangeLog:
regcache.h (scoped_restore_regcache_ptid): New class.
---
gdb/regcache.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gdb/regcache.h b/gdb/regcache.h
index d7bb8b5c93..8e45d7c513 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -403,6 +403,27 @@ private:
registers_changed_ptid (ptid_t ptid);
};
+/* Save/restore the current ptid of REGCACHE. */
+
+class scoped_restore_regcache_ptid
+{
+public:
+ scoped_restore_regcache_ptid (regcache *regcache)
+ : m_regcache (regcache), m_ptid (regcache->ptid ())
+ {}
+
+ ~scoped_restore_regcache_ptid ()
+ {
+ m_regcache->set_ptid (m_ptid);
+ }
+
+ DISABLE_COPY_AND_ASSIGN (scoped_restore_regcache_ptid);
+
+private:
+ regcache *m_regcache;
+ ptid_t m_ptid;
+};
+
class readonly_detached_regcache : public readable_regcache
{
public:
--
2.13.5
next prev parent reply other threads:[~2018-03-12 15:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 15:31 [RFC v5 0/9] Add support for Linux kernel debugging Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 2/9] Add libiberty/concat styled concat_path function Philipp Rudo
2018-03-16 2:47 ` Simon Marchi
2018-03-12 15:31 ` [RFC PATCH v5 9/9] Add S390 support for linux-kernel target Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 5/9] Add kernel module " Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 7/9] Add privileged registers for s390x Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 8/9] Link frame_info to thread_info Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 1/9] Convert substitute_path_component to C++ Philipp Rudo
2018-03-16 2:15 ` Simon Marchi
2018-03-17 20:11 ` Simon Marchi
2018-03-12 15:31 ` [RFC PATCH v5 6/9] Add commands for linux-kernel target Philipp Rudo
2018-03-12 15:31 ` [RFC PATCH v5 4/9] Add basic Linux kernel support Philipp Rudo
2018-03-13 14:09 ` Kamil Rytarowski
2018-03-14 9:48 ` Philipp Rudo
2018-03-14 23:38 ` Kamil Rytarowski
2018-03-19 0:11 ` Simon Marchi
2018-03-12 15:31 ` Philipp Rudo [this message]
2018-03-17 18:08 ` [RFC PATCH v5 3/9] Add scoped_restore_regcache_ptid Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180312153115.47321-4-prudo@linux.vnet.ibm.com \
--to=prudo@linux.vnet.ibm.com \
--cc=arnez@linux.vnet.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=omair.javaid@linaro.org \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox