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

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 30 18:39:00 PDT 2024


================
@@ -2076,7 +2077,11 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
     }
 
     ElapsedTime elapsed(execute_time);
-    cmd_obj->Execute(remainder.c_str(), result);
+    size_t nchar = real_original_command_string.find(remainder);
+    std::optional<uint16_t> pos_in_cmd;
+    if (nchar != std::string::npos)
+      pos_in_cmd = nchar + GetDebugger().GetPrompt().size();
+    cmd_obj->Execute(remainder.c_str(), pos_in_cmd, result);
----------------
adrian-prantl wrote:

@jimingham @medismailben I hopefully have resolved both of your concerns by storing the original command string as a member in CommandObject. This way the `expr -i 0 -u 0 -- not a valid expression` works.
```
(lldb) expr -i 0 -u 0 -- not a valid expression
                         ^
                         ╰─ error: use of undeclared identifier 'not'
```

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


More information about the lldb-commits mailing list