Hacker News new | ask | show | jobs
by awalton 3155 days ago
Use build-id (https://fedoraproject.org/wiki/Releases/FeatureBuildId), strip the debug info into its own object file, and point gdb at your debug objects when it comes time to debug.

Lean distributable binaries, yet still debugable. Win-win.

1 comments

And ideally you just put all the debug info files on a server where they can be indexed by the build ID, and the debugger automatically tries to fetch the relevant debug info files when debugging a process or core dump. This is easy on Windows since dbghelp.dll (on top of which most debuggers are built) lets you put symbol server URLs in the symbol path list and it will automatically look up GUIDs there and cache downloaded PDBs locally for reuse. As far as I know, there still isn't a turn-key equivalent with GDB, but you could probably rig something up with Python scripting?

The next step up in convenience is having the source-level debugger understand how to fetch the corresponding source files from a server based on revision IDs or content hashes.

Between those two features, you can open a core dump on any machine, and immediately have access to both debug info and source without manually mucking around with anything. If you spend a lot of time looking at core dumps from a myriad of different programs and versions of those programs, this is a lifesaver.