LLDB has a bunch of code that implements REPL support, but all that code is unreachable as no language
in master currently has an implemented REPL backend. The only REPL that exists is in the downstream
Swift fork. All patches for this generic REPL code therefore also only have tests downstream which is
clearly not a good situation.
This patch implements a basic C language REPL on top of LLDB's REPL framework. Beside implementing
the REPL interface and hooking it up into the plugin manager, the only other small part of this patch
is making the --language flag of the expression command compatible with the --repl flag. The --repl
flag uses the value of --language to see which REPL should be started, but right now the --language
flag is only available in OptionGroups 1 and 2, but not in OptionGroup 3 where the --repl flag is
declared.
The REPL currently can currently only start if a running target exists. I'll add the 'create and run a dummy executable'
logic from Swift (which is requires when doing lldb --repl) when I have time to translate all this logic
to something that will work with Clang.
I should point out that the REPL currently uses the C expression parser's approach to persistent variables
where only result variables and the ones starting with a '$' are transferred between expressions. I'll fix
that in a follow up patch. Also the REPL currently doesn't work in a non-interactive terminal. This seems to
be fixed in the Swift fork, so I assume one of our many REPL downstream changes addresses the issue.
Doxygen comment(s)?