-
Notifications
You must be signed in to change notification settings - Fork 262
Symbolication of system libraries is incorrect on macOS #318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is this with the dladdr fallback removed? |
Heh yes, but for the wrong reasons. As of today gimli doesn't even attempt to symbolize symbols from system libraries because, at least on my system, they're all fat libraries and that isn't supported. So today this appears to work with gimli (running the above shows |
Also, to write down some more of what I'm seeing.
Currently we lookup |
This lldb code looks similar to the problem you are seeing. |
This commit fixes an issue where symbolication of system libraries didn't work on macOS. Symbolication through the symbol table was always off by a slide amount for the library. It's not entirely clear why this kept happening or what was going on, but some poking in LLDB's source revealed a way we can differentiate and figure out what addresses need to be looked up in the symbol table. Some more information is contained in the comments of the commit itself. Closes #318
Ok given that LLDB code I've cooked up 6a30541 which I believe should fix this. |
This commit fixes an issue where symbolication of system libraries didn't work on macOS. Symbolication through the symbol table was always off by a slide amount for the library. It's not entirely clear why this kept happening or what was going on, but some poking in LLDB's source revealed a way we can differentiate and figure out what addresses need to be looked up in the symbol table. Some more information is contained in the comments of the commit itself. Closes #318
This commit fixes an issue where symbolication of system libraries didn't work on macOS. Symbolication through the symbol table was always off by a slide amount for the library. It's not entirely clear why this kept happening or what was going on, but some poking in LLDB's source revealed a way we can differentiate and figure out what addresses need to be looked up in the symbol table. Some more information is contained in the comments of the commit itself. Closes #318
This commit fixes an issue where symbolication of system libraries didn't work on macOS. Symbolication through the symbol table was always off by a slide amount for the library. It's not entirely clear why this kept happening or what was going on, but some poking in LLDB's source revealed a way we can differentiate and figure out what addresses need to be looked up in the symbol table. Some more information is contained in the comments of the commit itself. Closes #318
This is actually both an issue with libbacktrace and gimli today, but this program:
generates this for libbacktrace:
and this for gimli-symbolize:
Both of these symbolications are incorrect. According to LLDB it should be
_pthread_start
.I've been trying to debug this and I can't figure out what's going on. I believe this entirely has to do with looking up an address in the symbol table of an executable (not related to debuginfo). The address from the backtrace goes through some mappings to try to get an address to lookup in the symbol table.
The gimli impl correctly finds that it's placed in a segment of the
libsystem_pthread.dylib
system library, but the lookup in the symbol table effectively fails and__pthread_keys
is just the closest symbol.In terms of values we're looking up 0x7fff6f853109, but inside of
libsystem_pthread.dylib
the symbols are all "located" at very small addresses. The symbol table entry for_pthread_start
is 0x6075. Additionally the "bias" or load address forlibsystem_pthread.dylib
is also small-ish, it's 0x8547000.What I can't figure out is that
bias + segment_addr + symbol_table_addr =~ actual_address
. When we lookup in the symbol table, though, we're looking foractual_addres - bias
, we don't factor in the segment's address. I'm not really sure why, but if we do indeed take it into account then all other symbols in the main executable don't resolve.In any case I wanted to write this down as an issue. I suspect that something isn't being accounted for in the load commands or something like that. I've tried poring over the source of some dyld stuff but I'm not really coming up with much.
The text was updated successfully, but these errors were encountered: