+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 (get_next_frame (frame))
+ sigcontext_addr = read_memory_typed_address
+ (DEPRECATED_FRAME_ARGS_ADDRESS (get_next_frame (frame)) + 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);
+
+ /* Offset to saved PC in sigcontext, from <machine/signal.h>. 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 + 20, buf, ptrbytes);
+ return extract_typed_address (buf, builtin_type_void_func_ptr);