From: Andrew Cagney Date: Mon, 9 Dec 2002 02:04:17 +0000 (+0000) Subject: 2002-12-08 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97f46953947f21e2b8f1cac99546b7d6b51a84cc;p=binutils-gdb.git 2002-12-08 Andrew Cagney * gdbarch.sh (INIT_FRAME_PC_FIRST, INIT_FRAME_PC_DEFAULT): Convert to pure functions. * gdbarch.h, gdbarch.c: Re-generate. * frame.c (get_prev_frame): Explictly assign prev's pc with value returned by INIT_FRAME_PC_FIRST and INIT_EXTRA_FRAME_INFO. * arch-utils.h (init_frame_pc_default, init_frame_pc_noop): Change declaration to a function returning a CORE_ADDR. * x86-64-tdep.h (x86_64_init_frame_pc): Ditto. * arch-utils.c (init_frame_pc_noop): Return the PC value. (init_frame_pc_default): Ditto. * x86-64-linux-tdep.c (x86_64_init_frame_pc): Ditto. * s390-tdep.c (s390_init_frame_pc_first): Ditto. * mips-tdep.c (mips_init_frame_pc_first): Ditto. * dwarf2cfi.h (cfi_init_frame_pc): Ditto. * dwarf2cfi.c (cfi_init_frame_pc): Ditto. * alpha-tdep.c (alpha_init_frame_pc_first): Ditto. * i386-interix-tdep.c (i386_interix_init_abi): Set init_frame_pc to init_frame_pc_noop. (i386_interix_init_frame_pc): Delete function. * z8k-tdep.c (init_frame_pc): Delete function. * config/z8k/tm-z8k.h (INIT_FRAME_PC): Define as init_frame_pc_noop. (INIT_FRAME_PC_FIRST): Ditto. * config/mn10200/tm-mn10200.h (INIT_FRAME_PC): Ditto. (INIT_FRAME_PC_FIRST): Ditto. * config/sparc/tm-sparc.h (INIT_FRAME_PC): Ditto. * config/rs6000/tm-rs6000.h (INIT_FRAME_PC): Redefine as init_frame_pc_noop. (INIT_FRAME_PC_FIRST): Convert to an expression. * config/sparc/tm-sparc.h (INIT_FRAME_PC_FIRST): Ditto. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a10fb571e9f..305199471be 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,37 @@ +2002-12-08 Andrew Cagney + + * gdbarch.sh (INIT_FRAME_PC_FIRST, INIT_FRAME_PC_DEFAULT): Convert + to pure functions. + * gdbarch.h, gdbarch.c: Re-generate. + * frame.c (get_prev_frame): Explictly assign prev's pc with value + returned by INIT_FRAME_PC_FIRST and INIT_EXTRA_FRAME_INFO. + + * arch-utils.h (init_frame_pc_default, init_frame_pc_noop): Change + declaration to a function returning a CORE_ADDR. + * x86-64-tdep.h (x86_64_init_frame_pc): Ditto. + * arch-utils.c (init_frame_pc_noop): Return the PC value. + (init_frame_pc_default): Ditto. + * x86-64-linux-tdep.c (x86_64_init_frame_pc): Ditto. + * s390-tdep.c (s390_init_frame_pc_first): Ditto. + * mips-tdep.c (mips_init_frame_pc_first): Ditto. + * dwarf2cfi.h (cfi_init_frame_pc): Ditto. + * dwarf2cfi.c (cfi_init_frame_pc): Ditto. + * alpha-tdep.c (alpha_init_frame_pc_first): Ditto. + + * i386-interix-tdep.c (i386_interix_init_abi): Set init_frame_pc + to init_frame_pc_noop. + (i386_interix_init_frame_pc): Delete function. + * z8k-tdep.c (init_frame_pc): Delete function. + * config/z8k/tm-z8k.h (INIT_FRAME_PC): Define as init_frame_pc_noop. + (INIT_FRAME_PC_FIRST): Ditto. + * config/mn10200/tm-mn10200.h (INIT_FRAME_PC): Ditto. + (INIT_FRAME_PC_FIRST): Ditto. + * config/sparc/tm-sparc.h (INIT_FRAME_PC): Ditto. + * config/rs6000/tm-rs6000.h (INIT_FRAME_PC): Redefine as + init_frame_pc_noop. + (INIT_FRAME_PC_FIRST): Convert to an expression. + * config/sparc/tm-sparc.h (INIT_FRAME_PC_FIRST): Ditto. + 2002-12-08 Andrew Cagney * blockframe.c: Use get_frame_base instead of directly accessing diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 6d998c40030..b0da5b3768e 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -456,11 +456,12 @@ alpha_frame_init_saved_regs (struct frame_info *fi) fi->saved_regs[SP_REGNUM] = fi->frame; } -static void +static CORE_ADDR alpha_init_frame_pc_first (int fromleaf, struct frame_info *prev) { - prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : - prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); + return (fromleaf ? SAVED_PC_AFTER_CALL (get_next_frame (prev)) + : get_next_frame (prev) ? FRAME_SAVED_PC (prev->next) + : read_pc ()); } static CORE_ADDR diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index dfbbc211929..de3d284a8c8 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -373,21 +373,22 @@ generic_prepare_to_proceed (int select_it) } -void +CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev) { - return; + /* Do nothing, implies return the same PC value. */ + return get_frame_pc (prev); } -void +CORE_ADDR init_frame_pc_default (int fromleaf, struct frame_info *prev) { if (fromleaf) - prev->pc = SAVED_PC_AFTER_CALL (get_next_frame (prev)); + return SAVED_PC_AFTER_CALL (get_next_frame (prev)); else if (get_next_frame (prev) != NULL) - prev->pc = FRAME_SAVED_PC (get_next_frame (prev)); + return FRAME_SAVED_PC (get_next_frame (prev)); else - prev->pc = read_pc (); + return read_pc (); } void diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 54f0d4c8210..3452fc81350 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -117,9 +117,9 @@ extern int generic_prepare_to_proceed (int select_it); /* Versions of init_frame_pc(). Do nothing; do the default. */ -void init_frame_pc_noop (int fromleaf, struct frame_info *prev); +extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev); -void init_frame_pc_default (int fromleaf, struct frame_info *prev); +extern CORE_ADDR init_frame_pc_default (int fromleaf, struct frame_info *prev); /* Do nothing version of elf_make_msymbol_special. */ diff --git a/gdb/config/mn10200/tm-mn10200.h b/gdb/config/mn10200/tm-mn10200.h index 2370118bb89..d7b9f0986a5 100644 --- a/gdb/config/mn10200/tm-mn10200.h +++ b/gdb/config/mn10200/tm-mn10200.h @@ -107,7 +107,8 @@ struct value; extern void mn10200_init_extra_frame_info (struct frame_info *); #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10200_init_extra_frame_info (fi) -#define INIT_FRAME_PC(x,y) +#define INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y)) +#define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y)) extern void mn10200_frame_find_saved_regs (struct frame_info *, struct frame_saved_regs *); diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h index 30f84860a98..5109978edfe 100644 --- a/gdb/config/rs6000/tm-rs6000.h +++ b/gdb/config/rs6000/tm-rs6000.h @@ -79,9 +79,9 @@ extern void aix_process_linenos (void); /* Define other aspects of the stack frame. */ #define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) \ - prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ - prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); -#define INIT_FRAME_PC(fromleaf, prev) /* nothing */ + (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ + prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()) +#define INIT_FRAME_PC(fromleaf, prev) (init_frame_pc_noop (fromleaf, prev)) /* Flag for machine-specific stuff in shared files. FIXME */ #define IBM6000_TARGET diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index ce94d9437e0..0516078945b 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -519,10 +519,10 @@ extern void sparc_print_extra_frame_info (struct frame_info *); /* INIT_EXTRA_FRAME_INFO needs the PC to detect flat frames. */ -#define INIT_FRAME_PC(FROMLEAF, PREV) /* nothing */ +#define INIT_FRAME_PC(FROMLEAF, PREV) (init_frame_pc_noop (FROMLEAF, PREV)) #define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \ - (PREV)->pc = ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \ - (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ()); + ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \ + (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ()) /* Define other aspects of the stack frame. */ diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h index 1c11d53505b..12ba24794a7 100644 --- a/gdb/config/z8k/tm-z8k.h +++ b/gdb/config/z8k/tm-z8k.h @@ -108,9 +108,8 @@ extern int z8k_saved_pc_after_call (struct frame_info *frame); #define REGISTER_VIRTUAL_TYPE(N) \ (REGISTER_VIRTUAL_SIZE(N) == 2? builtin_type_unsigned_int : builtin_type_long) -/*#define INIT_FRAME_PC(x,y) init_frame_pc(x,y) */ -/* Initializer for an array of names of registers. - Entries beyond the first NUM_REGS are ignored. */ +#define INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y)) +#define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y)) #define REGISTER_NAMES \ {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c index 30c2db7e683..c431862b828 100644 --- a/gdb/dwarf2cfi.c +++ b/gdb/dwarf2cfi.c @@ -1746,13 +1746,19 @@ cfi_frame_chain (struct frame_info *fi) } /* Sets the pc of the frame. */ -void +CORE_ADDR cfi_init_frame_pc (int fromleaf, struct frame_info *fi) { - if (fi->next) - get_reg ((char *) &(fi->pc), UNWIND_CONTEXT (fi->next), PC_REGNUM); + if (get_next_frame (fi)) + { + CORE_ADDR pc; + /* FIXME: cagney/2002-12-04: This is straight wrong. It's + assuming that the PC is CORE_ADDR (a host quantity) in size. */ + get_reg (&pc, UNWIND_CONTEXT (get_next_frame (fi)), PC_REGNUM); + return pc; + } else - fi->pc = read_pc (); + return read_pc (); } /* Initialize unwind context informations of the frame. */ diff --git a/gdb/dwarf2cfi.h b/gdb/dwarf2cfi.h index a1cc39cb581..2c8be97ddca 100644 --- a/gdb/dwarf2cfi.h +++ b/gdb/dwarf2cfi.h @@ -67,7 +67,7 @@ void cfi_pop_frame (struct frame_info *); CORE_ADDR cfi_frame_chain (struct frame_info *fi); /* Sets the pc of the frame. */ -void cfi_init_frame_pc (int fromleaf, struct frame_info *fi); +CORE_ADDR cfi_init_frame_pc (int fromleaf, struct frame_info *fi); /* Initialize unwind context informations of the frame. */ void cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi); diff --git a/gdb/frame.c b/gdb/frame.c index 4e31c93fa78..3652e3357aa 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1042,7 +1042,7 @@ get_prev_frame (struct frame_info *next_frame) function does have somewhere to cache that PC value. */ if (DEPRECATED_INIT_FRAME_PC_FIRST_P ()) - DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev); + prev->pc = (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev)); if (INIT_EXTRA_FRAME_INFO_P ()) INIT_EXTRA_FRAME_INFO (fromleaf, prev); @@ -1050,7 +1050,7 @@ get_prev_frame (struct frame_info *next_frame) /* This entry is in the frame queue now, which is good since FRAME_SAVED_PC may use that queue to figure out its value (see tm-sparc.h). We want the pc saved in the inferior frame. */ - INIT_FRAME_PC (fromleaf, prev); + prev->pc = (INIT_FRAME_PC (fromleaf, prev)); /* If ->frame and ->pc are unchanged, we are in the process of getting ourselves into an infinite backtrace. Some architectures diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 9523abc1505..9126a03e240 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -1202,13 +1202,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) DEPRECATED_INIT_FRAME_PC_FIRST_P ()); #endif #ifdef DEPRECATED_INIT_FRAME_PC_FIRST -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", "DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev)", XSTRING (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev))); -#endif if (GDB_MULTI_ARCH) fprintf_unfiltered (file, "gdbarch_dump: DEPRECATED_INIT_FRAME_PC_FIRST = 0x%08lx\n", @@ -1581,13 +1578,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) /*INIT_EXTRA_FRAME_INFO ()*/); #endif #ifdef INIT_FRAME_PC -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", "INIT_FRAME_PC(fromleaf, prev)", XSTRING (INIT_FRAME_PC (fromleaf, prev))); -#endif if (GDB_MULTI_ARCH) fprintf_unfiltered (file, "gdbarch_dump: INIT_FRAME_PC = 0x%08lx\n", @@ -3791,7 +3785,7 @@ gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch) return gdbarch->deprecated_init_frame_pc_first != 0; } -void +CORE_ADDR gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev) { gdb_assert (gdbarch != NULL); @@ -3800,7 +3794,7 @@ gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, s "gdbarch: gdbarch_deprecated_init_frame_pc_first invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_init_frame_pc_first called\n"); - gdbarch->deprecated_init_frame_pc_first (fromleaf, prev); + return gdbarch->deprecated_init_frame_pc_first (fromleaf, prev); } void @@ -3810,7 +3804,7 @@ set_gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, gdbarch->deprecated_init_frame_pc_first = deprecated_init_frame_pc_first; } -void +CORE_ADDR gdbarch_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev) { gdb_assert (gdbarch != NULL); @@ -3819,7 +3813,7 @@ gdbarch_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info "gdbarch: gdbarch_init_frame_pc invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_init_frame_pc called\n"); - gdbarch->init_frame_pc (fromleaf, prev); + return gdbarch->init_frame_pc (fromleaf, prev); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index c72897d6101..026a9c0558f 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1203,8 +1203,8 @@ extern int gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch); #define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) (internal_error (__FILE__, __LINE__, "DEPRECATED_INIT_FRAME_PC_FIRST"), 0) #endif -typedef void (gdbarch_deprecated_init_frame_pc_first_ftype) (int fromleaf, struct frame_info *prev); -extern void gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev); +typedef CORE_ADDR (gdbarch_deprecated_init_frame_pc_first_ftype) (int fromleaf, struct frame_info *prev); +extern CORE_ADDR gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev); extern void set_gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_FRAME_PC_FIRST) #error "Non multi-arch definition of DEPRECATED_INIT_FRAME_PC_FIRST" @@ -1220,8 +1220,8 @@ extern void set_gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, #define INIT_FRAME_PC(fromleaf, prev) (init_frame_pc_default (fromleaf, prev)) #endif -typedef void (gdbarch_init_frame_pc_ftype) (int fromleaf, struct frame_info *prev); -extern void gdbarch_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev); +typedef CORE_ADDR (gdbarch_init_frame_pc_ftype) (int fromleaf, struct frame_info *prev); +extern CORE_ADDR gdbarch_init_frame_pc (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev); extern void set_gdbarch_init_frame_pc (struct gdbarch *gdbarch, gdbarch_init_frame_pc_ftype *init_frame_pc); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INIT_FRAME_PC) #error "Non multi-arch definition of INIT_FRAME_PC" diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index d78b83578c0..ee1c815e26f 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -513,8 +513,8 @@ v:2:SIZEOF_CALL_DUMMY_WORDS:int:sizeof_call_dummy_words::::0:legacy_sizeof_call_ v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_dummy_stack_adjust_p::::0:-1:::0x%08lx v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0 -F::DEPRECATED_INIT_FRAME_PC_FIRST:void:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev -f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_default::0 +F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev +f:2:INIT_FRAME_PC:CORE_ADDR:init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_default::0 # v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::::: diff --git a/gdb/i386-interix-tdep.c b/gdb/i386-interix-tdep.c index 7dce6b0d991..46a2be970b2 100644 --- a/gdb/i386-interix-tdep.c +++ b/gdb/i386-interix-tdep.c @@ -117,12 +117,6 @@ i386_interix_skip_trampoline_code (CORE_ADDR pc) return i386_pe_skip_trampoline_code (pc, 0); } -static void -i386_interix_init_frame_pc (int fromleaf, struct frame_info *prev) -{ - /* Nothing to do on Interix. */ -} - static int i386_interix_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) { @@ -337,7 +331,7 @@ i386_interix_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_skip_trampoline_code (gdbarch, i386_interix_skip_trampoline_code); set_gdbarch_init_extra_frame_info (gdbarch, i386_interix_back_one_frame); - set_gdbarch_init_frame_pc (gdbarch, i386_interix_init_frame_pc); + set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop); set_gdbarch_frame_chain_valid (gdbarch, i386_interix_frame_chain_valid); set_gdbarch_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc); set_gdbarch_name_of_malloc (gdbarch, "_malloc"); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 65216bd49d2..fc51c6ede47 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1677,7 +1677,7 @@ mips_software_single_step (enum target_signal sig, int insert_breakpoints_p) target_remove_breakpoint (next_pc, break_mem); } -static void +static CORE_ADDR mips_init_frame_pc_first (int fromleaf, struct frame_info *prev) { CORE_ADDR pc, tmp; @@ -1685,7 +1685,7 @@ mips_init_frame_pc_first (int fromleaf, struct frame_info *prev) pc = ((fromleaf) ? SAVED_PC_AFTER_CALL (prev->next) : prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); tmp = SKIP_TRAMPOLINE_CODE (pc); - prev->pc = tmp ? tmp : pc; + return tmp ? tmp : pc; } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index a5584009d11..48842dafc4d 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -881,25 +881,24 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi, for the moment. For some reason the blockframe.c calls us with fi->next->fromleaf so this seems of little use to us. */ -void +CORE_ADDR s390_init_frame_pc_first (int next_fromleaf, struct frame_info *fi) { CORE_ADDR sigcaller_pc; - - fi->pc = 0; + CORE_ADDR pc = 0; if (next_fromleaf) { - fi->pc = ADDR_BITS_REMOVE (read_register (S390_RETADDR_REGNUM)); + pc = ADDR_BITS_REMOVE (read_register (S390_RETADDR_REGNUM)); /* fix signal handlers */ } - else if (fi->next && fi->next->pc) - fi->pc = s390_frame_saved_pc_nofix (fi->next); - if (fi->pc && fi->next && fi->next->frame && - s390_is_sigreturn (fi->pc, fi->next, NULL, &sigcaller_pc)) + else if (get_next_frame (fi) && get_frame_pc (get_next_frame (fi))) + pc = s390_frame_saved_pc_nofix (get_next_frame (fi)); + if (pc && get_next_frame (fi) && get_frame_base (get_next_frame (fi)) + && s390_is_sigreturn (pc, get_next_frame (fi), NULL, &sigcaller_pc)) { - fi->pc = sigcaller_pc; + pc = sigcaller_pc; } - + return pc; } void diff --git a/gdb/x86-64-linux-tdep.c b/gdb/x86-64-linux-tdep.c index 19ee19c857e..de31e139925 100644 --- a/gdb/x86-64-linux-tdep.c +++ b/gdb/x86-64-linux-tdep.c @@ -175,17 +175,17 @@ x86_64_linux_frame_chain (struct frame_info *fi) return fp; } -void +CORE_ADDR x86_64_init_frame_pc (int fromleaf, struct frame_info *fi) { CORE_ADDR addr; - if (fi->next && (get_frame_type (fi->next) == SIGTRAMP_FRAME)) + if (get_next_frame (fi) && (get_frame_type (fi->next) == SIGTRAMP_FRAME)) { - addr = fi->next->next->frame + addr = get_frame_base (get_next_frame (get_next_frame (fi))) + LINUX_SIGINFO_SIZE + LINUX_UCONTEXT_SIGCONTEXT_OFFSET; - fi->pc = read_memory_integer (addr + LINUX_SIGCONTEXT_PC_OFFSET, 8); + return read_memory_integer (addr + LINUX_SIGCONTEXT_PC_OFFSET, 8); } else - cfi_init_frame_pc (fromleaf, fi); + return cfi_init_frame_pc (fromleaf, fi); } diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h index 4e7320643ca..8b8b01516a0 100644 --- a/gdb/x86-64-tdep.h +++ b/gdb/x86-64-tdep.h @@ -35,7 +35,7 @@ gdbarch_frame_saved_pc_ftype x86_64_linux_frame_saved_pc; gdbarch_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call; gdbarch_pc_in_sigtramp_ftype x86_64_linux_in_sigtramp; CORE_ADDR x86_64_linux_frame_chain (struct frame_info *fi); -void x86_64_init_frame_pc (int fromleaf, struct frame_info *fi); +CORE_ADDR x86_64_init_frame_pc (int fromleaf, struct frame_info *fi); #endif diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index ea4cf361f5e..e1aa8fa8d13 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -166,12 +166,6 @@ z8k_frame_chain (struct frame_info *thisframe) return 0; } -void -init_frame_pc (void) -{ - internal_error (__FILE__, __LINE__, "failed internal consistency check"); -} - /* Put here the code to store, into a struct frame_saved_regs, the addresses of the saved registers of frame described by FRAME_INFO. This includes special registers such as pc and fp saved in special