aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2025-02-04 08:55:30 -0800
committerGitHub <noreply@github.com>2025-02-04 08:55:30 -0800
commit906eeeda833b30fb7fdc3b7586de34b65d575b45 (patch)
treeb21aeab735177868ab292b3010c0acdc4570d7df /lldb/source/Interpreter/CommandInterpreter.cpp
parent84fbed86ffcb97c24f9294a204c60da5444b8646 (diff)
downloadllvm-906eeeda833b30fb7fdc3b7586de34b65d575b45.zip
llvm-906eeeda833b30fb7fdc3b7586de34b65d575b45.tar.gz
llvm-906eeeda833b30fb7fdc3b7586de34b65d575b45.tar.bz2
[lldb] Store the command in the CommandReturnObject (#125132)
As suggested in #125006. Depending on which PR lands first, I'll update `TestCommandInterepterPrintCallback.py` to check that the `CommandReturnObject` passed to the callback has the correct command.
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 4869b81..8398226 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1887,12 +1887,13 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
std::string real_original_command_string(command_string);
Log *log = GetLog(LLDBLog::Commands);
- llvm::PrettyStackTraceFormat stack_trace("HandleCommand(command = \"%s\")",
- command_line);
-
LLDB_LOGF(log, "Processing command: %s", command_line);
LLDB_SCOPED_TIMERF("Processing command: %s.", command_line);
+ // Set the command in the CommandReturnObject here so that it's there even if
+ // the command is interrupted.
+ result.SetCommand(command_line);
+
if (INTERRUPT_REQUESTED(GetDebugger(), "Interrupted initiating command")) {
result.AppendError("... Interrupted");
return false;
@@ -2644,7 +2645,8 @@ void CommandInterpreter::HandleCommands(
(uint64_t)idx, cmd, error_msg);
m_debugger.SetAsyncExecution(old_async_execution);
return;
- } else if (options.GetPrintResults()) {
+ }
+ if (options.GetPrintResults()) {
result.AppendMessageWithFormatv("Command #{0} '{1}' failed with {2}",
(uint64_t)idx + 1, cmd, error_msg);
}