Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.301 diff -u -p -r1.301 mips-tdep.c --- mips-tdep.c 10 Jul 2004 01:17:52 -0000 1.301 +++ mips-tdep.c 22 Jul 2004 22:04:56 -0000 @@ -1587,9 +1587,9 @@ mips_mdebug_frame_cache (struct frame_in /* Fill in the offsets for the registers which gen_mask says were saved. */ { - CORE_ADDR reg_position = (cache->base - + PROC_REG_OFFSET (proc_desc)); + CORE_ADDR reg_position = (cache->base + PROC_REG_OFFSET (proc_desc)); int ireg; + for (ireg = MIPS_NUMREGS - 1; gen_mask; --ireg, gen_mask <<= 1) if (gen_mask & 0x80000000) { @@ -1851,6 +1851,23 @@ set_reg_offset (CORE_ADDR *saved_regs, i } } +/* Record in the procedure descriptor INFO the fact that register REGNO + was saved at OFFSET bytes from the procedure descriptor frame register. + Also updates the offset between the frame base and the area in the stack + where the registers are stored. */ + +static void +set_saved_reg_info (struct mips_extra_func_info *info, + int regno, int offset) +{ + /* If this is the first register saved, then OFFSET points to + the begining of the stack where the registers are saved. + We can use this to compute the PROC_REG_OFFSET of this frame. */ + if (PROC_REG_MASK (info) == 0) + PROC_REG_OFFSET (info) = offset - PROC_FRAME_OFFSET (info); + + PROC_REG_MASK (info) |= 1 << regno; +} /* Test whether the PC points to the return instruction at the end of a function. */ @@ -2179,14 +2196,14 @@ restart: } else if ((high_word & 0xFFE0) == 0xafa0) /* sw reg,offset($sp) */ { - PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; + set_saved_reg_info (&temp_proc_desc, reg, low_word); set_reg_offset (temp_saved_regs, reg, sp + low_word); } else if ((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */ { /* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra. */ - PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; + set_saved_reg_info (&temp_proc_desc, reg, low_word); set_reg_offset (temp_saved_regs, reg, sp + low_word); } else if (high_word == 0x27be) /* addiu $30,$sp,size */ @@ -2236,7 +2253,7 @@ restart: } else if ((high_word & 0xFFE0) == 0xafc0) /* sw reg,offset($30) */ { - PROC_REG_MASK (&temp_proc_desc) |= 1 << reg; + set_saved_reg_info (&temp_proc_desc, reg, low_word); set_reg_offset (temp_saved_regs, reg, frame_addr + low_word); } }