From eabc7f78b22c4ff4638c5d76d27435aa166245f7 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 10 Sep 2026 12:47:28 +0000 Subject: [PATCH] Show the errors that occurred, if any, when executing a `dump` command in lldb (#7743) --- scripts/lldbinit.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/lldbinit.py b/scripts/lldbinit.py index f15837bfb324..3c6679b90a56 100644 --- a/scripts/lldbinit.py +++ b/scripts/lldbinit.py @@ -22,10 +22,15 @@ result = lldb.SBCommandReturnObject() def RunCommand(cmd: str, print_command: bool = True) -> Any: - """Runs a command and prints it to the console to show that it ran.""" + """Runs a command and prints it to the console to show that it ran. + + Any errors are printed to the console.""" if print_command: print(f"(lldb) {cmd}") ci.HandleCommand(cmd, result) + err = result.GetError() + if err: + print(result.GetError()) return result.GetOutput() @@ -108,10 +113,6 @@ Example usage: # Use the `dump_re` match to print just the interesting part of the # dump output. print(m[1]) - else: - # Unexpected output, show the command that was run. - print(f"(lldb) {cmd}") - print(out) # Try to find a type + id from the input args. If not, the id will be passed # through directly to C++, as it can be a variable name.