[lldb-dev] post-mortem debugging with lldb

René J.V. Bertin rjvbertin at gmail.com
Sat Nov 29 13:35:22 PST 2014


Hello,

I am trying to get KDE's crash reported ("DrKonqi") to work with lldb. This is part of KDE's runtime, and is designed to catch runtime exceptions (crashes). When they occur, a debugger is launched, instructed to connect to the failing process, and then to provide a backtrace.
Much like Apple's crash reporter, but more elaborate.

On systems with the GNU toolchain, the debugger used is gdb launced as

gdb -nw -n -batch -x %tempfile -p %pid %execpath

Where %pid is the crashed process ID, %execpath the full path to the binary, and %tempfile a batch file containing the commands

set width 200
thread
thread apply all bt

I currently have the following for using lldb:

lldb -s %tempfile -p %pid < /dev/null
%tempfile:
set set term-width 200
thread info
bt all
quit

The redirection from /dev/null is necessary because otherwise lldb will not respect the quit command (when read from a batch file; that must be a bug?)

In itself this works, except that I do not always get useful information. A full discussion can be found at https://git.reviewboard.kde.org/r/121286/ , and it shows an example where one can only "see back to when" the crash handler was invoked.
Sadly I cannot compare because I haven't (yet) been able to get gdb (from MacPorts) to be permitted to function on my 10.9 system, but the same system booted into 10.6.8 will work just fine with Apple's gdb.

Any useful suggestions on how best to do post-mortem debugging with lldb will be greatly appreciated!

René




More information about the lldb-dev mailing list