+Fri Nov 27 11:00:25 1998 Andrew Cagney <cagney@chook>
+
+ * target.h (one_stepped): Move global from here.
+ * infrun.c (singlestep_breakpoints_inserted_p): To here. Rename.
+ Make static.
+ (wait_for_inferior): Update.
+ (resume): Update. Set variable after call to SOFTWARE_SINGLE_STEP.
+
+ * target.h (NO_SINGLE_STEP): Replace with SOFTWARE_SINGLE_STEP_P
+ and SOFTWARE_SINGLE_STEP.
+ * config/sparc/tm-sparc.h, config/rs6000/tm-rs6000.h,
+ config/arc/tm-arc.h: Update.
+ * rs6000-tdep.c (rs6000_software_single_step), sparc-tdep.c
+ (sparc_software_single_step), arc-tdep.c (arc_single_step): New
+ functions. Replace function single_step.
+
+ * config/mips/tm-mips.h (STEP_SKIPS_DELAY_P): Define.
+ * infrun.c (proceed): Cleanup.
+start-sanitize-sky
+ * config/mips/tm-txvu.h (STEP_SKIPS_DELAY), txvu-tdep.c
+ (txvu_step_skips_delay): Change macro to function.
+end-sanitize-sky
+
Thu Nov 26 11:19:15 1998 Andrew Cagney <cagney@amy.cygnus.com>
* config/alpha/tm-alpha.h (ABOUT_TO_RETURN): Replace macro.
}
}
-/* Non-zero if we just simulated a single-step. This is needed because we
- cannot remove the breakpoints in the inferior process until after the
- `wait' in `wait_for_inferior'. */
-
-int one_stepped;
-
/* 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 all the possible targets of the coming instruction and
set up a simulated single-step, we undo our damage. */
void
-single_step (ignore)
- enum target_signal ignore; /* sig, but we don't need it */
+arc_software_single_step (ignore, insert_breakpoints_p)
+ enum target_signal ignore; /* sig but we don't need it */
+ int insert_breakpoints_p;
{
static CORE_ADDR next_pc, target;
static int brktrg_p;
typedef char binsn_quantum[BREAKPOINT_MAX];
static binsn_quantum break_mem[2];
- if (!one_stepped)
+ if (insert_breakpoints_p)
{
insn_type type;
CORE_ADDR pc;
target_insert_breakpoint (target, break_mem[1]);
}
- /* We are ready to let it go. */
- one_stepped = 1;
}
else
{
/* Fix the pc. */
stop_pc -= DECR_PC_AFTER_BREAK;
write_pc (stop_pc);
-
- one_stepped = 0;
}
}
\f
#if 0
-@item NO_SINGLE_STEP
-Define this if the target does not support single-stepping. If this is
-defined, you must supply, in @code{*-tdep.c}, the function
-@code{single_step}, which takes a target_signal as argument and returns
-nothing. It must insert breakpoints at each possible destinations of
-the next instruction. See @code{sparc-tdep.c} and @code{rs6000-tdep.c}
-for examples.
-#endif
-int one_stepped;
-void single_step (enum target_signal signal) { return; }
-/* #define NO_SINGLE_STEP */
-
+@item SOFTWARE_SINGLE_STEP_P
+@ttem SOFTWARE_SINGLE_STEP
+#endif
+int carp_software_single_step_p;
+void carp_software_single_step (int signal, int bp_p) { return; }
#if 0
@item NUM_REGS
/* We don't have a reliable single step facility.
??? We do have a cycle single step facility, but that won't work. */
-#define NO_SINGLE_STEP
+#define SOFTWARE_SINGLE_STEP_P 1
+extern void arc_software_single_step PARAMS ((unsigned int, int));
+#define SOFTWARE_SINGLE_STEP(sig,bp_p) arc_software_single_step (sig, bp_p)
/* FIXME: Need to set STEP_SKIPS_DELAY. */
/* Return non-zero if PC points to an instruction which will cause a step
to execute both the instruction at PC and an instruction at PC+4. */
-#define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc))
extern int mips_step_skips_delay PARAMS ((CORE_ADDR));
+#define STEP_SKIPS_DELAY_P (1)
+#define STEP_SKIPS_DELAY(pc) (mips_step_skips_delay (pc))
/* Immediately after a function call, return the saved pc.
Can't always go through the frames for this because on some machines
/* RS6000/AIX does not support PT_STEP. Has to be simulated. */
-#define NO_SINGLE_STEP
+#define SOFTWARE_SINGLE_STEP_P 1
+extern void rs6000_software_single_step PARAMS ((unsigned int, int));
+#define SOFTWARE_SINGLE_STEP(sig,bp_p) rs6000_software_single_step (sig, bp_p)
/* If the current gcc for for this target does not produce correct debugging
information for float parameters, both prototyped and unprototyped, then
\f
/* Sparc has no reliable single step ptrace call */
-#define NO_SINGLE_STEP 1
+#define SOFTWARE_SINGLE_STEP_P 1
+extern void sparc_software_single_step PARAMS ((unsigned int, int));
+#define SOFTWARE_SINGLE_STEP(sig,bp_p) sparc_software_single_step (sig,bp_p)
/* We need more arguments in a frame specification for the
"frame" or "info frame" command. */
+Fri Nov 27 12:39:45 1998 Andrew Cagney <cagney@chook>
+
+ * gdbint.texinfo (NO_SINGLE_STEP): Replace with
+ SOFTWARE_SINGLE_STEP_P and SOFTWARE_SINGLE_STEP.
+
Wed Oct 14 10:02:40 1998 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo: Fix minor typos.
@item NO_HIF_SUPPORT
(Specific to the a29k.)
-@item NO_SINGLE_STEP
-Define this if the target does not support single-stepping. If this is
-defined, you must supply, in @code{*-tdep.c}, the function
-@code{single_step}, which takes a target_signal as argument and returns
-nothing. It must insert breakpoints at each possible destinations of
-the next instruction. See @code{sparc-tdep.c} and @code{rs6000-tdep.c}
+@item SOFTWARE_SINGLE_STEP_P
+Define this as 1 if the target does not have a hardware single-step
+mechanism. The macro @code{SOFTWARE_SINGLE_STEP} must also be defined.
+
+@item SOFTWARE_SINGLE_STEP(signal,insert_breapoints_p)
+A function that inserts or removes (dependant on
+@var{insert_breapoints_p}) breakpoints at each possible destinations of
+the next instruction. See @code{sparc-tdep.c} and @code{rs6000-tdep.c}
for examples.
@item PCC_SOL_BROKEN
hard to get at place; for example, part in a segment register and part
in an ordinary register.
+@item TARGET_VIRTUAL_FRAME_POINTER(pc,regp,offsetp)
+Returns a @code{(register, offset)} pair representing the virtual
+frame pointer in use at the code address @code{"pc"}. If virtual
+frame pointers are not used, a default definition simply returns
+@code{FP_REGNUM}, with an offset of zero.
+
@item USE_STRUCT_CONVENTION (gcc_p, type)
If defined, this must be an expression that is nonzero if a value of the
given @var{type} being returned from a function must have space
/* Target-struct-independent code to start (run) and stop an inferior process.
- Copyright 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998 Free Software Foundation, Inc.
+ Copyright 1986, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 1998
+ Free Software Foundation, Inc.
This file is part of GDB.
static void delete_breakpoint_current_contents PARAMS ((PTR));
+void _initialize_infrun PARAMS ((void));
+
/* GET_LONGJMP_TARGET returns the PC at which longjmp() will resume the
program. It needs to examine the jmp_buf argument and extract the PC
from it. The return value is non-zero on success, zero otherwise. */
static int stop_print_frame;
+/* Non-zero if we just simulating a single-step. This is needed
+ because we cannot remove the breakpoints in the inferior process
+ until after the `wait' in `wait_for_inferior'. */
+static int singlestep_breakpoints_inserted_p = 0;
+
\f
/* Things to clean up if we QUIT out of resume (). */
/* ARGSUSED */
int step;
enum target_signal sig;
{
- struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
+ struct cleanup *old_cleanups = make_cleanup ((make_cleanup_func)
+ resume_cleanups, 0);
QUIT;
#ifdef CANNOT_STEP_BREAKPOINT
step = 0;
#endif
-#ifdef NO_SINGLE_STEP
- if (step) {
- single_step(sig); /* Do it the hard way, w/temp breakpoints */
- step = 0; /* ...and don't ask hardware to do it. */
- }
-#endif
+ if (SOFTWARE_SINGLE_STEP_P && 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;
+ }
/* Handle any optimized stores to the inferior NOW... */
#ifdef DO_DEFERRED_STORES
if (read_pc () == stop_pc && breakpoint_here_p (read_pc ()))
oneproc = 1;
-#ifdef STEP_SKIPS_DELAY
+#ifndef STEP_SKIPS_DELAY
+#define STEP_SKIPS_DELAY(pc) (0)
+#define STEP_SKIPS_DELAY_P (0)
+#endif
/* Check breakpoint_here_p first, because breakpoint_here_p is fast
(it just checks internal GDB data structures) and STEP_SKIPS_DELAY
is slow (it needs to read memory from the target). */
- if (breakpoint_here_p (read_pc () + 4)
+ if (STEP_SKIPS_DELAY_P
+ && breakpoint_here_p (read_pc () + 4)
&& STEP_SKIPS_DELAY (read_pc ()))
oneproc = 1;
-#endif /* STEP_SKIPS_DELAY */
}
else
write_pc (addr);
/* If it's a new process, add it to the thread database */
if (w.kind != TARGET_WAITKIND_EXITED
+ && w.kind != TARGET_WAITKIND_SIGNALLED
&& pid != inferior_pid
&& !in_thread_list (pid))
{
(LONGEST) w.value.integer));
gdb_flush (gdb_stdout);
target_mourn_inferior ();
-#ifdef NO_SINGLE_STEP
- one_stepped = 0;
-#endif
+ singlestep_breakpoints_inserted_p = 0; /*SOFTWARE_SINGLE_STEP_P*/
stop_print_frame = 0;
goto stop_stepping;
printf_filtered ("The program no longer exists.\n");
gdb_flush (gdb_stdout);
-#ifdef NO_SINGLE_STEP
- one_stepped = 0;
-#endif
+ singlestep_breakpoints_inserted_p = 0; /*SOFTWARE_SINGLE_STEP_P*/
goto stop_stepping;
case TARGET_WAITKIND_STOPPED:
if (stop_signal == TARGET_SIGNAL_TRAP)
{
-#ifdef NO_SINGLE_STEP
- if (one_stepped)
+ if (SOFTWARE_SINGLE_STEP_P && singlestep_breakpoints_inserted_p)
random_signal = 0;
else
-#endif
if (breakpoints_inserted
&& breakpoint_here_p (stop_pc - DECR_PC_AFTER_BREAK))
{
&step_range_start, &step_range_end,
&step_frame_address, &handling_longjmp,
&another_trap);
+
+ if (context_hook)
+ context_hook (pid_to_thread_id (pid));
+
printf_filtered ("[Switching to %s]\n", target_pid_to_str (pid));
flush_cached_frames ();
}
-#ifdef NO_SINGLE_STEP
- if (one_stepped)
- single_step (0); /* This actually cleans up the ss */
-#endif /* NO_SINGLE_STEP */
+ if (SOFTWARE_SINGLE_STEP_P && singlestep_breakpoints_inserted_p)
+ {
+ /* Pull the single step breakpoints out of the target. */
+ SOFTWARE_SINGLE_STEP (0, 0);
+ singlestep_breakpoints_inserted_p = 0;
+ }
/* If PC is pointing at a nullified instruction, then step beyond
it so that the user won't be confused when GDB appears to be ready
if (stop_pc == stop_func_start /* Quick test */
|| in_prologue (stop_pc, stop_func_start)
|| IN_SOLIB_CALL_TRAMPOLINE (stop_pc, stop_func_name)
- || stop_func_start == 0)
+ || stop_func_name == 0)
#endif
{
{
nomem (0);
}
- old_chain = make_cleanup (freeargv, (char *) argv);
+ old_chain = make_cleanup ((make_cleanup_func) freeargv, (char *) argv);
/* Walk through the args, looking for signal oursigs, signal names, and
actions. Signal numbers and signal names may be interspersed with
extern int errno;
-/* Nonzero if we just simulated a single step break. */
-int one_stepped;
-
/* Breakpoint shadows for the single step instructions will be kept here. */
static struct sstep_breaks {
/* AIX does not support PT_STEP. Simulate it. */
void
-single_step (signal)
+rs6000_software_single_step (signal, insert_breakpoints_p)
enum target_signal signal;
+ int insert_breakpoints_p;
{
#define INSNLEN(OPCODE) 4
CORE_ADDR breaks[2];
int opcode;
- if (!one_stepped) {
+ if (insert_breakpoints_p) {
+
loc = read_pc ();
insn = read_memory_integer (loc, 4);
stepBreaks[ii].address = breaks[ii];
}
- one_stepped = 1;
} else {
/* remove step breakpoints. */
write_memory
(stepBreaks[ii].address, stepBreaks[ii].data, 4);
- one_stepped = 0;
}
errno = 0; /* FIXME, don't ignore errors! */
/* What errors? {read,write}_memory call error(). */