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

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 28 23:17:48 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:

Instead of updating every `DoExecute` implementations, it would be reasonable to have make this an optional member of the `CommandObject` base class so it can be accessed by the derived `CommandObject` classes that gonna use it.


The optional could be set in the non-virtual `CommandObject::Execute` command, since that's the one that calls the derived class `DoExecute` or may be by adding a setter to the `CommandObject` base class. 

This would greatly reduce the size of this patch.

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


More information about the lldb-commits mailing list