Inspecting coredumps like it's 2021
nixos.mayflower.consulting
nixos.mayflower.consulting
Every time I have tried a different debugger, I have always ended up coming running back to GDB. My only gripes with it are basically gripes with DWARF.
Haven't checked if it is still available but I have it installed from long ago.
Did anyone try it? It looks like it a web frontend for rr, but the idea seems alien to me, especially the pricing part. A subscription for a number of submissions per month?! If there is anything you can't really plan, it is bugs, one month, you may need only one or two, the next it will be 50 in a day.
It’s more than merely a front–end for rr, because with rr you are still inspecting a single moment in time in your program. You can rewind to past moments any time you want, but that fundamental limitation remains. With Pernosco you are really querying a database that contains all the information about all the states your program was ever in. It’s a superpower that you can purchase.
I think the price is generally worth it, if you have at least a couple bugs to use it on every month. If you have more than 5 per month but don’t want to go up a tier, I believe you can pay “a la carte” just for the extras. If you have enough people, and you can afford the hardware to run it, I really recommend the on–premises installation.
It might be paranoia on someone's part, but I agree that it causes a lot of unnecessary privilege escalation for people who want to actually fix the problem.
This isn't true for +ACL builds of systemd, look at the output of `getfacl /var/lib/systemd/coredump/$foo` and you'll see.
(It could be that Fedora has done some special configuration and that it's not like this out of the box for upstream systemd)
It looks like coredumpctl might be suid? Or that the service is, and coredumpctl gets access through the service - so there's a certain elevation going on either way?
Coredumps and command line analysis with gdb by comparison leave much to be desired.
Clion has some support for core dumps, yet it is lagging behind msvs, ofc, but is slowly catching up.
Inspecting coredumps with command line gdb, feels like title should be ”like it’s 2001”. Because that’s when I learned gdb :P
GDB is still in wide use today and shows no sign of becoming history. If anything, its easy scripting features continues to prompt new tools based on GDB to pop up.
The stories have it that back in the days some people could read actual core dumps with the tips of their fingers à la Braille, but surely that's just an urban myth.
Also you can use another debugger of your choice with the `--debugger` flag.
It's very common to strip debug symbols from packages. For Ubuntu, it's even a different repository! I fail to see why that's astonishing.
The problem with NixOS is that it doesn’t ship debug symbols at all.
Nix does at least make it easy to rebuild a package with debug symbols enabled, but:
- Some packages take a very long time to rebuild.
- IIUC, the standard builds are done without debug info enabled at all, rather than building with it enabled and then deleting it. Usually, whether debug info is enabled shouldn’t affect any other aspects of code generation, so rebuilding with debug info should produce a symbol-rich binary that’s compatible with existing core dumps for the original binary. But this is not always the case.
- If the package you want debug info for is a library, Nix will want to rebuild not just the library itself but everything that (transitively) depends on it. This is really a more general problem with Nix: it has zero notion of ABI compatibility. But always building with debug info would work around the problem.
Based on that, you shouldn't need the debug symbols in advance, though ymmv, when trying to debug an issue in container A on dev machine B.
objcopy --only-keep-debug foo.o foo.o.debug
objcopy --strip-debug --add-gnu-debuglink=foo.o.debug foo.o
And then link foo.o as normal. GDB should automatically be able to pick up the debug file by looking at the debug link.For more info, here's a link:
https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Fil...
You can also use gcc's -gsplit-dwarf command line option when compiling to produce a .dwo file containing your debug information:
https://randomascii.wordpress.com/2013/02/20/symbols-on-linu...
The debug symbol packages are usually called -dbgsym (Ubuntu, Debian, ...) or -debuginfo (openSUSE, Fedora).
This has been done automatically for almost a decade in most distros' packaging systems. GDB usually tells you what are the names of the debug packages you need to install for whatever you are trying to debug.
The "distro repository of files that the debugger can download as needed" is called a debuginfod URL. E.g., for Debian : https://debuginfod.debian.net/ , openSUSE : https://debuginfod.opensuse.org/ , etc. This is a more recent development and distros are just starting to turn it on by default. But if enabled you'll basically see GDB start downloading symbol files automatically ala Windows when you run it. It even downloads the source code as it goes.
Personally I think the latter is a security risk (since it sends to a server the hash/build-id of everything you try to debug), but I can't argue it's not convenient.