This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Introduce regcache_get_ptid


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ddaaf0fb8605fced72e84410fc7ac834e529eb53

commit ddaaf0fb8605fced72e84410fc7ac834e529eb53
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Mon Mar 13 18:51:38 2017 -0400

    Introduce regcache_get_ptid
    
    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.

Diff:
---
 gdb/ChangeLog  |  5 +++++
 gdb/regcache.c | 10 ++++++++++
 gdb/regcache.h |  4 ++++
 3 files changed, 19 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7de2498..3e155a3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-13  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* regcache.h (regcache_get_ptid): New function.
+	* regcache.c (regcache_get_ptid): New function.
+
 2017-03-13  Mark Wielaard  <mark@klomp.org>
 
 	* cp-name-parser.y (make_empty): Initialize d_printing to zero.
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 0728a03..58d4f56 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 e1495f6..d0107cd 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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]