Bug 5259 - backtrace from x86 plt (aka solib trampoline) is wrong
Summary: backtrace from x86 plt (aka solib trampoline) is wrong
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Mark Wielaard
URL:
Keywords:
Depends on:
Blocks: 3076 5292 5959 5260
  Show dependency treegraph
 
Reported: 2007-11-02 16:22 UTC by Andrew Cagney
Modified: 2008-03-19 10:59 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Cagney 2007-11-02 16:22:19 UTC
(don't have an x86-64 machine handy) but here's the extract from a step-into the
solib function "write":

43*      print(char *what) {
44         while (*what != '\0') {
45           write(1, what, 1);
46           what++;

(fhpd) step
Task stopped at line 56 in file
/home/mark/src/git/frysk-obj/frysk-core/../../frysk/frysk-core/frysk/pkglibdir/funit-hello.c
(fhpd) where                            
#0 0x08048455 in __i686.get_pc_thunk.bx () from
/home/mark/src/git/frysk-obj/frysk-core/frysk/pkglibdir/funit-hello
#1 0x08048435 in main(int argc = < ERROR >,char * * argv = < ERROR >)
/home/mark/src/git/frysk-obj/frysk-core/../../frysk/frysk-core/frysk/pkglibdir/funit-hello.c#53
#2 0x001f1390 in __libc_start_main () from /lib/libc-2.7.so
#3 0x08048311 in _start () from
/home/mark/src/git/frysk-obj/frysk-core/frysk/pkglibdir/funit-hello
Comment 1 Mark Wielaard 2007-11-19 14:25:10 UTC
The issue here is that you would expect to be in the write() function itself and
not in the PLT entry table (contrast with stepi, which would do an instruction
step and so does want to get at the next instruction).

The simplest solution seems to be to make the Stepping Engine aware of the PLT
table and not stop when the address is inside that region.
Comment 2 Andrew Cagney 2007-11-19 14:54:00 UTC
This is a backtrace bug; not a stepping bug.
Comment 3 Mark Wielaard 2007-11-26 13:10:39 UTC
This isn't specific to x86_64, on both x86 and x86_64 this needs special treatment.
Comment 4 Mark Wielaard 2008-03-19 10:59:23 UTC
Fixed by:

commit cba040e1437a19ae0f0b21d560b13cb6d2091282
Author: Mark Wielaard <mwielaard@redhat.com>
Date:   Wed Mar 12 14:22:49 2008 +0100

    Implement libunwind fallback for plt frame. Fixes bug #5259 on x86.
    
    frysk-core/frysk/stack/ChangeLog
    2008-03-12  Mark Wielaard  <mwielaard@redhat.com>
    
           * TestLibFunctionStepFrame.java: Mark only unresolved on x86_64
           and ppc. Only check first 24 steps (bug #5917). Tighter check for
           main and foo order.
    
    frysk-imports/libunwind/ChangeLog
    2007-03-12  Mark Wielaard  <mwielaard@redhat.com>
    
           * src/x86/Gstep.c (is_call_instr_at): New function.
           (init_stack_based_ret): New function.
           (unw_step): Try stack based unwind with call instr, before
           fallback to frame pointer.

Tracking last remaining x86_64 issue in bug #5962