public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug libdw/28148] New: eu-addr2line reports function name of the caller when code is inlined
@ 2021-07-28 12:30 n2knqf5ogu at bsogq dot anonbox.net
  2023-10-06 11:29 ` [Bug libdw/28148] " mark at klomp dot org
  2023-11-02 13:30 ` mark at klomp dot org
  0 siblings, 2 replies; 3+ messages in thread
From: n2knqf5ogu at bsogq dot anonbox.net @ 2021-07-28 12:30 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28148

            Bug ID: 28148
           Summary: eu-addr2line reports function name of the caller when
                    code is inlined
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libdw
          Assignee: unassigned at sourceware dot org
          Reporter: n2knqf5ogu at bsogq dot anonbox.net
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Created attachment 13570
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13570&action=edit
Binary to reproduce described bug with eu-addrline

For inlined code addr2line from binutils reports the function name of the
inlined function. eu-addrline from elfutils, on the other hand, reports the
function name of the function where the code was inlined (i.e. the caller).
However, similar to addr2line, eu-addrline reports the file name of the file
where the inlined code is defined. Which is very confusing as **the eu-addrline
output reports a function name which is not defined in the reported file** for
this reason.

Compare the following elfutils-0.185 and binutils-2.35 output for the attached
RISC-V binary:

    $ eu-addr2line -f -e inlined-bug.elf 20400e10
    __atomic_fetch_and_4
    /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62:5

    $ addr2line -f -e inlined-bug.elf 20400e10
    irq_disable
    /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62

The binutils output is correct, the irq_disable function is inlined at address
20400e10 (in the caller __atomic_fetch_and_4) and the irq_disable function is
defined in /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h. The
elfutils output on the other hand is confusing as __atomic_fetch_and_4 is not
defined in /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h.

I noticed this while using
dwfl_module_getsrc/dwfl_lineinfo/dwfl_module_addrname in my own code, the
addr2line example just makes it easier to reproduce this issue. From a library
standpoint I find it confusing how inlined functions are presently handled in
libdwfl as it is often unclear if a libdwfl function returns information about
the caller or the inlined function in such cases.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libdw/28148] eu-addr2line reports function name of the caller when code is inlined
  2021-07-28 12:30 [Bug libdw/28148] New: eu-addr2line reports function name of the caller when code is inlined n2knqf5ogu at bsogq dot anonbox.net
@ 2023-10-06 11:29 ` mark at klomp dot org
  2023-11-02 13:30 ` mark at klomp dot org
  1 sibling, 0 replies; 3+ messages in thread
From: mark at klomp dot org @ 2023-10-06 11:29 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28148

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Is this still an issue?

With binutils addr2line 2.39 I get:

$ addr2line -f -e inlined-bug.elf 20400e10
irq_disable
/home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62

And with eu-addr2line 0.189:

$ eu-addr2line -f -e inlined-bug.elf 20400e10
irq_disable inlined at /home/john/src/RIOT/core/atomic_c11.c:212:1 in
__atomic_fetch_and_4
/home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62:5

$ eu-addr2line -a --pretty-print -i -f -e inlined-bug.elf 20400e10
0x20400e10: irq_disable at
/home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62:5
 (inlined by) __atomic_fetch_and_4 at
/home/john/src/RIOT/core/atomic_c11.c:212:1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libdw/28148] eu-addr2line reports function name of the caller when code is inlined
  2021-07-28 12:30 [Bug libdw/28148] New: eu-addr2line reports function name of the caller when code is inlined n2knqf5ogu at bsogq dot anonbox.net
  2023-10-06 11:29 ` [Bug libdw/28148] " mark at klomp dot org
@ 2023-11-02 13:30 ` mark at klomp dot org
  1 sibling, 0 replies; 3+ messages in thread
From: mark at klomp dot org @ 2023-11-02 13:30 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28148

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Mark Wielaard from comment #1)
> Is this still an issue?
> 
> With binutils addr2line 2.39 I get:
> 
> $ addr2line -f -e inlined-bug.elf 20400e10
> irq_disable
> /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62
> 
> And with eu-addr2line 0.189:
> 
> $ eu-addr2line -f -e inlined-bug.elf 20400e10
> irq_disable inlined at /home/john/src/RIOT/core/atomic_c11.c:212:1 in
> __atomic_fetch_and_4
> /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62:5
> 
> $ eu-addr2line -a --pretty-print -i -f -e inlined-bug.elf 20400e10
> 0x20400e10: irq_disable at
> /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62:5
>  (inlined by) __atomic_fetch_and_4 at
> /home/john/src/RIOT/core/atomic_c11.c:212:1

Assuming this is now fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-11-02 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 12:30 [Bug libdw/28148] New: eu-addr2line reports function name of the caller when code is inlined n2knqf5ogu at bsogq dot anonbox.net
2023-10-06 11:29 ` [Bug libdw/28148] " mark at klomp dot org
2023-11-02 13:30 ` mark at klomp 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).