gdb 8.2 can’t recognized executable file on macOS Mojave 10.14

The problem is that clang-1000.11.45.2 distributed with Apple LLVM version 10.0.0 adds a new load command to o-mach executables named LC_BUILD_VERSION. $ otool -l test.o … Load command 1 cmd LC_BUILD_VERSION cmdsize 24 platform macos sdk n/a minos 10.14 ntools 0 … From the apple source: /* * The build_version_command contains the min OS version … Read more

C++ GDB Python Pretty Printing Tutorial?

Check out Tom Tromey’s pretty printing tutorials part 1 and part 2. There is also the libstdc++-v6 pretty printer implementation to look at, which is what I used myself as a template when I started out. A somewhat simpler example (as of this writing) is the Boost pretty printer by RĂ¼diger Sonderfeld.

GDB kind of doesn’t work on macOS Sierra

This is how I easily fixed the issue. [Update: based on feedback received and yet to be verified, it seems that this solution works with macOS Sierra 10.12 but not with macOS Sierra 10.12.2] See video instructions here Quit gdb Using your text editor e.g. Sublime Text, save a file called .gdbinit in your user … Read more

How to break when a specific exception type is thrown in GDB?

EDIT The documentation suggests that catch throw <exceptname> can be used to break whenever an exception of type <exceptname> is thrown; however, that doesn’t seem to work in practice. (gdb) help catch Set catchpoints to catch events. Raised signals may be caught: catch signal – all signals catch signal <signame> – a particular signal Raised … Read more

How to highlight and color gdb output during interactive debugging?

.gdbinit You can tweak your ~/.gdbinit to have colors. You can use mammon’s .gdbinit which is available here: https://github.com/gdbinit/gdbinit You can tweak it as much as you want too. I found this thanks to this SO answer. Here’s the kind of output that you can obtain: A GitHub repository is also available: https://github.com/gdbinit/Gdbinit On a … Read more