From f796e4be8018a412bc738614a70e6459518b7a5b Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Thu, 20 Feb 2003 16:35:51 +0000 Subject: [PATCH] * frame.c (generic_unwind_get_saved_register): Make non-static. * frame.h (generic_unwind_get_saved_register): Declare. * mips-tdep.c (read_next_frame_reg): Fetch register from current regcache when frame is NULL. (mips_init_extra_frame_info): Pass NULL explicitly for parameter that must be NULL. (mips_get_saved_register): Call generic_unwind_get_saved_register() instead of frame_register_unwind(). --- gdb/ChangeLog | 11 +++++++++++ gdb/frame.c | 2 +- gdb/frame.h | 7 +++++++ gdb/mips-tdep.c | 46 +++++++++++++++++++++++++++++----------------- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0857a2fb3b7..ebb97846e6f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2003-02-20 Kevin Buettner + + * frame.c (generic_unwind_get_saved_register): Make non-static. + * frame.h (generic_unwind_get_saved_register): Declare. + * mips-tdep.c (read_next_frame_reg): Fetch register from + current regcache when frame is NULL. + (mips_init_extra_frame_info): Pass NULL explicitly for parameter + that must be NULL. + (mips_get_saved_register): Call generic_unwind_get_saved_register() + instead of frame_register_unwind(). + 2003-02-20 Andrew Cagney * remote-sim.c (gdbsim_insert_breakpoint) diff --git a/gdb/frame.c b/gdb/frame.c index 0c3009cf4d5..c089aede410 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -307,7 +307,7 @@ frame_read_signed_register (struct frame_info *frame, int regnum, frame_unwind_signed_register (frame->next, regnum, val); } -static void +void generic_unwind_get_saved_register (char *raw_buffer, int *optimizedp, CORE_ADDR *addrp, diff --git a/gdb/frame.h b/gdb/frame.h index abaf9234e54..646d6f6df8b 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -550,6 +550,13 @@ extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p); +void generic_unwind_get_saved_register (char *raw_buffer, + int *optimizedp, + CORE_ADDR *addrp, + struct frame_info *frame, + int regnum, + enum lval_type *lvalp); + /* The function generic_get_saved_register() has been made obsolete. GET_SAVED_REGISTER now defaults to the recursive equivalent - generic_unwind_get_saved_register() - so there is no need to even diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 3c7c2ca43e0..35426b01bc7 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1590,20 +1590,28 @@ read_next_frame_reg (struct frame_info *fi, int regno) int realnum; enum lval_type lval; void *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); - frame_register_unwind (fi, regno, &optimized, &lval, &addr, &realnum, - raw_buffer); - /* FIXME: cagney/2002-09-13: This is just soooo bad. The MIPS - should have a pseudo register range that correspons to the ABI's, - rather than the ISA's, view of registers. These registers would - then implicitly describe their size and hence could be used - without the below munging. */ - if (lval == lval_memory) + + if (fi == NULL) { - if (regno < 32) + regcache_cooked_read (current_regcache, regno, raw_buffer); + } + else + { + frame_register_unwind (fi, regno, &optimized, &lval, &addr, &realnum, + raw_buffer); + /* FIXME: cagney/2002-09-13: This is just soooo bad. The MIPS + should have a pseudo register range that correspons to the ABI's, + rather than the ISA's, view of registers. These registers would + then implicitly describe their size and hence could be used + without the below munging. */ + if (lval == lval_memory) { - /* Only MIPS_SAVED_REGSIZE bytes of GP registers are - saved. */ - return read_memory_integer (addr, MIPS_SAVED_REGSIZE); + if (regno < 32) + { + /* Only MIPS_SAVED_REGSIZE bytes of GP registers are + saved. */ + return read_memory_integer (addr, MIPS_SAVED_REGSIZE); + } } } @@ -2474,11 +2482,16 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci) if (get_frame_type (fci) == DUMMY_FRAME) return; - /* Use proc_desc calculated in frame_chain */ + /* Use proc_desc calculated in frame_chain. When there is no + next frame, i.e, get_next_frame (fci) == NULL, we call + find_proc_desc () to calculate it, passing an explicit + NULL as the frame parameter. */ proc_desc = get_next_frame (fci) ? cached_proc_desc - : find_proc_desc (get_frame_pc (fci), get_next_frame (fci), 1); + : find_proc_desc (get_frame_pc (fci), + NULL /* i.e, get_next_frame (fci) */, + 1); frame_extra_info_zalloc (fci, sizeof (struct frame_extra_info)); @@ -5482,7 +5495,6 @@ mips_get_saved_register (char *raw_buffer, CORE_ADDR addrx; enum lval_type lvalx; int optimizedx; - int realnum; if (!target_has_registers) error ("No registers."); @@ -5494,8 +5506,8 @@ mips_get_saved_register (char *raw_buffer, lvalp = &lvalx; if (optimizedp == NULL) optimizedp = &optimizedx; - frame_register_unwind (get_next_frame (frame), regnum, optimizedp, lvalp, - addrp, &realnum, raw_buffer); + generic_unwind_get_saved_register (raw_buffer, optimizedp, addrp, frame, + regnum, lvalp); /* FIXME: cagney/2002-09-13: This is just so bad. The MIPS should have a pseudo register range that correspons to the ABI's, rather than the ISA's, view of registers. These registers would then -- 2.30.2