This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] "single step" atomic instruction sequences as a whole.
Hello Ulrich,
Thank you for your suggestion.
From: Ulrich Weigand <uweigand at de.ibm.com>
Subject: Re: [patch] "single step" atomic instruction sequences as a whole.
Date: Thu, 08 Mar 2007 17:15:42 +0100 (CET)
> Emi Suzuki wrote:
> > I have added a new file, tm-rs6000aix.h, to undef SOFTWARE_SINGLE_STEP_P
> > for only that target, but felt somewhat strange about the solution.
> > I feel like adding some trick for SOFTWARE_SINGLE_STEP_P to gdbarch.c
> > rather than undef'ing it, but no idea has come to mind for now.
>
> We're trying to get rid of the tm.h files, and do everything strictly
> via the gdbarch callbacks. (This is also necessary for multi-arch
> debugging.) I'd much prefer a solution that does not add new tm.h
> files (or contents).
Yes, that's exactly what I really intend, do everything via the
gdbarch callbacks.
> Why don't we extend the gdbarch_software_single_step call with a return
> value? Common code would call the gdbarch routine, but if it returns
> a nonzero value, it will fall back to using hardware single step after
> all.
It's like what the original patchset does for this issue (provided
http://sourceware.org/ml/gdb-patches/2006-06/msg00339.html and
http://sourceware.org/ml/gdb-patches/2006-06/msg00341.html).
I have felt something uncomfortable to them, because it uses
SOFTWARE_SINGLE_STEP_P to check both if the target will do software
single stepping at the next time it proceed and if the target has done
software single stepping after it get stopped.
But now I have noticed that calling gdbarch_software_single_step
*instead of* SOFTWARE_SINGLE_STEP_P will clear my confusion and avoid
adding new tm.h files. I've changed the whole solution like below:
* make gdbarch_software_single_step return 1 (means non-zero) if it
inserted software single step breakpoint, or return 0.
* defined default_software_single_step in arch-utils.c, and make it
the default of gdbarch_software_single_step.
* call SOFTWARE_SINGLE_STEP instead of SOFTWARE_SINGLE_STEP_P, to
check if software single stepping will be done when proceeding.
* put an alternative way to check if software single stepping was
done when stopped (mainly, it would be checking of
singlestep_breakpoint_inserted_p).
One thing I am not sure about my change is adjust_pc_after_break in
infrun.c. And I am not familier with the use of gdbarch.sh, it is
much appreciated if anyone would review them.
--
Emi SUZUKI
Index: gdb/infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.223
diff -u -r1.223 infrun.c
--- gdb/infrun.c 9 Mar 2007 16:20:42 -0000 1.223
+++ gdb/infrun.c 13 Mar 2007 05:37:27 -0000
@@ -552,15 +552,18 @@
if (breakpoint_here_p (read_pc ()) == permanent_breakpoint_here)
SKIP_PERMANENT_BREAKPOINT ();
- if (SOFTWARE_SINGLE_STEP_P () && step)
+ if (step)
{
- /* Do it the hard way, w/temp breakpoints */
- SOFTWARE_SINGLE_STEP (sig, 1 /*insert-breakpoints */ );
- /* ...and don't ask hardware to do it. */
- step = 0;
- /* and do not pull these breakpoints until after a `wait' in
- `wait_for_inferior' */
- singlestep_breakpoints_inserted_p = 1;
+ /* Try to do it the hard way, w/temp breakpoints */
+ if (SOFTWARE_SINGLE_STEP (sig, 1 /* insert-breakpoints */))
+ {
+ /* Succeeded, so don't ask hardware to do it. */
+ step = 0;
+ /* and do not pull these breakpoints until after a `wait' in
+ `wait_for_inferior' */
+ singlestep_breakpoints_inserted_p = 1;
+ }
+
singlestep_ptid = inferior_ptid;
singlestep_pc = read_pc ();
}
@@ -1196,22 +1199,18 @@
breakpoint would be. */
breakpoint_pc = read_pc_pid (ecs->ptid) - DECR_PC_AFTER_BREAK;
- if (SOFTWARE_SINGLE_STEP_P ())
+ if (singlestep_breakpoints_inserted_p)
{
/* When using software single-step, a SIGTRAP can only indicate
an inserted breakpoint. This actually makes things
easier. */
- if (singlestep_breakpoints_inserted_p)
- /* When software single stepping, the instruction at [prev_pc]
- is never a breakpoint, but the instruction following
- [prev_pc] (in program execution order) always is. Assume
- that following instruction was reached and hence a software
- breakpoint was hit. */
- write_pc_pid (breakpoint_pc, ecs->ptid);
- else if (software_breakpoint_inserted_here_p (breakpoint_pc))
- /* The inferior was free running (i.e., no single-step
- breakpoints inserted) and it hit a software breakpoint. */
- write_pc_pid (breakpoint_pc, ecs->ptid);
+
+ /* When software single stepping, the instruction at [prev_pc]
+ is never a breakpoint, but the instruction following
+ [prev_pc] (in program execution order) always is. Assume
+ that following instruction was reached and hence a software
+ breakpoint was hit. */
+ write_pc_pid (breakpoint_pc, ecs->ptid);
}
else
{
@@ -1405,7 +1404,7 @@
target_mourn_inferior ();
print_stop_reason (SIGNAL_EXITED, stop_signal);
- singlestep_breakpoints_inserted_p = 0; /*SOFTWARE_SINGLE_STEP_P() */
+ singlestep_breakpoints_inserted_p = 0; /* SOFTWARE_SINGLE_STEP() */
stop_stepping (ecs);
return;
@@ -1561,8 +1560,6 @@
if (stepping_past_singlestep_breakpoint)
{
- gdb_assert (SOFTWARE_SINGLE_STEP_P ()
- && singlestep_breakpoints_inserted_p);
gdb_assert (ptid_equal (singlestep_ptid, ecs->ptid));
gdb_assert (!ptid_equal (singlestep_ptid, saved_singlestep_ptid));
@@ -1575,9 +1572,13 @@
{
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: stepping_past_singlestep_breakpoint\n");
- /* Pull the single step breakpoints out of the target. */
- SOFTWARE_SINGLE_STEP (0, 0);
- singlestep_breakpoints_inserted_p = 0;
+
+ if (singlestep_breakpoints_inserted_p)
+ {
+ /* Pull the single step breakpoints out of the target. */
+ SOFTWARE_SINGLE_STEP (0, 0);
+ singlestep_breakpoints_inserted_p = 0;
+ }
ecs->random_signal = 0;
@@ -1611,7 +1612,7 @@
if (!breakpoint_thread_match (stop_pc, ecs->ptid))
thread_hop_needed = 1;
}
- else if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
+ else if (singlestep_breakpoints_inserted_p)
{
/* We have not context switched yet, so this should be true
no matter which thread hit the singlestep breakpoint. */
@@ -1682,7 +1683,7 @@
/* Saw a breakpoint, but it was hit by the wrong thread.
Just continue. */
- if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
+ if (singlestep_breakpoints_inserted_p)
{
/* Pull the single step breakpoints out of the target. */
SOFTWARE_SINGLE_STEP (0, 0);
@@ -1731,7 +1732,7 @@
return;
}
}
- else if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
+ else if (singlestep_breakpoints_inserted_p)
{
sw_single_step_trap_p = 1;
ecs->random_signal = 0;
@@ -1753,7 +1754,7 @@
deprecated_context_hook (pid_to_thread_id (ecs->ptid));
}
- if (SOFTWARE_SINGLE_STEP_P () && singlestep_breakpoints_inserted_p)
+ if (singlestep_breakpoints_inserted_p)
{
/* Pull the single step breakpoints out of the target. */
SOFTWARE_SINGLE_STEP (0, 0);
Index: gdb/cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.138
diff -u -r1.138 cris-tdep.c
--- gdb/cris-tdep.c 27 Feb 2007 20:17:18 -0000 1.138
+++ gdb/cris-tdep.c 13 Mar 2007 05:36:05 -0000
@@ -2119,7 +2119,7 @@
digs through the opcodes in order to find all possible targets.
Either one ordinary target or two targets for branches may be found. */
-static void
+static int
cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
{
inst_env_type inst_env;
@@ -2152,6 +2152,8 @@
}
else
remove_single_step_breakpoints ();
+
+ return 1;
}
/* Calculates the prefix value for quick offset addressing mode. */
Index: gdb/rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.265
diff -u -r1.265 rs6000-tdep.c
--- gdb/rs6000-tdep.c 27 Feb 2007 23:04:28 -0000 1.265
+++ gdb/rs6000-tdep.c 13 Mar 2007 05:38:22 -0000
@@ -696,10 +696,101 @@
return little_breakpoint;
}
+#define LWARX_MASK 0xfc0007fe
+#define LWARX_INSTRUCTION 0x7C000028
+#define LDARX_INSTRUCTION 0x7C000108
+#define STWCX_MASK 0xfc0007ff
+#define STWCX_INSTRUCTION 0x7c00012d
+#define STDCX_INSTRUCTION 0x7c0001ad
+#define BC_MASK 0xfc000000
+#define BC_INSTRUCTION 0x40000000
+
+int
+rs6000_deal_with_atomic_sequence (enum target_signal signal,
+ int insert_breakpoints_p)
+{
+ CORE_ADDR loc, pc;
+ int i, insn;
+ CORE_ADDR breaks[2] = { -1, -1 };
+
+ if (insert_breakpoints_p)
+ {
+ pc = read_pc ();
+ loc = pc;
+ insn = read_memory_integer (loc, PPC_INSN_SIZE);
+
+ /* Assume all atomic sequences start with an lwarx instruction. */
+ if ((insn & LWARX_MASK) != LWARX_INSTRUCTION
+ && (insn & LWARX_MASK) != LDARX_INSTRUCTION)
+ return 0;
+
+ /* Assume that no atomic sequence is longer than 6 instructions. */
+ for (i= 1; i < 5; ++i)
+ {
+ loc += PPC_INSN_SIZE;
+ insn = read_memory_integer (loc, PPC_INSN_SIZE);
+
+ /* At most one conditional branch instruction is between the lwarx
+ and stwcx. instructions. */
+ if ((insn & BC_MASK) == BC_INSTRUCTION)
+ {
+ int opcode = BC_INSTRUCTION >> 26;
+ breaks[1] = branch_dest (opcode, insn, loc, -1);
+ continue;
+ }
+
+ if ((insn & STWCX_MASK) == STWCX_INSTRUCTION
+ || (insn & STWCX_MASK) == STDCX_INSTRUCTION)
+ break;
+ }
+
+ /* Assume that the atomic sequence ends with a stwcx instruction
+ followed by a conditional branch instruction. */
+ if ((insn & STWCX_MASK) != STWCX_INSTRUCTION
+ && (insn & STWCX_MASK) != STDCX_INSTRUCTION)
+ {
+ warning (_("Tried to step over an atomic sequence of instructions from %s but could not find the end of the sequence."), core_addr_to_string (pc));
+ return 0;
+ }
+
+ loc += PPC_INSN_SIZE;
+ insn = read_memory_integer (loc, PPC_INSN_SIZE);
+
+ if ((insn & BC_MASK) != BC_INSTRUCTION)
+ {
+ warning (_("Tried to step over an atomic sequence of instructions from %s but it did not end as expected."), core_addr_to_string (pc));
+ return 0;
+ }
+
+ breaks[0] = loc;
+ printf_unfiltered (_("Stepping over an atomic sequence of instructions. \n\
+Beginning at %s, break at %s next time.\n"),
+ core_addr_to_string (pc),
+ core_addr_to_string (breaks[0]));
+
+ /* It cannot be happened, but just check it */
+ if (breaks[1] == loc)
+ breaks[1] = -1;
+
+ for (i = 0; i < 2; ++i)
+ {
+ /* ignore invalid breakpoint. */
+ if (breaks[i] == -1)
+ continue;
+
+ insert_single_step_breakpoint (breaks[i]);
+ }
+ }
+ else
+ remove_single_step_breakpoints ();
+
+ /* software single step breakpoint is inserted or removed */
+ return 1;
+}
/* AIX does not support PT_STEP. Simulate it. */
-void
+int
rs6000_software_single_step (enum target_signal signal,
int insert_breakpoints_p)
{
@@ -711,6 +802,10 @@
CORE_ADDR breaks[2];
int opcode;
+ /* check if running through the atomic sequence of instructions first. */
+ if (rs6000_deal_with_atomic_sequence (signal, insert_breakpoints_p))
+ return 1;
+
if (insert_breakpoints_p)
{
loc = read_pc ();
@@ -738,6 +833,8 @@
errno = 0; /* FIXME, don't ignore errors! */
/* What errors? {read,write}_memory call error(). */
+
+ return 1;
}
@@ -3442,6 +3539,7 @@
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_breakpoint_from_pc (gdbarch, rs6000_breakpoint_from_pc);
+ set_gdbarch_software_single_step (gdbarch, rs6000_deal_with_atomic_sequence);
/* Handle the 64-bit SVR4 minimal-symbol convention of using "FN"
for the descriptor and ".FN" for the entry-point -- a user
Index: gdb/mips-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.h,v
retrieving revision 1.19
diff -u -r1.19 mips-tdep.h
--- gdb/mips-tdep.h 9 Jan 2007 17:58:52 -0000 1.19
+++ gdb/mips-tdep.h 13 Mar 2007 05:38:01 -0000
@@ -103,7 +103,7 @@
};
/* Single step based on where the current instruction will take us. */
-extern void mips_software_single_step (enum target_signal, int);
+extern int mips_software_single_step (enum target_signal, int);
/* Tell if the program counter value in MEMADDR is in a MIPS16
function. */
Index: gdb/spu-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/spu-tdep.c,v
retrieving revision 1.10
diff -u -r1.10 spu-tdep.c
--- gdb/spu-tdep.c 9 Mar 2007 03:51:04 -0000 1.10
+++ gdb/spu-tdep.c 13 Mar 2007 05:38:39 -0000
@@ -1078,7 +1078,7 @@
/* Software single-stepping support. */
-void
+int
spu_software_single_step (enum target_signal signal, int insert_breakpoints_p)
{
if (insert_breakpoints_p)
@@ -1093,7 +1093,7 @@
pc = extract_unsigned_integer (buf, 4) & -4;
if (target_read_memory (pc, buf, 4))
- return;
+ return 0;
insn = extract_unsigned_integer (buf, 4);
/* Next sequential instruction is at PC + 4, except if the current
@@ -1125,6 +1125,8 @@
}
else
remove_single_step_breakpoints ();
+
+ return 1;
}
Index: gdb/sparc64-sol2-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-sol2-tdep.c,v
retrieving revision 1.11
diff -u -r1.11 sparc64-sol2-tdep.c
--- gdb/sparc64-sol2-tdep.c 9 Jan 2007 17:58:58 -0000 1.11
+++ gdb/sparc64-sol2-tdep.c 13 Mar 2007 05:38:33 -0000
@@ -170,7 +170,7 @@
tdep->plt_entry_size = 16;
/* Solaris has kernel-assisted single-stepping support. */
- set_gdbarch_software_single_step (gdbarch, NULL);
+ set_gdbarch_software_single_step (gdbarch, default_software_single_step);
}
Index: gdb/sparc-sol2-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-sol2-tdep.c,v
retrieving revision 1.12
diff -u -r1.12 sparc-sol2-tdep.c
--- gdb/sparc-sol2-tdep.c 9 Jan 2007 17:58:58 -0000 1.12
+++ gdb/sparc-sol2-tdep.c 13 Mar 2007 05:38:24 -0000
@@ -188,7 +188,7 @@
tdep->plt_entry_size = 12;
/* Solaris has kernel-assisted single-stepping support. */
- set_gdbarch_software_single_step (gdbarch, NULL);
+ set_gdbarch_software_single_step (gdbarch, default_software_single_step);
frame_unwind_append_sniffer (gdbarch, sparc32_sol2_sigtramp_frame_sniffer);
}
Index: gdb/arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.143
diff -u -r1.143 arch-utils.c
--- gdb/arch-utils.c 26 Feb 2007 20:13:18 -0000 1.143
+++ gdb/arch-utils.c 13 Mar 2007 05:35:28 -0000
@@ -270,6 +270,13 @@
return regno;
}
+int
+default_software_single_step (enum target_signal sig,
+ int insert_breakpoints_p)
+{
+ return 0;
+}
+
/* Functions to manipulate the endianness of the target. */
Index: gdb/arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.86
diff -u -r1.86 arch-utils.h
--- gdb/arch-utils.h 26 Feb 2007 20:13:18 -0000 1.86
+++ gdb/arch-utils.h 13 Mar 2007 05:35:28 -0000
@@ -112,6 +112,9 @@
int default_remote_register_number (struct gdbarch *gdbarch,
int regno);
+extern int default_software_single_step (enum target_signal sig,
+ int insert_breakpoints_p);
+
/* For compatibility with older architectures, returns
(LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid
name. */
Index: gdb/gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.294
diff -u -r1.294 gdbarch.h
--- gdb/gdbarch.h 8 Feb 2007 21:00:29 -0000 1.294
+++ gdb/gdbarch.h 13 Mar 2007 05:36:46 -0000
@@ -1153,23 +1153,8 @@
FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can
single step. If not, then implement single step using breakpoints. */
-#if defined (SOFTWARE_SINGLE_STEP)
-/* Legacy for systems yet to multi-arch SOFTWARE_SINGLE_STEP */
-#if !defined (SOFTWARE_SINGLE_STEP_P)
-#define SOFTWARE_SINGLE_STEP_P() (1)
-#endif
-#endif
-
-extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch);
-#if !defined (GDB_TM_FILE) && defined (SOFTWARE_SINGLE_STEP_P)
-#error "Non multi-arch definition of SOFTWARE_SINGLE_STEP"
-#endif
-#if !defined (SOFTWARE_SINGLE_STEP_P)
-#define SOFTWARE_SINGLE_STEP_P() (gdbarch_software_single_step_p (current_gdbarch))
-#endif
-
-typedef void (gdbarch_software_single_step_ftype) (enum target_signal sig, int insert_breakpoints_p);
-extern void gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p);
+typedef int (gdbarch_software_single_step_ftype) (enum target_signal sig, int insert_breakpoints_p);
+extern int gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p);
extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step);
#if !defined (GDB_TM_FILE) && defined (SOFTWARE_SINGLE_STEP)
#error "Non multi-arch definition of SOFTWARE_SINGLE_STEP"
Index: gdb/arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.224
diff -u -r1.224 arm-tdep.c
--- gdb/arm-tdep.c 27 Feb 2007 20:17:18 -0000 1.224
+++ gdb/arm-tdep.c 13 Mar 2007 05:35:44 -0000
@@ -1907,7 +1907,7 @@
single_step() is also called just after the inferior stops. If we
had set up a simulated single-step, we undo our damage. */
-static void
+static int
arm_software_single_step (enum target_signal sig, int insert_bpt)
{
/* NOTE: This may insert the wrong breakpoint instruction when
@@ -1922,6 +1922,8 @@
}
else
remove_single_step_breakpoints ();
+
+ return 1;
}
#include "bfd-in2.h"
Index: gdb/mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.405
diff -u -r1.405 mips-tdep.c
--- gdb/mips-tdep.c 7 Mar 2007 21:32:47 -0000 1.405
+++ gdb/mips-tdep.c 13 Mar 2007 05:38:00 -0000
@@ -2218,6 +2218,8 @@
}
else
remove_single_step_breakpoints ();
+
+ return 1;
}
/* Test whether the PC points to the return instruction at the
Index: gdb/gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.376
diff -u -r1.376 gdbarch.sh
--- gdb/gdbarch.sh 28 Feb 2007 17:35:00 -0000 1.376
+++ gdb/gdbarch.sh 13 Mar 2007 05:37:00 -0000
@@ -622,7 +622,7 @@
#
# FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can
# single step. If not, then implement single step using breakpoints.
-F:=:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p
+f:=:int:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::default_software_single_step::0
# Return non-zero if the processor is executing a delay slot and a
# further single-step is needed before the instruction finishes.
M::int:single_step_through_delay:struct frame_info *frame:frame
Index: gdb/gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.338
diff -u -r1.338 gdbarch.c
--- gdb/gdbarch.c 28 Feb 2007 17:34:58 -0000 1.338
+++ gdb/gdbarch.c 13 Mar 2007 05:36:32 -0000
@@ -447,6 +447,7 @@
current_gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
current_gdbarch->addr_bits_remove = core_addr_identity;
current_gdbarch->smash_text_address = core_addr_identity;
+ current_gdbarch->software_single_step = default_software_single_step;
current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
current_gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
@@ -600,7 +601,7 @@
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
/* Skip verify of addr_bits_remove, invalid_p == 0 */
/* Skip verify of smash_text_address, invalid_p == 0 */
- /* Skip verify of software_single_step, has predicate */
+ /* Skip verify of software_single_step, invalid_p == 0 */
/* Skip verify of single_step_through_delay, has predicate */
if (current_gdbarch->print_insn == 0)
fprintf_unfiltered (log, "\n\tprint_insn");
@@ -1510,15 +1511,6 @@
fprintf_unfiltered (file,
"gdbarch_dump: smash_text_address = <0x%lx>\n",
(long) current_gdbarch->smash_text_address);
-#ifdef SOFTWARE_SINGLE_STEP_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "SOFTWARE_SINGLE_STEP_P()",
- XSTRING (SOFTWARE_SINGLE_STEP_P ()));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
- gdbarch_software_single_step_p (current_gdbarch));
#ifdef SOFTWARE_SINGLE_STEP
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -3283,20 +3275,13 @@
}
int
-gdbarch_software_single_step_p (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- return gdbarch->software_single_step != NULL;
-}
-
-void
gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->software_single_step != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
- gdbarch->software_single_step (sig, insert_breakpoints_p);
+ return gdbarch->software_single_step (sig, insert_breakpoints_p);
}
void
Index: gdb/sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.178
diff -u -r1.178 sparc-tdep.c
--- gdb/sparc-tdep.c 27 Feb 2007 20:17:19 -0000 1.178
+++ gdb/sparc-tdep.c 13 Mar 2007 05:38:33 -0000
@@ -1176,7 +1176,7 @@
return 0;
}
-void
+int
sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p)
{
struct gdbarch *arch = current_gdbarch;
@@ -1206,6 +1206,8 @@
}
else
remove_single_step_breakpoints ();
+
+ return 1;
}
static void
Index: gdb/alpha-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.h,v
retrieving revision 1.27
diff -u -r1.27 alpha-tdep.h
--- gdb/alpha-tdep.h 9 Jan 2007 17:58:49 -0000 1.27
+++ gdb/alpha-tdep.h 13 Mar 2007 05:35:23 -0000
@@ -107,7 +107,7 @@
};
extern unsigned int alpha_read_insn (CORE_ADDR pc);
-extern void alpha_software_single_step (enum target_signal, int);
+extern int alpha_software_single_step (enum target_signal, int);
extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc);
extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *);
Index: gdb/rs6000-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.h,v
retrieving revision 1.3
diff -u -r1.3 rs6000-tdep.h
--- gdb/rs6000-tdep.h 27 Feb 2007 23:04:28 -0000 1.3
+++ gdb/rs6000-tdep.h 13 Mar 2007 05:38:22 -0000
@@ -21,7 +21,7 @@
#include "defs.h"
-extern void rs6000_software_single_step (enum target_signal signal,
+extern int rs6000_software_single_step (enum target_signal signal,
int insert_breakpoints_p);
/* Hook in rs6000-tdep.c for determining the TOC address when
Index: gdb/alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.162
diff -u -r1.162 alpha-tdep.c
--- gdb/alpha-tdep.c 27 Feb 2007 20:17:18 -0000 1.162
+++ gdb/alpha-tdep.c 13 Mar 2007 05:35:22 -0000
@@ -1518,7 +1518,7 @@
return (pc + ALPHA_INSN_SIZE);
}
-void
+int
alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p)
{
static CORE_ADDR next_pc;
@@ -1536,6 +1536,8 @@
remove_single_step_breakpoints ();
write_pc (next_pc);
}
+
+ return 1;
}