From 993583e53b5537544f01aa235f068318557f4753 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Wed, 19 May 1993 00:57:48 +0000 Subject: [PATCH] * blockframe.c (get_prev_frame_info): If pc in sigtramp, set signal_handler_caller. * tm-68k.h (FRAME_{CHAIN,SAVED_PC}): Deal with sigtramp. * tm-hp300bsd.h: Define SIGTRAMP_{START,END} not IN_SIGTRAMP. * inferior.h (IN_SIGTRAMP): Definition moved from infrun.c. Use SIGTRAMP_START if defined. * infcmd.c (step_1): Use SIGTRAMP_{START,END} if needed. * infrun.c (wait_for_inferior): Check IN_SIGTRAMP before SKIP_PROLOGUE. --- gdb/ChangeLog | 9 +++++++++ gdb/config/m68k/tm-hp300bsd.h | 6 ++---- gdb/config/m68k/tm-m68k.h | 39 +++++++++++++++++++++++++++++++++------ gdb/infcmd.c | 27 ++++++++++++++++++++------- 4 files changed, 64 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ee850d2..68461f3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ Tue May 18 14:08:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + * blockframe.c (get_prev_frame_info): If pc in sigtramp, set + signal_handler_caller. + * tm-68k.h (FRAME_{CHAIN,SAVED_PC}): Deal with sigtramp. + * tm-hp300bsd.h: Define SIGTRAMP_{START,END} not IN_SIGTRAMP. + * inferior.h (IN_SIGTRAMP): Definition moved from infrun.c. + Use SIGTRAMP_START if defined. + * infcmd.c (step_1): Use SIGTRAMP_{START,END} if needed. + * infrun.c (wait_for_inferior): Check IN_SIGTRAMP before SKIP_PROLOGUE. + * infptrace.c: Remove unused KERNEL_U_ADDR_HPUX code. * infcmd.c (step_1): Fix poorly worded error message. diff --git a/gdb/config/m68k/tm-hp300bsd.h b/gdb/config/m68k/tm-hp300bsd.h index 6a19069..9184725 100644 --- a/gdb/config/m68k/tm-hp300bsd.h +++ b/gdb/config/m68k/tm-hp300bsd.h @@ -38,10 +38,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ (hence STACK_END_ADDR as opposed to KERNEL_U_ADDR). This tests for the whole u area, since we don't necessarily have hp300bsd include files around. */ -#define IN_SIGTRAMP(pc, name) \ - ((pc) >= STACK_END_ADDR \ - && (pc) < STACK_END_ADDR + TARGET_UPAGES * TARGET_NBPG \ - ) +#define SIGTRAMP_START STACK_END_ADDR +#define SIGTRAMP_END (STACK_END_ADDR + TARGET_UPAGES * TARGET_NBPG) /* Address of end of stack space. */ diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h index 96d71de..062445b 100644 --- a/gdb/config/m68k/tm-m68k.h +++ b/gdb/config/m68k/tm-m68k.h @@ -293,10 +293,15 @@ extern const struct ext_format ext_format_68881; In the case of the 68000, the frame's nominal address is the address of a 4-byte word containing the calling frame's address. */ +/* If we are chaining from sigtramp, then manufacture a sigtramp frame + (which isn't really on the stack. I'm not sure this is right for anything + but BSD4.3 on an hp300. */ #define FRAME_CHAIN(thisframe) \ - (!inside_entry_file ((thisframe)->pc) ? \ - read_memory_integer ((thisframe)->frame, 4) :\ - 0) + (thisframe->signal_handler_caller \ + ? thisframe->frame \ + : (!inside_entry_file ((thisframe)->pc) ? \ + read_memory_integer ((thisframe)->frame, 4) :\ + 0) /* Define other aspects of the stack frame. */ @@ -304,9 +309,31 @@ extern const struct ext_format ext_format_68881; by FI does not have a frame on the stack associated with it. If it does not, FRAMELESS is set to 1, else 0. */ #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \ - (FRAMELESS) = frameless_look_for_prologue(FI) - -#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) + do { \ + if ((FI)->signal_handler_caller) \ + (FRAMELESS) = 0; \ + else \ + (FRAMELESS) = frameless_look_for_prologue(FI); \ + } while (0) + +/* This was determined by experimentation on hp300 BSD 4.3. Perhaps + it corresponds to some offset in /usr/include/sys/user.h or + something like that. Using some system include file would + have the advantage of probably being more robust in the face + of OS upgrades, but the disadvantage of being wrong for + cross-debugging. */ + +#define SIG_PC_FP_OFFSET 530 + +#define FRAME_SAVED_PC(FRAME) \ + (((FRAME)->signal_handler_caller \ + ? ((FRAME)->next \ + ? read_memory_integer ((FRAME)->next->frame + SIG_PC_FP_OFFSET, 4) \ + : read_memory_integer (read_register (SP_REGNUM) \ + + SIG_PC_FP_OFFSET - 8, 4) \ + ) \ + : read_memory_integer ((FRAME)->frame + 4, 4)) \ + ) #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 9746583..666be8e 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -365,23 +365,36 @@ step_1 (skip_subroutines, single_inst, count_string) { struct minimal_symbol *msymbol; - /* FIXME: we should be using containing_function_bounds or - a cleaned up version thereof. */ + /* FIXME: This should be using containing_function_bounds or a + cleaned-up version thereof, to deal with things like the + end of the text segment. */ msymbol = lookup_minimal_symbol_by_pc (stop_pc); target_terminal_ours (); printf_filtered ("Current function has no line number information.\n"); fflush (stdout); - /* No info or after _etext ("Can't happen") */ if (msymbol == NULL || SYMBOL_NAME (msymbol + 1) == NULL) - error ("Cannot find bounds of current function."); + { + /* If sigtramp is in the u area, check for it. */ +#if defined SIGTRAMP_START + if (IN_SIGTRAMP (stop_pc, (char *)NULL)) + { + step_range_start = SIGTRAMP_START; + step_range_end = SIGTRAMP_END; + } + else +#endif + error ("Cannot find bounds of current function."); + } + else + { + step_range_start = SYMBOL_VALUE_ADDRESS (msymbol); + step_range_end = SYMBOL_VALUE_ADDRESS (msymbol + 1); + } printf_filtered ("Single stepping until function exit.\n"); fflush (stdout); - - step_range_start = SYMBOL_VALUE_ADDRESS (msymbol); - step_range_end = SYMBOL_VALUE_ADDRESS (msymbol + 1); } } else -- 2.7.4