This is the mail archive of the gdb-prs@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]

backtrace/1794: ppc lr offset is computed incorrectly


>Number:         1794
>Category:       backtrace
>Synopsis:       ppc lr offset is computed incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 18 14:58:02 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Lee Merrill
>Release:        6.1.1
>Organization:
>Environment:
Fedora core 1, i686
gdb configured with --target=powerpc-elf as a cross-debugger
>Description:
When doing a stack backtrace, skip_prologue() in rs6000-tdep.c can set the lr_offset element incorrectly. The lr register gets put in r0, which gets stored (lr_offset is correct), then gdb continues scanning the prologue, and sees that r0 gets stored again (this is from "int var = 0", where "var" is r0). This sets lr_offset again, this time incorrectly.

>How-To-Repeat:
Just do a stack backtrace when there is a function on the stack that has this prologue
>Fix:
The lim_pc variable may be incorrect, maybe gdb shouldn't scan past the prologue into local variable intializations. I fixed this by kludge, though, and changed the "if" near line 609 to be (adding "fdata->lr_offset == 0 &&")

    else if (lr_reg != -1 && fdata->lr_offset == 0 &&
        /* std Rx, NUM(r1) || stdu Rx, NUM(r1) */
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="prologue.txt"
Content-Disposition: inline; filename="prologue.txt"

    3d20:	94 21 ff d0 	stwu	r1,-48(r1)
    3d24:	7c 08 02 a6 	mflr	r0
    3d28:	7d 80 00 26 	mfcr	r12
    3d2c:	93 21 00 14 	stw	r25,20(r1)
    3d30:	93 41 00 18 	stw	r26,24(r1)
    3d34:	93 61 00 1c 	stw	r27,28(r1)
    3d38:	93 81 00 20 	stw	r28,32(r1)
    3d3c:	93 a1 00 24 	stw	r29,36(r1)
    3d40:	93 c1 00 28 	stw	r30,40(r1)
    3d44:	93 e1 00 2c 	stw	r31,44(r1)
    3d48:	90 01 00 34 	stw	r0,52(r1)
    3d4c:	91 81 00 10 	stw	r12,16(r1)
    3d50:	7c 7f 1b 78 	mr	r31,r3
    3d54:	7c 9c 23 78 	mr	r28,r4
    3d58:	7c b9 2b 78 	mr	r25,r5
    3d5c:	7c da 33 78 	mr	r26,r6
    u4byte evf, mask;
    void *timer = 0;
    3d60:	38 00 00 00 	li	r0,0
    3d64:	90 01 00 08 	stw	r0,8(r1)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]