This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, Still working on this IRIX debugger on mips, the next big thing is that GDB is having problems unwinding the stack. For instance, using gdb.base/store: % gdb store (gdb) b wack_doublest (gdb) run (gdb) bt #0 wack_doublest (u=Unhandled dwarf expression opcode 0x93 ) at ./gdb.base/store.c:125 #1 0x100108d8 in ?? () warning: GDB can't find the start of the function at 0x100108d8. GDB is unable to find the start of the function at 0x100108d8 and thus can't determine the size of that function's stack frame. This means that GDB may be unable to access that stack frame, or the frames below it. This problem is most likely caused by an invalid program counter or stack pointer. However, if you think GDB should simply search farther back from 0x100108d8 for code which looks like the beginning of a function, you can increase the range of the search using the `set heuristic-fence-post' command. Previous frame inner to this frame (corrupt stack?) What happens is that GDB calls heuristic_proc_desc() to "synthesize" a procedure descriptor (I'll abbreviate: PDR). On IRIX, at least with N32, we end up calling mips32_heuristic_proc_desc(). As expected, this function scans the prologue, and computes the frame size, stores which registers are saved, etc. Unfortunately, it seems that we forgot to save one critical piece of information: *where* the registers are saved in the stack. Looking at mips_mdebug_frame_cache(), we see: 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) { cache->saved_regs[NUM_REGS + ireg].addr = reg_position; reg_position -= mips_abi_regsize (gdbarch); } But the thing is, we forgot to set the PROC_REG_OFFSET. This value is the distance between the frame base, and the start of the area where registers are saved. It can be computed when we detect the first register save instruction in the prologue by taking the difference between the offset to SP/FP used in the isntruction, and the frame size. The attached patch implements this, for mips32_heuristic_proc_desc(). I am about to launch the testsuite with this patch. I am guessing that mips16_heuristic_proc_desc() suffers from the same problem and will require the same adjustments. I am happy to fix it too, but it will be blind fixing as I won't be able to test it. Your call. 2004-07-22 Joel Brobecker <brobecker@gnat.com> * mips-tdep.c (mips_mdebug_frame_cache): Minor reformatting. (set_saved_reg_info): New function. (mips32_heuristic_proc_desc): Compute the procedure descriptor PROC_REG_OFFSET. Tested on mips-irix, fixes tons of regressions. OK to commit? If you would like me to fix mips16_heuristic_proc_desc as well, I can submit a separate patch. Thanks, -- Joel
Attachment:
mips-unwind.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |