From: Andrew Cagney Date: Sun, 19 Jan 2003 23:27:28 +0000 (+0000) Subject: 2003-01-19 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dedc2a2b6559e402f90c322d37953d1875381b76;p=binutils-gdb.git 2003-01-19 Andrew Cagney * frame.c (frame_saved_regs_pop): Assert POP_FRAME_P. * gdbarch.sh (POP_FRAME): Change to function with predicate. Suppress actual parameters when `-'. * gdbarch.h, gdbarch.c: Regenerate. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8ae914eb5e2..fd024cccb3c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2003-01-19 Andrew Cagney + + * frame.c (frame_saved_regs_pop): Assert POP_FRAME_P. + * gdbarch.sh (POP_FRAME): Change to function with predicate. + Suppress actual parameters when `-'. + * gdbarch.h, gdbarch.c: Regenerate. + 2003-01-19 Andrew Cagney * d10v-tdep.c (d10v_frame_saved_pc, d10v_frame_chain): Restore diff --git a/gdb/frame.c b/gdb/frame.c index 9fb5e9b24a7..b00eebc2ae8 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -731,6 +731,7 @@ static void frame_saved_regs_pop (struct frame_info *fi, void **cache, struct regcache *regcache) { + gdb_assert (POP_FRAME_P ()); POP_FRAME; } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 069e56666e1..bd19793ff15 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -728,9 +728,7 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->push_dummy_frame == 0)) fprintf_unfiltered (log, "\n\tpush_dummy_frame"); /* Skip verify of push_return_address, has predicate */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->pop_frame == 0)) - fprintf_unfiltered (log, "\n\tpop_frame"); + /* Skip verify of pop_frame, has predicate */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->store_struct_return == 0)) fprintf_unfiltered (log, "\n\tstore_struct_return"); @@ -1761,6 +1759,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->pointer_to_address /*POINTER_TO_ADDRESS ()*/); #endif +#ifdef POP_FRAME_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "POP_FRAME_P()", + XSTRING (POP_FRAME_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: POP_FRAME_P() = %d\n", + POP_FRAME_P ()); +#endif #ifdef POP_FRAME #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -4178,6 +4185,13 @@ set_gdbarch_push_return_address (struct gdbarch *gdbarch, gdbarch->push_return_address = push_return_address; } +int +gdbarch_pop_frame_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->pop_frame != 0; +} + void gdbarch_pop_frame (struct gdbarch *gdbarch) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 336f6ca5abe..303477c0d4d 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1577,6 +1577,32 @@ extern void set_gdbarch_push_return_address (struct gdbarch *gdbarch, gdbarch_pu #endif #endif +#if defined (POP_FRAME) +/* Legacy for systems yet to multi-arch POP_FRAME */ +#if !defined (POP_FRAME_P) +#define POP_FRAME_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME_P) +#define POP_FRAME_P() (0) +#endif + +extern int gdbarch_pop_frame_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (POP_FRAME_P) +#error "Non multi-arch definition of POP_FRAME" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POP_FRAME_P) +#define POP_FRAME_P() (gdbarch_pop_frame_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME) +#define POP_FRAME (internal_error (__FILE__, __LINE__, "POP_FRAME"), 0) +#define POP_FRAME (gdbarch_pop_frame (current_gdbarch)) +#endif + typedef void (gdbarch_pop_frame_ftype) (void); extern void gdbarch_pop_frame (struct gdbarch *gdbarch); extern void set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch_pop_frame_ftype *pop_frame); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 9efadfe2495..fd9ddd52605 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -538,7 +538,7 @@ f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::gen f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0 f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0 F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 -f:2:POP_FRAME:void:pop_frame:void:-:::0 +F:2:POP_FRAME:void:pop_frame:void:-:::0 # f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0 # @@ -907,7 +907,13 @@ do printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n" if [ "x${fallbackdefault}" = "x0" ] then - printf "#define ${macro}(${actual}) (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n" + if [ "x${actual}" = "x-" ] + then + printf "#define ${macro} (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n" + printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n" + else + printf "#define ${macro}(${actual}) (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n" + fi else # FIXME: Should be passing current_gdbarch through! echo "#define ${macro}(${actual}) (${fallbackdefault} (${actual}))" \