aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-tdep.c
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2001-12-17 17:03:58 +0000
committerFernando Nasser <fnasser@redhat.com>2001-12-17 17:03:58 +0000
commit9512d7fdf54f8cb550c2b35b9605e02bd7976d8a (patch)
tree1a2e9cf056b349a311dccad9b2d3f32ac0b2db50 /gdb/arm-tdep.c
parentc5c586eddbacd46011dc1135dcd093652c804d82 (diff)
downloadfsf-binutils-gdb-9512d7fdf54f8cb550c2b35b9605e02bd7976d8a.zip
fsf-binutils-gdb-9512d7fdf54f8cb550c2b35b9605e02bd7976d8a.tar.gz
fsf-binutils-gdb-9512d7fdf54f8cb550c2b35b9605e02bd7976d8a.tar.bz2
2001-12-17 Fernando Nasser <fnasser@redhat.com>
From Richard Earnshaw <rearnsha@arm.com>: * arm-tdep.c (arm_software_single_step): New function. Implements software single-stepping for ARM targets. (arm_get_next_pc, thumb_get_next_pc, bitcount, shifted_reg_val): Only needed for software single-stepping. * config/arm/tm-arm.h: Activate SOFTWARE_SINGLE_STEP_P.
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r--gdb/arm-tdep.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index afcc7f0..bec9c80 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1532,6 +1532,8 @@ condition_true (unsigned long cond, unsigned long status_reg)
return 1;
}
+#if SOFTWARE_SINGLE_STEP_P
+/* Support routines for single stepping. Calculate the next PC value. */
#define submask(x) ((1L << ((x) + 1)) - 1)
#define bit(obj,st) (((obj) >> (st)) & 1)
#define bits(obj,st,fn) (((obj) >> (st)) & submask ((fn) - (st)))
@@ -1866,6 +1868,32 @@ arm_get_next_pc (CORE_ADDR pc)
return nextpc;
}
+/* single_step() is called just before we want to resume the inferior,
+ if we want to single-step it but there is no hardware or kernel
+ single-step support. We find the target of the coming instruction
+ and breakpoint it.
+
+ single_step is also called just after the inferior stops. If we had
+ set up a simulated single-step, we undo our damage. */
+
+void
+arm_software_single_step (ignore, insert_bpt)
+ int ignore; /* Signal, not needed */
+ int insert_bpt;
+{
+ static int next_pc; /* State between setting and unsetting. */
+ static char break_mem[BREAKPOINT_MAX]; /* Temporary storage for mem@bpt */
+
+ if (insert_bpt)
+ {
+ next_pc = arm_get_next_pc (read_register (PC_REGNUM));
+ target_insert_breakpoint (next_pc, &break_mem);
+ }
+ else
+ target_remove_breakpoint (next_pc, &break_mem);
+}
+#endif /* SOFTWARE_SINGLE_STEP_P */
+
#include "bfd-in2.h"
#include "libcoff.h"