Search code examples
c++exceptionlldb

print callstack on every C++ exception throw in lldb


I'm using lldb and I'd like to catch all C++ based exceptions and print the callstack of the current thread for each breakpoint automatically, and continue.

This will stop on all exceptions break set -E C++, but how can set an automation that will print the callstack (bt command) and automatically continue?

Thnaks


Solution

  • These are all available as options to the break set command (see help break set for even more options). You want:

    break set -E C++ -G 1 -C "bt"
    

    You can also change the commands on a breakpoint after creation with the breakpoint command add command.