This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/18748] New: first instruction in each procedure isn't unwindable
- From: "davidm at hpl dot hp dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Dec 2004 02:41:59 -0000
- Subject: [Bug target/18748] New: first instruction in each procedure isn't unwindable
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I'm reporting this against x86_64-suse-linux since that's where I noticed the
problem first, but I believe the issue affects all platforms which use DWARF
unwind-info.
The problem is that when looking up unwind info when the instruction-pointer
(IP) points to X, we're actually looking up (X-1) in the unwind tables. The
motivation for this fudging is that X may never be reached (because of
non-return functions). Unfortunately, for the first instruction in a procedure,
looking up (X-1) may cause us to find the unwind-info for the preceeding
function which, in general, will give wrong results.
I see only two possible solutions:
(1) Change the compiler(s) so it emits a dummy (nop) instruction in front
of each procedure and include that (never-to-be-executed) dummy-instruction
as part of the unwind-info.
(2) Stop the IP-fudging. This occasionally requires emitting a dummy (nop)
instruction after invoking a no-return functions.
This problem can easily be reproduced by single-stepping through a program and
attempting to unwind after each instruction. The libunwind [1] package contains
a test-case for this which can be invoked like this:
tests/test-ptrace -c -n -t tests/test-ptrace-misc
In theory, this test should succeed with no error. Due to the above bug, it
will fail to unwind whenever execution reaches the first instruction in a procedure.
--david
[1] http://www.hpl.hp.com/research/linux/libunwind/
--
Summary: first instruction in each procedure isn't unwindable
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: davidm at hpl dot hp dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: x86_64-suse-linux
GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18748