Search code examples
llvmlldb

Is there a data structure or class in LLDB to store the commands which typed from command line?


For some reasons I need to analysis the commands typed from stdin,eg:"br s -f hello.cpp -l 4". but I find it is hard to get where these commands stored in LLDB.


Solution

  • The lldb command command history will dump all the commands typed into the current lldb session. There isn't an SB API to get at this information in a structured form, but the command output is pretty parseable, and using SBCommandInterpreter.HandleCommand you can programmatically acquire command results.

    It looks like command history doesn't capture multi-line entry (for instance when entering multi-line expr expressions) though that's more of an oversight than a feature.

    lldb also populates the editline store with the commands that have been entered. There are editline API's to get that out, so you might be able to get at that from Python.