From c68a4142534e3a8d588f12ad8b279e559bd320d7 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Mon, 11 Oct 2004 02:04:23 +0000 Subject: [PATCH] * mips-tdep.c (mips_insn16_frame_cache): Remove unused variables. Update comments. Also immediately return empty cache when the start address of our function could not be found. (mips_insn32_frame_cache): Likewise. --- gdb/ChangeLog | 7 +++++++ gdb/mips-tdep.c | 36 ++++++++++++------------------------ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e8ac361280..058de09891 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2004-10-10 Joel Brobecker + + * mips-tdep.c (mips_insn16_frame_cache): Remove unused variables. + Update comments. Also immediately return empty cache when the start + address of our function could not be found. + (mips_insn32_frame_cache): Likewise. + 2004-10-10 Joel Brobecker * mips-tdep.c (mips16_decode_reg_save): Delete, no longer used. diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 682ed62f9d..adf9831c44 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1717,14 +1717,7 @@ mips_mdebug_frame_base_sniffer (struct frame_info *next_frame) static struct mips_frame_cache * mips_insn16_frame_cache (struct frame_info *next_frame, void **this_cache) { - mips_extra_func_info_t proc_desc; struct mips_frame_cache *cache; - struct gdbarch *gdbarch = get_frame_arch (next_frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - /* r0 bit means kernel trap */ - int kernel_trap; - /* What registers have been saved? Bitmasks. */ - unsigned long gen_mask, float_mask; if ((*this_cache) != NULL) return (*this_cache); @@ -1732,7 +1725,7 @@ mips_insn16_frame_cache (struct frame_info *next_frame, void **this_cache) (*this_cache) = cache; cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); - /* Synthesize a proc descriptor. */ + /* Analyze the function prologue. */ { const CORE_ADDR pc = frame_pc_unwind (next_frame); CORE_ADDR start_addr; @@ -1740,8 +1733,12 @@ mips_insn16_frame_cache (struct frame_info *next_frame, void **this_cache) find_pc_partial_function (pc, NULL, &start_addr, NULL); if (start_addr == 0) start_addr = heuristic_proc_start (pc); + /* We can't analyze the prologue if we couldn't find the begining + of the function. */ + if (start_addr == 0) + return cache; - proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, *this_cache); + heuristic_proc_desc (start_addr, pc, next_frame, *this_cache); } /* SP_REGNUM, contains the value and not the address. */ @@ -1822,14 +1819,7 @@ mips_insn16_frame_base_sniffer (struct frame_info *next_frame) static struct mips_frame_cache * mips_insn32_frame_cache (struct frame_info *next_frame, void **this_cache) { - mips_extra_func_info_t proc_desc; struct mips_frame_cache *cache; - struct gdbarch *gdbarch = get_frame_arch (next_frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - /* r0 bit means kernel trap */ - int kernel_trap; - /* What registers have been saved? Bitmasks. */ - unsigned long gen_mask, float_mask; if ((*this_cache) != NULL) return (*this_cache); @@ -1838,7 +1828,7 @@ mips_insn32_frame_cache (struct frame_info *next_frame, void **this_cache) (*this_cache) = cache; cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); - /* Synthesize a proc descriptor. */ + /* Analyze the function prologue. */ { const CORE_ADDR pc = frame_pc_unwind (next_frame); CORE_ADDR start_addr; @@ -1846,16 +1836,14 @@ mips_insn32_frame_cache (struct frame_info *next_frame, void **this_cache) find_pc_partial_function (pc, NULL, &start_addr, NULL); if (start_addr == 0) start_addr = heuristic_proc_start (pc); + /* We can't analyze the prologue if we couldn't find the begining + of the function. */ + if (start_addr == 0) + return cache; - proc_desc = heuristic_proc_desc (start_addr, pc, next_frame, *this_cache); + heuristic_proc_desc (start_addr, pc, next_frame, *this_cache); } - if (proc_desc == NULL) - /* I'm not sure how/whether this can happen. Normally when we - can't find a proc_desc, we "synthesize" one using - heuristic_proc_desc and set the saved_regs right away. */ - return cache; - /* SP_REGNUM, contains the value and not the address. */ trad_frame_set_value (cache->saved_regs, NUM_REGS + MIPS_SP_REGNUM, cache->base); -- 2.34.1