summaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorqiyao <qiyao>2011-09-17 13:29:30 +0000
committerqiyao <qiyao>2011-09-17 13:29:30 +0000
commit877a367fc8dcb2eb086c7887a9a35c23a039870e (patch)
tree03bcf80185d399c475cf5ab1601291ce997f5c5e /gdb/regcache.c
parentba9841d9df87bf928d1a3bc278328f2bb333dca3 (diff)
downloadgdb-877a367fc8dcb2eb086c7887a9a35c23a039870e.tar.gz
gdb/
* infrun.c (displaced_step_fixup): Move some code ... (displaced_step_restore): ... here. New function. (handle_inferior_event): Cleanup displaced stepping state for both child and parent when get forked or vforked event. * regcache.c (get_thread_arch_aspace_regcache): New function. get_thread_arch_regcache (): Call it.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 0af93e83a41..37092f82551 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -450,17 +450,33 @@ struct regcache_list
static struct regcache_list *current_regcache;
struct regcache *
-get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch)
+get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
+ struct address_space *aspace)
{
struct regcache_list *list;
struct regcache *new_regcache;
- struct address_space *aspace;
for (list = current_regcache; list; list = list->next)
if (ptid_equal (list->regcache->ptid, ptid)
&& get_regcache_arch (list->regcache) == gdbarch)
return list->regcache;
+ new_regcache = regcache_xmalloc_1 (gdbarch, aspace, 0);
+ new_regcache->ptid = ptid;
+
+ list = xmalloc (sizeof (struct regcache_list));
+ list->regcache = new_regcache;
+ list->next = current_regcache;
+ current_regcache = list;
+
+ return new_regcache;
+}
+
+struct regcache *
+get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch)
+{
+ struct address_space *aspace;
+
/* For the benefit of "maint print registers" & co when debugging an
executable, allow dumping the regcache even when there is no
thread selected (target_thread_address_space internal-errors if
@@ -471,15 +487,7 @@ get_thread_arch_regcache (ptid_t ptid, struct gdbarch *gdbarch)
? NULL
: target_thread_address_space (ptid));
- new_regcache = regcache_xmalloc_1 (gdbarch, aspace, 0);
- new_regcache->ptid = ptid;
-
- list = xmalloc (sizeof (struct regcache_list));
- list->regcache = new_regcache;
- list->next = current_regcache;
- current_regcache = list;
-
- return new_regcache;
+ return get_thread_arch_aspace_regcache (ptid, gdbarch, aspace);
}
static ptid_t current_thread_ptid;