lldb better shell support

  1. on OSX, the bash shell works fine inside lldb, but upon entering script (python), it starts breaking: arrow keys don’t work, etc so its impossible ot edit command line apart from using backspace key
  2. why not (optionally) support ascii codes to color the output (say, use different colors for (lldb) prompt, user commands and lldb outputs etc
  3. can python interpreter be configured? for example it would be nice to have ipython instead of python and have the bash completion enabled

(I’m using zsh if it matters)

1) on OSX, the bash shell works fine inside lldb, but upon entering script (python), it starts breaking: arrow keys don't work, etc so its impossible ot edit command line apart from using backspace key

We currently don't use any readline support inside of LLDB in the python interactive interpreter because we haven't had the time to implement it. It is trickier than it seems, but feel free to submit a patch that fixes this!

2) why not (optionally) support ascii codes to color the output (say, use different colors for (lldb) prompt, user commands and lldb outputs etc

We can, feel free to submit a patch. We have support for adding color codes to your thread and frame prompts:

http://lldb.llvm.org/formats.html

We could easily modify the prompt string to expand escape characters so you could do something like:

settings set prompt \033[0;33m(lldb)\033[0m

It would be nice to always feed the prompt string through Debugger::FormatPrompt() to allow for expansion of many things (like you saw in the formats.html web page). Again, feel free to submit a patch.

3) can python interpreter be configured? for example it would be nice to have ipython instead of python and have the bash completion enabled

The completion is done by the embedded interpreter and it currently isn't using readline as we can't assume the stdin/out/error for the interactive interpreter are coming from a terminal. It is possible to hook this up, we just haven't gotten to it. The class we used to drive our interactive interpreter is at:

lldb/source/Interpreter/embedded_interpreter.py

Feel free to submit any patches that enable readline functionality as we would love to have this.

Greg Clayton