From d62d1979c455befe90f07993d51a279cc0043f5b Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 29 Jan 2003 18:07:07 +0000 Subject: 2003-01-29 Andrew Cagney * frame.c (frame_saved_regs_id_unwind): Assert FRAME_CHAIN_P. (legacy_get_prev_frame): Assert FRAME_CHAIN_P. (get_prev_frame): When FRAME_CHAIN_P, call legacy_get_prev_frame. (frame_saved_regs_pc_unwind): Assert FRAME_SAVED_PC_P. * gdbarch.sh (FRAME_CHAIN): Change to a function with predicate. (FRAME_SAVED_PC): Change to a function with predicate. * gdbarch.h, gdbarch.c: Re-generate. --- gdb/ChangeLog | 10 ++++++++++ gdb/frame.c | 6 +++++- gdb/gdbarch.c | 40 ++++++++++++++++++++++++++++++++++------ gdb/gdbarch.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/gdbarch.sh | 4 ++-- 5 files changed, 101 insertions(+), 9 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 841d022..2a9ff29 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2003-01-29 Andrew Cagney + + * frame.c (frame_saved_regs_id_unwind): Assert FRAME_CHAIN_P. + (legacy_get_prev_frame): Assert FRAME_CHAIN_P. + (get_prev_frame): When FRAME_CHAIN_P, call legacy_get_prev_frame. + (frame_saved_regs_pc_unwind): Assert FRAME_SAVED_PC_P. + * gdbarch.sh (FRAME_CHAIN): Change to a function with predicate. + (FRAME_SAVED_PC): Change to a function with predicate. + * gdbarch.h, gdbarch.c: Re-generate. + 2003-01-28 Andrew Cagney * hppah-nat.c (child_pid_to_exec_file): Don't use boolean. diff --git a/gdb/frame.c b/gdb/frame.c index a0cfc6f..e4adf7d 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -665,6 +665,7 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, static CORE_ADDR frame_saved_regs_pc_unwind (struct frame_info *frame, void **cache) { + gdb_assert (FRAME_SAVED_PC_P ()); return FRAME_SAVED_PC (frame); } @@ -713,6 +714,7 @@ frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache, this to after the ffi test; I'd rather have backtraces from start go curfluy than have an abort called from main not show main. */ + gdb_assert (FRAME_CHAIN_P ()); base = FRAME_CHAIN (next_frame); if (!frame_chain_valid (base, next_frame)) @@ -995,6 +997,7 @@ legacy_get_prev_frame (struct frame_info *next_frame) this to after the ffi test; I'd rather have backtraces from start go curfluy than have an abort called from main not show main. */ + gdb_assert (FRAME_CHAIN_P ()); address = FRAME_CHAIN (next_frame); if (!frame_chain_valid (address, next_frame)) @@ -1233,7 +1236,8 @@ get_prev_frame (struct frame_info *next_frame) frames use the new unwind code. */ if ((DEPRECATED_INIT_FRAME_PC_P () || DEPRECATED_INIT_FRAME_PC_FIRST_P () - || INIT_EXTRA_FRAME_INFO_P ()) + || INIT_EXTRA_FRAME_INFO_P () + || FRAME_CHAIN_P ()) && next_frame->level >= 0) return legacy_get_prev_frame (next_frame); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 81efdad..10f6397 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -761,13 +761,9 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->frame_args_skip == -1)) fprintf_unfiltered (log, "\n\tframe_args_skip"); /* Skip verify of frameless_function_invocation, invalid_p == 0 */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->frame_chain == 0)) - fprintf_unfiltered (log, "\n\tframe_chain"); + /* Skip verify of frame_chain, has predicate */ /* Skip verify of frame_chain_valid, has predicate */ - if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->frame_saved_pc == 0)) - fprintf_unfiltered (log, "\n\tframe_saved_pc"); + /* Skip verify of frame_saved_pc, has predicate */ /* Skip verify of frame_args_address, invalid_p == 0 */ /* Skip verify of frame_locals_address, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) @@ -1429,6 +1425,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: FRAME_ARGS_SKIP = %ld\n", (long) FRAME_ARGS_SKIP); #endif +#ifdef FRAME_CHAIN_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FRAME_CHAIN_P()", + XSTRING (FRAME_CHAIN_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: FRAME_CHAIN_P() = %d\n", + FRAME_CHAIN_P ()); +#endif #ifdef FRAME_CHAIN fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -1505,6 +1510,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->frame_num_args /*FRAME_NUM_ARGS ()*/); #endif +#ifdef FRAME_SAVED_PC_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "FRAME_SAVED_PC_P()", + XSTRING (FRAME_SAVED_PC_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: FRAME_SAVED_PC_P() = %d\n", + FRAME_SAVED_PC_P ()); +#endif #ifdef FRAME_SAVED_PC fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -4657,6 +4671,13 @@ set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, gdbarch->frameless_function_invocation = frameless_function_invocation; } +int +gdbarch_frame_chain_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->frame_chain != 0; +} + CORE_ADDR gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame) { @@ -4702,6 +4723,13 @@ set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, gdbarch->frame_chain_valid = frame_chain_valid; } +int +gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->frame_saved_pc != 0; +} + CORE_ADDR gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 303477c..929b027 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -2026,6 +2026,31 @@ extern void set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch, #endif #endif +#if defined (FRAME_CHAIN) +/* Legacy for systems yet to multi-arch FRAME_CHAIN */ +#if !defined (FRAME_CHAIN_P) +#define FRAME_CHAIN_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_P) +#define FRAME_CHAIN_P() (0) +#endif + +extern int gdbarch_frame_chain_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_CHAIN_P) +#error "Non multi-arch definition of FRAME_CHAIN" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_CHAIN_P) +#define FRAME_CHAIN_P() (gdbarch_frame_chain_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN) +#define FRAME_CHAIN(frame) (internal_error (__FILE__, __LINE__, "FRAME_CHAIN"), 0) +#endif + typedef CORE_ADDR (gdbarch_frame_chain_ftype) (struct frame_info *frame); extern CORE_ADDR gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame); extern void set_gdbarch_frame_chain (struct gdbarch *gdbarch, gdbarch_frame_chain_ftype *frame_chain); @@ -2075,6 +2100,31 @@ extern void set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch, gdbarch_fram #endif #endif +#if defined (FRAME_SAVED_PC) +/* Legacy for systems yet to multi-arch FRAME_SAVED_PC */ +#if !defined (FRAME_SAVED_PC_P) +#define FRAME_SAVED_PC_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC_P) +#define FRAME_SAVED_PC_P() (0) +#endif + +extern int gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_SAVED_PC_P) +#error "Non multi-arch definition of FRAME_SAVED_PC" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_SAVED_PC_P) +#define FRAME_SAVED_PC_P() (gdbarch_frame_saved_pc_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (FRAME_SAVED_PC) +#define FRAME_SAVED_PC(fi) (internal_error (__FILE__, __LINE__, "FRAME_SAVED_PC"), 0) +#endif + typedef CORE_ADDR (gdbarch_frame_saved_pc_ftype) (struct frame_info *fi); extern CORE_ADDR gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi); extern void set_gdbarch_frame_saved_pc (struct gdbarch *gdbarch, gdbarch_frame_saved_pc_ftype *frame_saved_pc); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 87cc01f..034b3ef 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -568,9 +568,9 @@ f:2:REMOTE_TRANSLATE_XFER_ADDRESS:void:remote_translate_xfer_address:CORE_ADDR g # v:2:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:-1 f:2:FRAMELESS_FUNCTION_INVOCATION:int:frameless_function_invocation:struct frame_info *fi:fi:::generic_frameless_function_invocation_not::0 -f:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0 +F:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0 F:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe::0:0 -f:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0 +F:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0 f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:get_frame_base::0 f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:get_frame_base::0 f:2:SAVED_PC_AFTER_CALL:CORE_ADDR:saved_pc_after_call:struct frame_info *frame:frame::0:0 -- cgit v1.1