* mips-tdep.c (mips_software_single_step): New function.
authorDaniel Jacobowitz <drow@false.org>
Thu, 5 Jul 2001 23:30:43 +0000 (23:30 +0000)
committerDaniel Jacobowitz <drow@false.org>
Thu, 5 Jul 2001 23:30:43 +0000 (23:30 +0000)
        * config/mips/tm-mips.h: Add prototype for
        mips_software_single_step.

gdb/ChangeLog
gdb/config/mips/tm-mips.h
gdb/mips-tdep.c

index e1e5cb8c0f5f319f6674d4f372ac215fc1f038db..88fe97553364d5356bc58380fa3e9ba7b1438ad6 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-05  Daniel Jacobowitz  <drow@mvista.com>
+
+       * mips-tdep.c (mips_software_single_step): New function.
+       * config/mips/tm-mips.h: Add prototype for
+       mips_software_single_step.
+
 2001-07-05  Daniel Jacobowitz  <drow@mvista.com>
 
        * ppc-linux-nat.c (supply_gregset): Use elf_greg_t instead
index a2079509e440d81c2074b1b5e4058daefa0e3bc0..a865e96223de0bcb6b6b693d2febd01f738afcff 100644 (file)
@@ -502,3 +502,6 @@ extern void mips_set_processor_type_command (char *, int);
 /* MIPS sign extends addresses */
 #define POINTER_TO_ADDRESS(TYPE,BUF) (signed_pointer_to_address (TYPE, BUF))
 #define ADDRESS_TO_POINTER(TYPE,BUF,ADDR) (address_to_signed_pointer (TYPE, BUF, ADDR))
+
+/* Single step based on where the current instruction will take us.  */
+extern void mips_software_single_step (enum target_signal, int);
index c56d97e474a2bb8d3803848eee2ad017038ff8e8..d83c4d1c0395e50dd4ed4ff56c83f2cbe1d1c6b5 100644 (file)
@@ -1379,6 +1379,33 @@ mips_addr_bits_remove (CORE_ADDR addr)
   return addr;
 }
 
+/* mips_software_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 (MIPS on Linux for example).  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
+mips_software_single_step (enum target_signal sig, int insert_breakpoints_p)
+{
+  static CORE_ADDR next_pc;
+  typedef char binsn_quantum[BREAKPOINT_MAX];
+  static binsn_quantum break_mem;
+  CORE_ADDR pc;
+
+  if (insert_breakpoints_p)
+    {
+      pc = read_register (PC_REGNUM);
+      next_pc = mips_next_pc (pc);
+
+      target_insert_breakpoint (next_pc, break_mem);
+    }
+  else
+    target_remove_breakpoint (next_pc, break_mem);
+}
+
 static void
 mips_init_frame_pc_first (int fromleaf, struct frame_info *prev)
 {
This page took 0.031568 seconds and 4 git commands to generate.