From bdcd319a1e4591cc67562d960ab225e9847e9a25 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 15 Aug 2001 15:29:56 +0000 Subject: [PATCH] * arch-utils.c (generic_skip_trampoline_code): New function. * arch-utils.h (generic_skip_trampoline_code): Declare external. * gdbarch.c: Regeberated from gdbarch.sh. * gdbarch.h: Ditto. * gdbarch.sh (SKIP_TRAMPOLINE_CODE): Multi-arch. * infrun.c: Remove default setting of SKIP_TRAMPOLINE_CODE macro. --- gdb/ChangeLog | 9 +++++++++ gdb/arch-utils.c | 6 ++++++ gdb/arch-utils.h | 2 ++ gdb/gdbarch.c | 35 +++++++++++++++++++++++++++++++++++ gdb/gdbarch.h | 17 +++++++++++++++++ gdb/gdbarch.sh | 1 + gdb/infrun.c | 8 -------- 7 files changed, 70 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 51b5a871440..3f5a46652fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2001-08-15 Corinna Vinschen + + * arch-utils.c (generic_skip_trampoline_code): New function. + * arch-utils.h (generic_skip_trampoline_code): Declare external. + * gdbarch.c: Regeberated from gdbarch.sh. + * gdbarch.h: Ditto. + * gdbarch.sh (SKIP_TRAMPOLINE_CODE): Multi-arch. + * infrun.c: Remove default setting of SKIP_TRAMPOLINE_CODE macro. + 2001-08-14 Daniel Jacobowitz H.J. Lu (hjl@gnu.org) diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 93da7c86ca9..124281f454c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -99,6 +99,12 @@ generic_return_value_on_stack_not (struct type *type) return 0; } +CORE_ADDR +generic_skip_trampoline_code (CORE_ADDR pc) +{ + return 0; +} + char * legacy_register_name (int i) { diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 3a986afa7e8..a273b9fd80c 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -127,4 +127,6 @@ int cannot_register_not (int regnum); extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; +extern CORE_ADDR generic_skip_trampoline_code (CORE_ADDR pc); + #endif diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 21645d9c866..ced835485e9 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -249,6 +249,7 @@ struct gdbarch gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr; gdbarch_addr_bits_remove_ftype *addr_bits_remove; gdbarch_software_single_step_ftype *software_single_step; + gdbarch_skip_trampoline_code_ftype *skip_trampoline_code; }; @@ -383,6 +384,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, /* startup_gdbarch() */ }; @@ -482,6 +484,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->extra_stack_alignment_needed = 1; gdbarch->convert_from_func_ptr_addr = core_addr_identity; gdbarch->addr_bits_remove = core_addr_identity; + gdbarch->skip_trampoline_code = generic_skip_trampoline_code; /* gdbarch_alloc() */ return gdbarch; @@ -777,6 +780,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ /* Skip verify of addr_bits_remove, invalid_p == 0 */ /* Skip verify of software_single_step, has predicate */ + /* Skip verify of skip_trampoline_code, invalid_p == 0 */ } @@ -1468,6 +1472,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)", XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p))); #endif +#ifdef SKIP_TRAMPOLINE_CODE + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SKIP_TRAMPOLINE_CODE(pc)", + XSTRING (SKIP_TRAMPOLINE_CODE (pc))); +#endif #ifdef TARGET_ARCHITECTURE if (TARGET_ARCHITECTURE != NULL) fprintf_unfiltered (file, @@ -2199,6 +2209,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: SOFTWARE_SINGLE_STEP = 0x%08lx\n", (long) current_gdbarch->software_single_step /*SOFTWARE_SINGLE_STEP ()*/); +#endif +#ifdef SKIP_TRAMPOLINE_CODE + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: SKIP_TRAMPOLINE_CODE = 0x%08lx\n", + (long) current_gdbarch->skip_trampoline_code + /*SKIP_TRAMPOLINE_CODE ()*/); #endif if (current_gdbarch->dump_tdep != NULL) current_gdbarch->dump_tdep (current_gdbarch, file); @@ -4313,6 +4330,24 @@ set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch->software_single_step = software_single_step; } +CORE_ADDR +gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc) +{ + if (gdbarch->skip_trampoline_code == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_skip_trampoline_code invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_trampoline_code called\n"); + return gdbarch->skip_trampoline_code (pc); +} + +void +set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, + gdbarch_skip_trampoline_code_ftype skip_trampoline_code) +{ + gdbarch->skip_trampoline_code = skip_trampoline_code; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 69ad8e72460..f2a10332e1d 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1947,6 +1947,23 @@ extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_s #endif #endif +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (SKIP_TRAMPOLINE_CODE) +#define SKIP_TRAMPOLINE_CODE(pc) (generic_skip_trampoline_code (pc)) +#endif + +typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (CORE_ADDR pc); +extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, CORE_ADDR pc); +extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SKIP_TRAMPOLINE_CODE) +#error "Non multi-arch definition of SKIP_TRAMPOLINE_CODE" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SKIP_TRAMPOLINE_CODE) +#define SKIP_TRAMPOLINE_CODE(pc) (gdbarch_skip_trampoline_code (current_gdbarch, pc)) +#endif +#endif + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index a8c908989d7..714498dee44 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -539,6 +539,7 @@ f:2:ADDR_BITS_REMOVE:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr:::core_addr_ # 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:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::0:0 +f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0 EOF } diff --git a/gdb/infrun.c b/gdb/infrun.c index fa250068e5f..6b62a419bfd 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -120,14 +120,6 @@ static int may_follow_exec = MAY_FOLLOW_EXEC; #endif -/* Some machines have trampoline code that sits between function callers - and the actual functions themselves. If this machine doesn't have - such things, disable their processing. */ - -#ifndef SKIP_TRAMPOLINE_CODE -#define SKIP_TRAMPOLINE_CODE(pc) 0 -#endif - /* Dynamic function trampolines are similar to solib trampolines in that they are between the caller and the callee. The difference is that when you enter a dynamic trampoline, you can't determine the callee's address. Some -- 2.30.2