[lldb-dev] lldb -- architecture level question -- linux v. darwin

Jim Ingham jingham at apple.com
Wed Mar 16 13:58:25 PDT 2011

Sorry if I was unclear.  We also JIT compile and insert functions that are theoretically reusable many many times, the trick is how to get to back to them again - especially from the parser.  Right now functions that get defined in the course of an expression don't get put back into the function lists we use to provide name lookup for the parser, and we don't tell the linker about them so the debugger doesn't find out about them through the normal course of things.  So you could make a function and use it in one pass though the Expression classes, but if you wanted to reuse the results of that Expression in another, we'd have to do more work to have the parser find it second time round.

Also, as a practical matter, the Command-Line interfaces to the expression parser are all one-shot deals, the code is JIT'ted and inserted, run and then removed.  Since the most common use of the expressions is stuff like:

(lldb) expr printSomething (pointer_to_print)

or whatever, you don't want to keep the code for that sitting around in the target…  So there would have to be a flag to the command saying "this expression makes stuff I want you to preserve."

That's all I meant.


On Mar 16, 2011, at 1:29 PM, Jason E. Aten wrote:

> Sorry,  I'm confused here; please clarify if you can.  In chapters 3 and 4 of the Kaleidoscope LLVM tutorial, we define and JIT-compile functions on the fly that are then reusable many, many times, in subsequently defined functions.  I am certain supposing that I have to provide a parser, generate ASTs, and call the LLVM functions like Kaleidoscope does in chapter 4, but how the code in that case preserved?  Is this a different mechanism or the same mechanism that the Expression classes use, as described in http://lldb.llvm.org/architecture.html :

More information about the lldb-dev mailing list