Comments (5)
Breakpad has some code for handling this sort of thing that might be useful. On Linux if you run dump_syms on a binary that has been stripped but contains a .gnu_debuglink we hit these code paths:
https://chromium.googlesource.com/breakpad/breakpad/+/master/src/common/linux/dump_symbols.cc#802
https://chromium.googlesource.com/breakpad/breakpad/+/master/src/common/linux/dump_symbols.cc#958
They require passing the debug directories to search on the dump_syms commandline, though. I don't know that there's a standard way to locate that.
Nowadays all binaries have a build id in the ELF headers, which you can also use for lookup, which might be the simpler path. You can take a build id abcdefg
and look for the symbol file at /usr/lib/debug/.build-id/ab/cdefg.debug
.
Breakpad has code for reading build ids from ELF headers, but not for locating debug symbols based on them:
https://dxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc#64
For finding debug symbols that aren't installed...there's not a really good story here. Fedora has a thing called Darkserver that will let you find RPMs by build id, but there's no equivalent that I know of for Ubuntu.
On Mac, there's some code for locating the actual file inside of a dSYM bundle:
https://chromium.googlesource.com/breakpad/breakpad/+/master/src/common/mac/dump_syms.cc#131
...but you have to pass the paths to the binary and the dSYM on the dump_syms commandline, it won't locate the dSYM for you:
https://chromium.googlesource.com/breakpad/breakpad/+/master/src/tools/mac/dump_syms/dump_syms_tool.cc#113
LLDB has support for locating dSYM bundles by way of DebugSymbols.framework
:
http://lldb.llvm.org/symbols.html
That's a private framework and I can't find any documentation on it, but it's a thing that exists. It even has support for "run a script to fetch symbols on-demand", which is neat. (I keep meaning to make that work with Mozilla's symbol server.)
I've seen references to using Spotlight for locating dSYMs, specifically the command mdfind "com_apple_xcode_dsym_uuids == <UUID>"
. It looks like Spotlight will index dSYMs by UUID for quick lookup. There seem to be APIs for doing these queries as well, which would be nicer than shelling out:
https://developer.apple.com/library/content/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/Introduction.html#//apple_ref/doc/uid/TP40001843-BBCFBCAG
https://developer.apple.com/reference/coreservices/1658109-mdquery
from locate-dwarf.
I wrote a little tool using addr2line
and wound up needing something like this, so I've got an implementation of most of the stuff to use the Spotlight APIs to find dSYM files. It needs a little cleanup, but I'll submit it as a PR soon.
from locate-dwarf.
http://lldb.llvm.org/symbols.html mentions a DebugSymbols.framework
we might be able to use on MacOS.
from locate-dwarf.
👍 thanks for this!
from locate-dwarf.
@luser just realized I never thanked you for this knowledge dump -- thank you very much!
from locate-dwarf.
Related Issues (8)
- Replace usage of CoreFoundation-sys with core-foundation HOT 2
- Bring this crate up to a releaseable state HOT 4
- Finding dSYM file on macOS can be very slow HOT 3
- Migrate CI to GitHub Actions HOT 1
- anyhow Errors make it difficult to use this crate HOT 8
- Support for PE -> PDB lookup HOT 4
- Panic when used on binaries that are in a "target" directory without deps / examples subdirectories
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from locate-dwarf.