diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 23 | ||||
-rw-r--r-- | gdb/arc-tdep.c | 17 | ||||
-rw-r--r-- | gdb/carp-tdep.c | 17 | ||||
-rw-r--r-- | gdb/config/arc/tm-arc.h | 4 | ||||
-rw-r--r-- | gdb/config/mips/tm-mips.h | 3 | ||||
-rw-r--r-- | gdb/config/rs6000/tm-rs6000.h | 4 | ||||
-rw-r--r-- | gdb/config/sparc/tm-sparc.h | 4 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 20 | ||||
-rw-r--r-- | gdb/infrun.c | 70 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 11 |
11 files changed, 109 insertions, 69 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 82f0a23..3ff3f85 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +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. diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index 977135f..9295770 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -508,12 +508,6 @@ get_insn_type (insn, pc, target) } } -/* 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 @@ -523,15 +517,16 @@ int one_stepped; 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; @@ -558,8 +553,6 @@ single_step (ignore) target_insert_breakpoint (target, break_mem[1]); } - /* We are ready to let it go. */ - one_stepped = 1; } else { @@ -572,8 +565,6 @@ single_step (ignore) /* Fix the pc. */ stop_pc -= DECR_PC_AFTER_BREAK; write_pc (stop_pc); - - one_stepped = 0; } } diff --git a/gdb/carp-tdep.c b/gdb/carp-tdep.c index 464aa50..9d7392d 100644 --- a/gdb/carp-tdep.c +++ b/gdb/carp-tdep.c @@ -599,18 +599,11 @@ int carp_need_text_start_end; #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 diff --git a/gdb/config/arc/tm-arc.h b/gdb/config/arc/tm-arc.h index aebdc58..69a3a6f 100644 --- a/gdb/config/arc/tm-arc.h +++ b/gdb/config/arc/tm-arc.h @@ -62,7 +62,9 @@ extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, int)); /* 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. */ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index 5ca8fa4..e16a498 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -102,8 +102,9 @@ extern CORE_ADDR mips_skip_prologue PARAMS ((CORE_ADDR addr, int lenient)); /* 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 diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 7ae9329..339d8a8 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -626,7 +626,9 @@ extern int is_magic_function_pointer PARAMS ((CORE_ADDR)); /* 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 diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index fc978f7..d5eb576 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -527,7 +527,9 @@ void sparc_fix_call_dummy PARAMS ((char *dummy, CORE_ADDR pc, CORE_ADDR fun, /* 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. */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 320a694..9fc1708 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +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. diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index d7dfa17..1f9623b 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -1384,12 +1384,14 @@ text section. (Seems dubious.) @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 @@ -1558,6 +1560,12 @@ These macros are useful when a target keeps one of these registers in a 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 diff --git a/gdb/infrun.c b/gdb/infrun.c index f1eaaab..ffd95cb 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1,6 +1,6 @@ /* 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. @@ -51,6 +51,8 @@ static int hook_stop_stub PARAMS ((char *)); 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. */ @@ -210,6 +212,11 @@ static int breakpoints_failed; 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; + /* Things to clean up if we QUIT out of resume (). */ /* ARGSUSED */ @@ -233,7 +240,8 @@ resume (step, sig) 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 @@ -244,12 +252,16 @@ resume (step, sig) 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 @@ -318,14 +330,17 @@ proceed (addr, siggnal, step) 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); @@ -527,6 +542,7 @@ wait_for_inferior () /* 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)) { @@ -600,9 +616,7 @@ wait_for_inferior () (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; @@ -631,9 +645,7 @@ wait_for_inferior () 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: @@ -652,11 +664,9 @@ wait_for_inferior () 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)) { @@ -747,14 +757,20 @@ wait_for_inferior () &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 @@ -1359,7 +1375,7 @@ wait_for_inferior () 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 { @@ -1906,7 +1922,7 @@ handle_command (args, from_tty) { 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 diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index c8db798..47fd886 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -32,9 +32,6 @@ extern struct obstack frame_cache_obstack; 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 { @@ -157,8 +154,9 @@ rs6000_breakpoint_from_pc (bp_addr, bp_size) /* 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 @@ -170,7 +168,8 @@ single_step (signal) CORE_ADDR breaks[2]; int opcode; - if (!one_stepped) { + if (insert_breakpoints_p) { + loc = read_pc (); insn = read_memory_integer (loc, 4); @@ -197,7 +196,6 @@ single_step (signal) stepBreaks[ii].address = breaks[ii]; } - one_stepped = 1; } else { /* remove step breakpoints. */ @@ -206,7 +204,6 @@ single_step (signal) 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(). */ |