jingham added a subscriber: zturner.
jingham added a comment.

The expression command had two modes before introducing the REPL.  You can do:

(lldb) expr -- some C expression

or you can do:

(lldb) expr
Enter expressions, then terminate with an empty line to evaluate:

  1: first C expression
  2: Second C Expression
  3: 

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

  2> print(a)

10

  3>  

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.

Jim


https://reviews.llvm.org/D47232



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to