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, Using break.exp, we have a function marker2 defined in break1.c as follow (sic): int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ Because the entire declaration is on one single line, the function that skips prologue can not use the line number information from debugging data (sparc32_skip_prologue()): /* This is the preferred method, find the end of the prologue by using the debugging information. */ if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end)) { sal = find_pc_line (func_start, 0); if (sal.end < func_end && start_pc <= sal.end) return sal.end; } So sparc32_skip_prologue() fallsback to sparc_analyze_prologue(). Unfortunately, this function recognizes the prologue instructions only up to the "save" instruction. But the prologue of a function can contain store instructions that home the input registers into their stack location. This is the case of our function marker2 above: (gdb) disass &marker2 Dump of assembler code for function marker2: 0x00010aa8 <marker2+0>: save %sp, -112, %sp 0x00010aac <marker2+4>: st %i0, [ %fp + 0x44 ] 0x00010ab0 <marker2+8>: mov 1, %g1 0x00010ab4 <marker2+12>: mov %g1, %i0 0x00010ab8 <marker2+16>: nop 0x00010abc <marker2+20>: ret 0x00010ac0 <marker2+24>: restore End of assembler dump. A visible consequence of this problem is that GDB will insert a breakpoint inside marker2 one instruction too earlier, and hence just before parameter a has been homed. And that causes the following FAIL in the GDB testsuite: (gdb) PASS: gdb.base/break.exp: run until file:function(1) breakpoint continue Continuing. 720 Breakpoint 2, 0x00010aac in marker2 (a=720) at break1.c:41 41 int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */ (gdb) FAIL: gdb.base/break.exp: run until quoted breakpoint The value for parameter a is incorrect, it should be 43. This test used to pass with 5.3. Doing a bit of archeology, I discovered that the code analyzing problogues has been heavily rewritten at the end of 2003, and that the piece of code that handles these store insns got lost during one large code rewrite. Assuming this was an accident, I put the code back more or less blindly. I did exclude the part of the code that recognizes an instruction adding and offset to sp, as I haven't seen evidences that this is needed, and removed one if block that could only be executed in that case. But I'd be happy to put the entire code back, if it is felt more appropriate. 2004-11-26 Joel Brobecker <brobecker@gnat.com> * sparc-tdep.c (sparc_analyze_prologue): Recognize certain store instructions following the save instructions as part of the prologue. Tested on sparc-solaris 2.8, with GCC (based on a 3.4.x backend). Fixes: . break.exp: run until quoted breakpoint (the case I used to study the problem) . funcargs.exp: print *stp Ok to apply? Thanks, -- Joel
Attachment:
prologue.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |