public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/18748] New: first instruction in each procedure isn't unwindable
@ 2004-12-01  2:42 davidm at hpl dot hp dot com
  2004-12-01  2:48 ` [Bug target/18748] " pinskia at gcc dot gnu dot org
  2005-06-19 14:39 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: davidm at hpl dot hp dot com @ 2004-12-01  2:42 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/18748] first instruction in each procedure isn't unwindable
  2004-12-01  2:42 [Bug target/18748] New: first instruction in each procedure isn't unwindable davidm at hpl dot hp dot com
@ 2004-12-01  2:48 ` pinskia at gcc dot gnu dot org
  2005-06-19 14:39 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-01  2:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-01 02:48 -------
I would at least try against a 3.4.x based compiler.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18748


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/18748] first instruction in each procedure isn't unwindable
  2004-12-01  2:42 [Bug target/18748] New: first instruction in each procedure isn't unwindable davidm at hpl dot hp dot com
  2004-12-01  2:48 ` [Bug target/18748] " pinskia at gcc dot gnu dot org
@ 2005-06-19 14:39 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-19 14:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-19 14:39 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|x86_64-suse-linux           |
   GCC host triplet|x86_64-suse-linux           |
 GCC target triplet|x86_64-suse-linux           |x86_64-*
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-19 14:39:27
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18748


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/18748] first instruction in each procedure isn't unwindable
       [not found] <bug-18748-1013@http.gcc.gnu.org/bugzilla/>
@ 2006-06-12 15:32 ` matz at gcc dot gnu dot org
  0 siblings, 0 replies; 4+ messages in thread
From: matz at gcc dot gnu dot org @ 2006-06-12 15:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from matz at gcc dot gnu dot org  2006-06-12 14:40 -------
Is this still a problem David?  On x86_64 the libunwind-0.98.5 doesn't work
for ptrace (missing implemented functions), so I can't reproduce anything
on that platform.  And on ia64-linux with a 4.1.x compiler test-ptrace
doesn't spit out any errors.


-- 

matz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matz at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18748


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-12 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-01  2:42 [Bug target/18748] New: first instruction in each procedure isn't unwindable davidm at hpl dot hp dot com
2004-12-01  2:48 ` [Bug target/18748] " pinskia at gcc dot gnu dot org
2005-06-19 14:39 ` pinskia at gcc dot gnu dot org
     [not found] <bug-18748-1013@http.gcc.gnu.org/bugzilla/>
2006-06-12 15:32 ` matz at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).