2010-12-20 Yao Qi * infrun.c (displaced_step_prepare): Replace regcache_write_pc by regcache_cooked_write_unsigned to update PC without side effect. diff --git a/gdb/infrun.c b/gdb/infrun.c index 1bc00a4..2711e19 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1304,8 +1304,13 @@ displaced_step_prepare (ptid_t ptid) make_cleanup (displaced_step_clear_cleanup, displaced); - /* Resume execution at the copy. */ - regcache_write_pc (regcache, copy); + /* Resume execution at the copy. Update PC without any side effects. */ + if (gdbarch_pc_regnum (gdbarch) >= 0) + regcache_cooked_write_unsigned (regcache, + gdbarch_pc_regnum (gdbarch), copy); + else + internal_error (__FILE__, __LINE__, + _("displaced: Unable to update PC")); discard_cleanups (ignore_cleanups);