Binary file: http://slonopotamus.org/libUE4Editor-Core.so (warning, 50MB)
GNU binutils gives correct result:
$ addr2line -e libUE4Editor-Core.so +0x2c09b2
/home/marat/production/ue4/Engine/Source/Runtime/Core/Private/Linux/LinuxPlatformCrashContext.cpp:595
elftoolchain gives incorrect result:
$ elftoolchain-0.7.1/addr2line/addr2line -e /home/marat/production/ue4/Engine/Binaries/Linux/libUE4Editor-Core.so +0x2c09b2
Runtime/Core/Public/Delegates/DelegateInstancesImpl.h:869
Err, I cannot edit ticket for some reason =/ Title should say "filename/lineno"
Additional info on various addr2line implementations misbehaving on this testcase: https://github.com/gimli-rs/addr2line/issues/35#issue-213881844
See attached patch. It fixes filename/lineno resolving for my testcase. I am not sure it doesn't break anything since my DWARF experience is just several days.
Thank you for the patch Marat. There's a minor issue with an unused variable warning when I built, but it addresses the issue and looks reasonable.
I think we will want to implement some caching / improved lookup; so I'm not sure about getting rid of the culist.
We should explicitly check that dwr_type is
DW_RANGES_ENTRYin the fallthrough case.Also I think we should refactor the address range lookup logic into a separate function because
translate()is getting rather long. If you'd like to have a go at that I'll review a new patch. (Otherwise I'll take care of it and commit.)WRT culist - I removed it because otherwise code would become even more compicated (I'm jumping out of ranges loop currently). Looking at other addr2line implementations, culist shouldn't be needed, all data about address is supposed to be in a single compile unit. Unused variable - will fixed that tomorrow. WRT refactoring - I'll try to extract range search function so it is reused for compilation units and functions.
See new attached patch. I introduced a separate function that performs range checking, although didn't use it in function name resolving yet, it will be part of ticket #546.
Last edit: Marat Radchenko 2017-03-19
Nooo, my fix is wrong. I haven't noticed that function names resolving uses "cu", now it is completely broken. Working on new iteration.
Any update on the new iteration?
Whoops, this somehow completely fell off from my todo-list. Will work on it this weekend.
Attached updated patch.
Note that it does not neither fix bug #546 nor bug #552
Finally committed to FreeBSD, will be upstreamed soon.