[Lldb-commits] [PATCH] D47232: Break dependency from Expression -> Commands
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Wed May 23 10:23:24 PDT 2018
The expression command had two modes before introducing the REPL. You can do:
(lldb) expr -- some C expression
or you can do:
Enter expressions, then terminate with an empty line to evaluate:
1: first C expression
2: Second C Expression
The second only differs from the first in that it pushes an IOHandler to deal with gathering the entered text that the user typed up to the point where they type an empty expression.
The repl adds a third mode:
(lldb) expr -r --
1> let a = 10
a: Int = 10
Which works the same as "expr --toplevel" with the addition of a fancier IOHandler that looks for complete expressions and evaluates each completed expression as it sees it. I'm glossing over a few details here (like the fact that ":" will switch you to the lldb command interpreter), but for the most part that's all it is.
Note, there's another "repl" that lldb provides:
> lldb --repl
Which packages up "make a target out of a little victim program we've stashed away in LLDB.framework, set a breakpoint in it, run to the breakpoint and then execute "expr -r --". So there's also a little bit to support that. But I don't think that materially changes how you should understand the REPL. And then most people actually access this for swift by invoking "swift" with no arguments, but the swift driver with no arguments just turns around and exec's "lldb --repl" so that doesn't add much besides convenience.
> On May 23, 2018, at 1:46 AM, Pavel Labath via Phabricator <reviews at reviews.llvm.org> wrote:
> labath added a comment.
> Both of the solutions sound plausible to me (extra struct vs. moving REPL to `Command`). Maybe that's because I don't know enough about the REPL to have formed an opinion on it.
> Comment at: lldb/include/lldb/Expression/REPL.h:31
> + bool TryAllThreads = true;
> + uint32_t Timeout = 0;
> + };
> If you stick with this solution, please make this `Timeout<std::micro>`
More information about the lldb-commits