aboutsummaryrefslogtreecommitdiff
path: root/gdb/hppa-tdep.c
diff options
context:
space:
mode:
authorRandolph Chung <tausq@debian.org>2004-12-03 23:59:53 +0000
committerRandolph Chung <tausq@debian.org>2004-12-03 23:59:53 +0000
commitfe46cd3ab5b2a04cb88f5f34a2d692dc856b3a5a (patch)
treea4fc66eb32398d046eac0d19a30812ca862dc8d6 /gdb/hppa-tdep.c
parente1591da4fd88fe7ce7af4f6eb9a597a4abdaf76a (diff)
downloadgdb-fe46cd3ab5b2a04cb88f5f34a2d692dc856b3a5a.zip
gdb-fe46cd3ab5b2a04cb88f5f34a2d692dc856b3a5a.tar.gz
gdb-fe46cd3ab5b2a04cb88f5f34a2d692dc856b3a5a.tar.bz2
2004-12-03 Randolph Chung <tausq@debian.org>
* gdbarch.sh (instruction_nullified): Delete. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * hppa-tdep.c (hppa_target_read_pc): Adjust pc if instruction is nullified. (hppa_unwind_pc): Likewise. (hppa_instruction_nullified): Delete. (hppa_gdbarch_init): Don't set instruction_nullified method. * infrun.c (infwait_states): Remove infwait_nullified_state. (handle_inferior_event): Remove handling of infwait_nullified_state. Remove handling of nullified instructions. testsuite/ * gdb.arch/pa-nullify.exp: New file. * gdb.arch/pa-nullify.s: New file.
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r--gdb/hppa-tdep.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 2fc5a39..312e166 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1042,6 +1042,8 @@ static CORE_ADDR
hppa_target_read_pc (ptid_t ptid)
{
int flags = read_register_pid (HPPA_FLAGS_REGNUM, ptid);
+ ULONGEST ipsw = read_register_pid (HPPA_IPSW_REGNUM, ptid);
+ CORE_ADDR pc;
/* The following test does not belong here. It is OS-specific, and belongs
in native code. */
@@ -1049,7 +1051,17 @@ hppa_target_read_pc (ptid_t ptid)
if (flags & 2)
return read_register_pid (31, ptid) & ~0x3;
- return read_register_pid (HPPA_PCOQ_HEAD_REGNUM, ptid) & ~0x3;
+ pc = read_register_pid (HPPA_PCOQ_HEAD_REGNUM, ptid) & ~0x3;
+
+ /* If the current instruction is nullified, then we are effectively
+ still executing the previous instruction. Pretend we are still
+ there. This is needed when single stepping; if the nullified instruction
+ is on a different line, we don't want gdb to think we've stepped onto
+ that line. */
+ if (ipsw & 0x00200000)
+ pc -= 4;
+
+ return pc;
}
/* Write out the PC. If currently in a syscall, then also write the new
@@ -2185,7 +2197,21 @@ hppa_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
static CORE_ADDR
hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
- return frame_unwind_register_signed (next_frame, HPPA_PCOQ_HEAD_REGNUM) & ~3;
+ ULONGEST ipsw;
+ CORE_ADDR pc;
+
+ ipsw = frame_unwind_register_signed (next_frame, HPPA_IPSW_REGNUM);
+ pc = frame_unwind_register_signed (next_frame, HPPA_PCOQ_HEAD_REGNUM) & ~3;
+
+ /* If the current instruction is nullified, then we are effectively
+ still executing the previous instruction. Pretend we are still
+ there. This is needed when single stepping; if the nullified instruction
+ is on a different line, we don't want gdb to think we've stepped onto
+ that line. */
+ if (ipsw & 0x00200000)
+ pc -= 4;
+
+ return pc;
}
/* Instead of this nasty cast, add a method pvoid() that prints out a
@@ -2291,22 +2317,6 @@ hppa_pc_requires_run_before_use (CORE_ADDR pc)
return (!target_has_stack && (pc & 0xFF000000));
}
-static int
-hppa_instruction_nullified (struct gdbarch *gdbarch, struct regcache *regcache)
-{
- ULONGEST tmp, ipsw, flags;
-
- regcache_cooked_read (regcache, HPPA_IPSW_REGNUM, &tmp);
- ipsw = extract_unsigned_integer (&tmp,
- register_size (gdbarch, HPPA_IPSW_REGNUM));
-
- regcache_cooked_read (regcache, HPPA_FLAGS_REGNUM, &tmp);
- flags = extract_unsigned_integer (&tmp,
- register_size (gdbarch, HPPA_FLAGS_REGNUM));
-
- return ((ipsw & 0x00200000) && !(flags & 0x2));
-}
-
/* Return the GDB type object for the "standard" data type of data
in register N. */
@@ -2573,7 +2583,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_breakpoint_from_pc (gdbarch, hppa_breakpoint_from_pc);
set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
- set_gdbarch_instruction_nullified (gdbarch, hppa_instruction_nullified);
/* Frame unwind methods. */
set_gdbarch_unwind_dummy_id (gdbarch, hppa_unwind_dummy_id);