diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2017-03-13 18:51:38 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-03-13 18:51:38 -0400 |
commit | c6386875ba57a806c896ba097afef525671de4a0 (patch) | |
tree | 4288fecf466c8cde0d663a552830d77fd262d9bb | |
parent | ddaaf0fb8605fced72e84410fc7ac834e529eb53 (diff) | |
download | binutils-c6386875ba57a806c896ba097afef525671de4a0.zip binutils-c6386875ba57a806c896ba097afef525671de4a0.tar.gz binutils-c6386875ba57a806c896ba097afef525671de4a0.tar.bz2 |
Add asserts in target_fetch/store_registers
We are currently assuming that regcache->ptid is equal to inferior_ptid
when we call target_fetch/store_registers. These asserts just validate
that assumption. Also, since the following patches will change target
code to use regcache->ptid instead of inferior_ptid, asserting that they
are the same should ensure that our changes don't have any unintended
consequences.
gdb/ChangeLog:
* target.c (target_fetch_registers, target_store_registers): Add
assert.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/target.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e155a3..f8cb947 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-03-13 Simon Marchi <simon.marchi@polymtl.ca> + * target.c (target_fetch_registers, target_store_registers): Add + assert. + +2017-03-13 Simon Marchi <simon.marchi@polymtl.ca> + * regcache.h (regcache_get_ptid): New function. * regcache.c (regcache_get_ptid): New function. diff --git a/gdb/target.c b/gdb/target.c index 0ff8515..359bf0d 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3587,6 +3587,8 @@ debug_print_register (const char * func, void target_fetch_registers (struct regcache *regcache, int regno) { + gdb_assert (ptid_equal (regcache_get_ptid (regcache), inferior_ptid)); + current_target.to_fetch_registers (¤t_target, regcache, regno); if (targetdebug) debug_print_register ("target_fetch_registers", regcache, regno); @@ -3598,6 +3600,8 @@ target_store_registers (struct regcache *regcache, int regno) if (!may_write_registers) error (_("Writing to registers is not allowed (regno %d)"), regno); + gdb_assert (ptid_equal (regcache_get_ptid (regcache), inferior_ptid)); + current_target.to_store_registers (¤t_target, regcache, regno); if (targetdebug) { |