[all-commits] [llvm/llvm-project] d33fa7: [lldb] Inline expression evaluator error visualiza...

Adrian Prantl via All-commits all-commits at lists.llvm.org
Fri Sep 27 18:10:22 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d33fa70dddcb29d5fd85188e119f034e585ccccf
      https://github.com/llvm/llvm-project/commit/d33fa70dddcb29d5fd85188e119f034e585ccccf
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2024-09-27 (Fri, 27 Sep 2024)

  Changed paths:
    M lldb/include/lldb/API/SBDebugger.h
    M lldb/include/lldb/Core/Debugger.h
    M lldb/include/lldb/Expression/DiagnosticManager.h
    M lldb/include/lldb/Interpreter/CommandObject.h
    M lldb/source/API/SBDebugger.cpp
    M lldb/source/Commands/CommandObjectExpression.cpp
    A lldb/source/Commands/DiagnosticRendering.h
    M lldb/source/Core/CoreProperties.td
    M lldb/source/Core/Debugger.cpp
    M lldb/source/Expression/DiagnosticManager.cpp
    M lldb/source/Interpreter/CommandInterpreter.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
    M lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.h
    M lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py
    M lldb/test/API/commands/expression/persistent_variables/TestPersistentVariables.py
    M lldb/test/API/commands/expression/static-initializers/TestStaticInitializers.py
    M lldb/test/API/lang/cpp/template-function/TestTemplateFunctions.py
    M lldb/test/API/lang/mixed/TestMixedLanguages.py
    M lldb/test/Shell/Expr/TestObjCIDCast.test
    M lldb/test/Shell/Expr/TestObjCInCXXContext.test
    M lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp
    M lldb/tools/driver/Driver.cpp
    M lldb/unittests/Expression/DiagnosticManagerTest.cpp
    M lldb/unittests/Interpreter/CMakeLists.txt
    A lldb/unittests/Interpreter/TestCommandObjectExpression.cpp

  Log Message:
  -----------
  [lldb] Inline expression evaluator error visualization (#106470)

This patch is a reworking of Pete Lawrence's (@PortalPete) proposal
for better expression evaluator error messages:
https://github.com/llvm/llvm-project/pull/80938

Before:

```
$ lldb -o "expr a+b"
(lldb) expr a+b
error: <user expression 0>:1:1: use of undeclared identifier 'a'
a+b
^
error: <user expression 0>:1:3: use of undeclared identifier 'b'
a+b
  ^
```

After:

```
(lldb) expr a+b
            ^ ^
            │ ╰─ error: use of undeclared identifier 'b'
            ╰─ error: use of undeclared identifier 'a'
```

This eliminates the confusing `<user expression 0>:1:3` source
location and avoids echoing the expression to the console again, which
results in a cleaner presentation that makes it easier to grasp what's
going on. You can't see it here, bug the word "error" is now also in
color, if so desired.

Depends on https://github.com/llvm/llvm-project/pull/106442.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list