[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/629] New: Addr2line reports function name that is inconsis

From: fnf at specifixinc dot com
Subject: [Bug binutils/629] New: Addr2line reports function name that is inconsistent with file/line info
Date: 31 Dec 2004 16:51:18 -0000

Currently addr2line reports inconsistent values for the function name
and file+line info for inlined functions.  For example, consider:

  int add2 (int a, int b)
    return (a + b);

  inline int add3 (int a, int b, int c)
    return (a + add2 (b , c));

  main ()
    printf ("%d\n", add3 (2, 3, 4));


  /usr/bin/gcc -g -O2 -o t t.c
  /usr/bin/readelf --debug-dump t >t.dwarf
  /usr/bin/objdump --disassemble t >t.dis

Examine the t.dwarf file to ensure that you have a dwarf entry that
looks something like:

 <2><ec>: Abbrev Number: 13 (DW_TAG_inlined_subroutine)
     DW_AT_abstract_origin: <5f>
     DW_AT_low_pc      : 0x8048398
     DW_AT_high_pc     : 0x80483a4

The generated code for my test run, with the inlined subroutine
marked with '***' is:

        0804838c <main>:
         804838c:       55                      push   %ebp
         804838d:       89 e5                   mov    %esp,%ebp
         804838f:       83 ec 08                sub    $0x8,%esp
         8048392:       83 e4 f0                and    $0xfffffff0,%esp
         8048395:       83 ec 10                sub    $0x10,%esp
  ***    8048398:       6a 04                   push   $0x4
  ***    804839a:       6a 03                   push   $0x3
  ***    804839c:       e8 c7 ff ff ff          call   8048368 <add2>
  ***    80483a1:       83 c0 02                add    $0x2,%eax
         80483a4:       50                      push   %eax
         80483a5:       68 94 84 04 08          push   $0x8048494
         80483aa:       e8 01 ff ff ff          call   80482b0 <address@hidden>
         80483af:       c9                      leave
         80483b0:       c3                      ret

With an unpatched addr2line you get:

  $ /usr/bin/addr2line -f -e t 8048398

I have a patch that fixes this and will try to attach it to the bug report.
With this patch I get:

  $ addr2line -f -e t 8048398

           Summary: Addr2line reports function name that is inconsistent
                    with file/line info
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: fnf at specifixinc dot com
                CC: bug-binutils at gnu dot org,fnf at specifixinc dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]