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

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 29 12:57:14 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);
----------------
medismailben wrote:

> I think expr is probably the only command that is likely to ever echo its command string into the output. That's not something most commands would do. So this doesn't seem like a feature that should have as much prominence as changing the API gives it. I don't want to have to worry about what this means when I'm writing a new command, given the answer is almost surely to be "not relevant".

I don't have a strong option about this (as long as we don't update all the `DoExecute` implementations), but I was under the impression that in the future, some commands could make use of it to point directly to what caused an error in their invocation. But again, we can have it be part of the expression for now.

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


More information about the lldb-commits mailing list