From dad41f9aa4ce3170d5860ae9c422c41c37500cdd Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 29 Apr 2000 08:55:45 +0000 Subject: [PATCH] Convert SKIP_PROLOGUE_FRAMELESS_P into PROLOGUE_FRAMELESS_P. --- gdb/ChangeLog | 9 +++++++++ gdb/arch-utils.c | 11 +++++++++++ gdb/arch-utils.h | 5 +++++ gdb/blockframe.c | 8 +------- gdb/gdbarch.c | 27 +++++++++++++++++++++++++++ gdb/gdbarch.h | 7 +++++++ gdb/gdbarch.sh | 1 + 7 files changed, 61 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 38c03fa7362..ddbf754b369 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +Fri Apr 28 16:22:34 2000 Andrew Cagney + + * blockframe.c (frameless_look_for_prologue): Use + PROLOG_FRAMELESS_P instead of SKIP_PROLOGUE_FRAMELESS_P. + * gdbarch.sh (PROLOG_FRAMELESS_P): Define. + * gdbarch.h, gdbarch.c: Re-generate. + * arch-utils.h, arch-utils.c (generic_prologue_frameless_p): New + function. + Fri Apr 28 15:31:10 2000 Andrew Cagney From "Serge Nikulin" : diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 49924cbaaf4..aadbebe8287 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -133,6 +133,17 @@ generic_remote_translate_xfer_address (CORE_ADDR gdb_addr, int gdb_len, *rem_len = gdb_len; } +int +generic_prologue_frameless_p (CORE_ADDR ip) +{ +#ifdef SKIP_PROLOGUE_FRAMELESS_P + return ip == SKIP_PROLOGUE_FRAMELESS_P (ip); +#else + return ip == SKIP_PROLOGUE (ip); +#endif +} + + /* */ extern initialize_file_ftype __initialize_gdbarch_utils; diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 6b0d2aa2cfd..608dfc0117b 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -54,4 +54,9 @@ extern int legacy_sizeof_call_dummy_words; /* Typical remote_translate_xfer_address */ extern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer_address; +/* Generic implementation of prologue_frameless_p. Just calls + SKIP_PROLOG and checks the return value to see if it actually + changed. */ +extern gdbarch_prologue_frameless_p_ftype generic_prologue_frameless_p; + #endif diff --git a/gdb/blockframe.c b/gdb/blockframe.c index ac2725d3f61..ccc80dbbd3f 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -300,15 +300,9 @@ frameless_look_for_prologue (frame) if (func_start) { func_start += FUNCTION_START_OFFSET; - after_prologue = func_start; -#ifdef SKIP_PROLOGUE_FRAMELESS_P /* This is faster, since only care whether there *is* a prologue, not how long it is. */ - after_prologue = SKIP_PROLOGUE_FRAMELESS_P (after_prologue); -#else - after_prologue = SKIP_PROLOGUE (after_prologue); -#endif - return after_prologue == func_start; + return PROLOGUE_FRAMELESS_P (func_start); } else if (frame->pc == 0) /* A frame with a zero PC is usually created by dereferencing a diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index a1c14d6ef17..33077f7ff6a 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -197,6 +197,7 @@ struct gdbarch gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs; gdbarch_init_extra_frame_info_ftype *init_extra_frame_info; gdbarch_skip_prologue_ftype *skip_prologue; + gdbarch_prologue_frameless_p_ftype *prologue_frameless_p; gdbarch_inner_than_ftype *inner_than; gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; @@ -321,6 +322,7 @@ struct gdbarch startup_gdbarch = { 0, 0, 0, + 0, /* startup_gdbarch() */ }; struct gdbarch *current_gdbarch = &startup_gdbarch; @@ -366,6 +368,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->pointer_to_address = generic_pointer_to_address; gdbarch->address_to_pointer = generic_address_to_pointer; gdbarch->return_value_on_stack = generic_return_value_on_stack_not; + gdbarch->prologue_frameless_p = generic_prologue_frameless_p; gdbarch->breakpoint_from_pc = legacy_breakpoint_from_pc; gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; @@ -578,6 +581,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH >= 2) && (gdbarch->skip_prologue == 0)) internal_error ("gdbarch: verify_gdbarch: skip_prologue invalid"); + /* Skip verify of prologue_frameless_p, invalid_p == 0 */ if ((GDB_MULTI_ARCH >= 2) && (gdbarch->inner_than == 0)) internal_error ("gdbarch: verify_gdbarch: inner_than invalid"); @@ -892,6 +896,10 @@ gdbarch_dump (void) "gdbarch_update: SKIP_PROLOGUE = 0x%08lx\n", (long) current_gdbarch->skip_prologue /*SKIP_PROLOGUE ()*/); + fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: PROLOGUE_FRAMELESS_P = 0x%08lx\n", + (long) current_gdbarch->prologue_frameless_p + /*PROLOGUE_FRAMELESS_P ()*/); fprintf_unfiltered (gdb_stdlog, "gdbarch_update: INNER_THAN = 0x%08lx\n", (long) current_gdbarch->inner_than @@ -2208,6 +2216,25 @@ set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch->skip_prologue = skip_prologue; } +int +gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, CORE_ADDR ip) +{ + if (GDB_MULTI_ARCH == 0) + return generic_prologue_frameless_p (ip); + if (gdbarch->prologue_frameless_p == 0) + internal_error ("gdbarch: gdbarch_prologue_frameless_p invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_prologue_frameless_p called\n"); + return gdbarch->prologue_frameless_p (ip); +} + +void +set_gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, + gdbarch_prologue_frameless_p_ftype prologue_frameless_p) +{ + gdbarch->prologue_frameless_p = prologue_frameless_p; +} + int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f7f88d264a2..fb2ca99ab2a 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -659,6 +659,13 @@ extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_pro #endif #endif +typedef int (gdbarch_prologue_frameless_p_ftype) (CORE_ADDR ip); +extern int gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, CORE_ADDR ip); +extern void set_gdbarch_prologue_frameless_p (struct gdbarch *gdbarch, gdbarch_prologue_frameless_p_ftype *prologue_frameless_p); +#if (GDB_MULTI_ARCH > 1) || !defined (PROLOGUE_FRAMELESS_P) +#define PROLOGUE_FRAMELESS_P(ip) (gdbarch_prologue_frameless_p (current_gdbarch, ip)) +#endif + typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs); extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs); extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 9e97f17ddbd..a6ad33ce9d6 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -302,6 +302,7 @@ f:2:FRAME_INIT_SAVED_REGS:void:frame_init_saved_regs:struct frame_info *frame:fr f:2:INIT_EXTRA_FRAME_INFO:void:init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame:::0 # f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0 +f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p:0 f:2:INNER_THAN:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs::0:0 f:2:BREAKPOINT_FROM_PC:unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::legacy_breakpoint_from_pc:0 f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint:0 -- 2.30.2