News for hackers. Stuff that matters.
Re:How to build highly-debuggable C++ binaries by mark_undoio on Monday July 29, 2024 @01:23PM (#41102048)
If you're on *NIX have you tried just invoking gstack or similar as an external process? https://linux.die.net/man/1/gstack

Or, indeed, getting a core dump and applying GDB to it. GDB seems generally pretty good at reconstructing stacks at arbitrary points in application runtime.

We've also used a combination of libunwind and https://linux.die.net/man/1/addr2line to produce good crash dumps when GDB is not necessarily available.

Re:How to build highly-debuggable C++ binaries by jeffbee on Monday July 29, 2024 @01:27PM (#41102075)
To which of the projects that are all named "libunwind" do you refer?
Re:How to build highly-debuggable C++ binaries by mark_undoio on Monday July 29, 2024 @01:37PM (#41102167)
This one, I believe: https://github.com/libunwind/libunwind

ETA: Thinking about it, I'm not really sure what it'd do for C++ - I guess you'd end up with mangled names, so if you want sensible names you might need to demangle (either as a post-processing step or within the dumper) too.

I don't think you'll get any decoded argument values out of it either, so I guess it depends what backtrace info is needed.