From: Andrew Cagney Date: Fri, 15 Nov 2002 23:24:21 +0000 (+0000) Subject: 2002-11-15 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f407986f1a479bb0ef4a16c1059ce08e443e9788;p=binutils-gdb.git 2002-11-15 Andrew Cagney * frame.h (sigtramp_saved_pc): Delete declaration. * blockframe.c (sigtramp_saved_pc): Delete function. * ns32k-tdep.c (ns32k_sigtramp_saved_pc): New function. (ns32k_frame_saved_pc): Call ns32k_sigtramp_saved_pc. * vax-tdep.c (vax_sigtramp_saved_pc): New function. (vax_frame_saved_pc): Call vax_sigtramp_saved_pc. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2fbb8fdb37a..1117e61e01f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2002-11-15 Andrew Cagney + + * frame.h (sigtramp_saved_pc): Delete declaration. + * blockframe.c (sigtramp_saved_pc): Delete function. + * ns32k-tdep.c (ns32k_sigtramp_saved_pc): New function. + (ns32k_frame_saved_pc): Call ns32k_sigtramp_saved_pc. + * vax-tdep.c (vax_sigtramp_saved_pc): New function. + (vax_frame_saved_pc): Call vax_sigtramp_saved_pc. + 2002-11-15 Andrew Cagney * frame.c (frame_pc_unwind): New function. diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 3e70b2a495d..9a519a49beb 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -660,35 +660,6 @@ find_frame_addr_in_frame_chain (CORE_ADDR frame_addr) } } -#ifdef SIGCONTEXT_PC_OFFSET -/* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp. */ - -CORE_ADDR -sigtramp_saved_pc (struct frame_info *frame) -{ - CORE_ADDR sigcontext_addr; - char *buf; - int ptrbytes = TYPE_LENGTH (builtin_type_void_func_ptr); - int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT; - - buf = alloca (ptrbytes); - /* Get sigcontext address, it is the third parameter on the stack. */ - if (frame->next) - sigcontext_addr = read_memory_typed_address - (FRAME_ARGS_ADDRESS (frame->next) + FRAME_ARGS_SKIP + sigcontext_offs, - builtin_type_void_data_ptr); - else - sigcontext_addr = read_memory_typed_address - (read_register (SP_REGNUM) + sigcontext_offs, builtin_type_void_data_ptr); - - /* Don't cause a memory_error when accessing sigcontext in case the stack - layout has changed or the stack is corrupt. */ - target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes); - return extract_typed_address (buf, builtin_type_void_func_ptr); -} -#endif /* SIGCONTEXT_PC_OFFSET */ - - /* Are we in a call dummy? The code below which allows DECR_PC_AFTER_BREAK below is for infrun.c, which may give the macro a pc without that subtracted out. */ diff --git a/gdb/frame.h b/gdb/frame.h index a371a58de42..d8c3af4af04 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -392,8 +392,6 @@ extern struct frame_info *block_innermost_frame (struct block *); extern struct frame_info *find_frame_addr_in_frame_chain (CORE_ADDR); -extern CORE_ADDR sigtramp_saved_pc (struct frame_info *); - /* NOTE: cagney/2002-09-13: There is no need for this function. Instead either of frame_unwind_signed_register() or frame_unwind_unsigned_register() can be used. */ diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 5563cf9b0c6..89bdee956ac 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -314,11 +314,36 @@ ns32k_frame_chain (struct frame_info *frame) return (read_memory_integer (frame->frame, 4)); } + +static CORE_ADDR +ns32k_sigtramp_saved_pc (struct frame_info *frame) +{ + CORE_ADDR sigcontext_addr; + char *buf; + int ptrbytes = TYPE_LENGTH (builtin_type_void_func_ptr); + int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT; + + buf = alloca (ptrbytes); + /* Get sigcontext address, it is the third parameter on the stack. */ + if (frame->next) + sigcontext_addr = read_memory_typed_address + (FRAME_ARGS_ADDRESS (frame->next) + FRAME_ARGS_SKIP + sigcontext_offs, + builtin_type_void_data_ptr); + else + sigcontext_addr = read_memory_typed_address + (read_register (SP_REGNUM) + sigcontext_offs, builtin_type_void_data_ptr); + + /* Don't cause a memory_error when accessing sigcontext in case the stack + layout has changed or the stack is corrupt. */ + target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes); + return extract_typed_address (buf, builtin_type_void_func_ptr); +} + static CORE_ADDR ns32k_frame_saved_pc (struct frame_info *frame) { if (frame->signal_handler_caller) - return (sigtramp_saved_pc (frame)); /* XXXJRT */ + return (ns32k_sigtramp_saved_pc (frame)); /* XXXJRT */ return (read_memory_integer (frame->frame + 4, 4)); } diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index e82227fe5e2..b76c4f87473 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -157,11 +157,37 @@ vax_frame_init_saved_regs (struct frame_info *frame) frame->saved_regs[PS_REGNUM] = frame->frame + 4; } +/* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp. */ + +static CORE_ADDR +vax_sigtramp_saved_pc (struct frame_info *frame) +{ + CORE_ADDR sigcontext_addr; + char *buf; + int ptrbytes = TYPE_LENGTH (builtin_type_void_func_ptr); + int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT; + + buf = alloca (ptrbytes); + /* Get sigcontext address, it is the third parameter on the stack. */ + if (frame->next) + sigcontext_addr = read_memory_typed_address + (FRAME_ARGS_ADDRESS (frame->next) + FRAME_ARGS_SKIP + sigcontext_offs, + builtin_type_void_data_ptr); + else + sigcontext_addr = read_memory_typed_address + (read_register (SP_REGNUM) + sigcontext_offs, builtin_type_void_data_ptr); + + /* Don't cause a memory_error when accessing sigcontext in case the stack + layout has changed or the stack is corrupt. */ + target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes); + return extract_typed_address (buf, builtin_type_void_func_ptr); +} + static CORE_ADDR vax_frame_saved_pc (struct frame_info *frame) { if (frame->signal_handler_caller) - return (sigtramp_saved_pc (frame)); /* XXXJRT */ + return (vax_sigtramp_saved_pc (frame)); /* XXXJRT */ return (read_memory_integer (frame->frame + 16, 4)); }