Closed ja2142 closed 1 year ago
It still write unusable addresses for stripped pie shared libraries. If I'm not mistaken.
I just realized I've only fixed converting whole frame to string, source_line()
, source_file()
etc. probably still won't work for pie binaries. I'll try to get it fixed somewhen today.
@raidenluikang well, exported symbols (I guess those that are visible in objdump -T <binary>
?) should probably be visible, doesn't matter if binary is stripped or not (and they are in my simple tests). Non-exported functions would require debug symbols to have names in a stacktrace.
Many thanks for the great work!
addr2line
can't translate addresses from position independent binaries, it needs offsets from binary base. Here it's achieved by reading/proc/self/maps
(to be honest, I don't know how portable exactly that is, but judging from the fact that/proc/self/exe
is read, that is not a huge concern?).Most likely doesn't work with C++03, I can try to fix it if needed.
I'm not sure, but it might fix #97 or #113.
There's a commented out line
It's likely that it'd work in more cases with my fix, if offsets from binary image base were passed to
addr2line
- in that case, I think it might be wise to just use it as it was before, and get both function name and file info fromaddr2line
, as it seems to be more robust thandladdr
(addr2line
should work for all binaries with debug info, whiledl
functions probably only work for exported symbols (and non-pie binaries, for some reason); maybedladdr
should still be left as a fallback).