Bug 217736 - addr2line incorrectly resolves filename/lineno/function
Summary: addr2line incorrectly resolves filename/lineno/function
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
Depends on:
Blocks: 231027
  Show dependency treegraph
Reported: 2017-03-13 08:54 UTC by Marat Radchenko
Modified: 2020-02-12 21:58 UTC (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Marat Radchenko 2017-03-13 08:54:28 UTC
Way to reproduce:

1. fetch http://slonopotamus.org/libUE4Editor-Core.so (warning, 50MB)
2. addr2line -f -e libUE4Editor-Core.so +0x2c09b2

Expected output,given by addr2line from GNU binutils and gdb (and I in fact know that this is what I want to get):


Actual output:


I have already reported this to elftoolchain project, though am not sure whether I should (not) also report this to FreeBSD.

For the reference, elftoolchain bug reports (note that it crashes with -f, unlike FreeBSD addr2line):

Comment 1 Marat Radchenko 2017-03-13 20:06:58 UTC
Additional info on various addr2line implementations misbehaving on this testcase: https://github.com/gimli-rs/addr2line/issues/35#issue-213881844
Comment 2 Marat Radchenko 2017-03-17 20:25:48 UTC
I've sent a patch to elftoolchain that fixes filename/lineno resolving: https://sourceforge.net/p/elftoolchain/tickets/545/#6d97 although elftoolchain devs seem to be reacting kinda slowly.
Comment 3 Marat Radchenko 2017-03-17 20:26:49 UTC
Also, gimli (Rust addr2line implementation) was fixed and is now consistent with binutils and llvm-symbolizer. So it seems like my testcase is valid, it's addr2line implementations misbehaving.
Comment 4 Ed Maste freebsd_committer 2017-03-17 22:22:06 UTC
(In reply to Marat Radchenko from comment #2)
Thank you for the patch - I've replied with a few comments over there. We should be able to get this into FreeBSD in the next few days.
Comment 5 commit-hook freebsd_committer 2020-02-12 21:52:33 UTC
A commit references this bug:

Author: emaste
Date: Wed Feb 12 21:52:10 UTC 2020
New revision: 357844
URL: https://svnweb.freebsd.org/changeset/base/357844

  addr2line: Handle DW_AT_ranges in compile units

  Based on original submission by Marat Radchenko in ELF Tool Chain
  ticket #545, rebased and updated by Tiger Gao.

  PR:		217736
  Submitted by:	Marat Radchenko <marat@slonopotamus.org>
  Submitted by:	Tiger Gao <tig@freebsdfoundation.org>
  Reviewed by:	markj
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D23501