GithubHelp home page GithubHelp logo

Notes... about locate-dwarf HOT 5 OPEN

fitzgen avatar fitzgen commented on July 20, 2024
Notes...

from locate-dwarf.

Comments (5)

luser avatar luser commented on July 20, 2024 1

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.

luser avatar luser commented on July 20, 2024 1

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.

fitzgen avatar fitzgen commented on July 20, 2024

http://lldb.llvm.org/symbols.html mentions a DebugSymbols.framework we might be able to use on MacOS.

from locate-dwarf.

kamalmarhubi avatar kamalmarhubi commented on July 20, 2024

👍 thanks for this!

from locate-dwarf.

fitzgen avatar fitzgen commented on July 20, 2024

@luser just realized I never thanked you for this knowledge dump -- thank you very much!

from locate-dwarf.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.