Friday 19 December 2014

Programming with LLDB

Some notes on poking around with LLDB programatically.

Build

Building on OSX was a bit of a pain - use `./configure` then `make` as suggested here, but to build the debugserver you need to open and build debugserver from tools/debugserver. You'll need to set up code signing like this.

LLDB Text API

Start with  `lldb`

Has a Complete API - complex to parse responses programatically, no way to tie a response to the commnd that triggered it.

A ruby example invoking the lldb text api https://gist.github.com/jorj1988/e6c3df64199b6932f39d

LLDB Machine Interface

Start with `lldb-mi --interpreter`

Incomplete API (seemed to be missing a reasonable amount of commands?), easier to tie responses to commands. Still requires parsing. 


C++ Interface

Include `include/lldb/API`, link to `liblldb.dylib`

Has a stable api here. Example here.


Python Interface

Mirrors C++ API. Example of usage here.


Summary

The python API seem like the most sensible option for interacting with LLDB... But I don't think I want to program a large project in python - maybe C++?