[Lldb-commits] [lldb] [lldb] Inline expression evaluator error visualization (PR #106470)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 29 01:26:56 PDT 2024


labath wrote:

This seems like it could be problematic for IDEs, if they don't print the error in the same window as the expression being evaluated. The arrows could end up pointing to nowhere, or to the wrong place in the expression (if we don't get the right offset).

I think this could be made simpler and more robust by just printing a reproduction of the expression as the first line of the error message. It saving that one line output worth it?

Also, how will this behave for multiline expressions? Or with errors that refer to multiple source locations (e.g inside macro expansions)?
```
(lldb) expr
Enter expressions, then terminate with an empty line to evaluate:
  1: #define FOO(x) foo+x 
  2: FOO(bar) 
error: <user expression 1>:2:1: use of undeclared identifier 'foo'
    2 | FOO(bar)
      | ^
<user expression 1>:1:16: expanded from macro 'FOO'
    1 | #define FOO(x) foo+x
      |                ^
error: <user expression 1>:2:5: use of undeclared identifier 'bar'
    2 | FOO(bar)
      |     ^
```

https://github.com/llvm/llvm-project/pull/106470


More information about the lldb-commits mailing list