This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
symtab/1939: gdb coredumps on -O1 compiled binary on x86_64
- From: tigran at veritas dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 6 May 2005 16:06:05 -0000
- Subject: symtab/1939: gdb coredumps on -O1 compiled binary on x86_64
- Reply-to: tigran at veritas dot com
>Number: 1939
>Category: symtab
>Synopsis: gdb coredumps on -O1 compiled binary on x86_64
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 06 16:08:01 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator: tigran@veritas.com
>Release: 6.3.50.20050506-cvs
>Organization:
>Environment:
SLES9 x86_64
>Description:
gdb coredumps on a simple test program (attached) when
it is compiled with -O1. Running gdb on the core file
shows the offending code to be in gdb/dwarf2loc.c:dwarf_expr_frame_base() function:
*length = symbaton->size;
Now, if the program is compiled with -O0 then everything
is fine. But if the program is compiled with -O2 then
some function arguments on the backtrace are shown
as "optimized away", which is understandable, but the
argument x9 passed to the top-level function kt_func3
is shown incorrectly. But I doubt this has anything to
do with the coredump I am reporting. Just a different bug.
>How-To-Repeat:
$ gcc -g -Wall uvar.c -O1 -o uvar
$ gdb uvar
(gdb) b kt_func3
(gdb) r
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="uvar.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="uvar.c"
I2luY2x1ZGUgPHN0ZGlvLmg+CgpzdHJ1Y3Qga3Rfc3RydWN0IHsKCWludCBrdF9maWVsZDE7Cglp
bnQga3RfZmllbGQyOwoJY2hhciBrdF9uYW1lWzE2XTsKfSBrdF92YXI7CgppbnQga3RfZnVuYzMo
aW50IHgxLCBpbnQgeDIsIGludCB4MywgaW50IHg0LCBpbnQgeDUsIGludCB4NiwgaW50IHg3LCBp
bnQgeDgsIGludCB4OSkKewoJcmV0d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