[Lldb-commits] [PATCH] D65646: [lldb] Print better diagnostics for user expressions.

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 2 10:34:25 PDT 2019

jingham added a comment.

In D65646#1612436 <https://reviews.llvm.org/D65646#1612436>, @aprantl wrote:

> I have a question based on my half-knowledge about the expression evaluator: I thought that we already wrote out a temporary file for the expression in order to support `expr -g`? Is this orthogonal or do we now have to ways of pretending there is a source file backing up the expression?

The file creation happens a little above the change to pass in a memory file:

  // We also want a real file on disk if we generate full debug info.
  should_create_file |= m_compiler->getCodeGenOpts().getDebugInfo() ==

around line 891.  Raphael's change doesn't change whether we emit this source file or not.

But it seem weird that this will make every expression seem to come from the same file and line.  It would be really nice to be able to set breakpoints in compiled expressions, but if all the files think they have the same source file & starting line, this will be harder to get working.

Note, however, the creation of the source file & tracing back from the debug_line that we insert when we JIT the expression to this source file seems broken, however.  If I do:

  (lldb) expr --top-level -- int $foo(int) { (int) printf("I am here.\n"); }
  (lldb) b s -n printf
  Breakpoint 3: where = libsystem_c.dylib`printf, address = 0x00007fff616588ec
  (lldb) expr -i 0 -- $foo(10)
  1 location added to breakpoint 2
  error: Execution was interrupted, reason: breakpoint 2.1.
  The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
  Process 3708 stopped
  * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
      frame #0: 0x0000000100104b1b $__lldb_expr1`$foo(int) at Parse:1
  Target 0: (something) stopped.

I should have seen the source code for $foo, but we don't seem to have found the file.  So something is broken in this process.




More information about the lldb-commits mailing list