[Lldb-commits] [PATCH] D132397: [LLDB] Clean up after command fails

Zequan Wu via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 24 16:01:01 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb6d56ddac1bf: [LLDB] Clean up after command fails (authored by zequanwu).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132397/new/

https://reviews.llvm.org/D132397

Files:
  lldb/source/Interpreter/CommandObject.cpp
  lldb/test/Shell/Error/Inputs/cleanup.lldbinit
  lldb/test/Shell/Error/cleanup.cpp


Index: lldb/test/Shell/Error/cleanup.cpp
===================================================================
--- /dev/null
+++ lldb/test/Shell/Error/cleanup.cpp
@@ -0,0 +1,5 @@
+// Test CommandObject is cleaned up even after commands fail due to not taking any argument.
+// RUN: %clang_host -g %s -o %t
+// RUN: %lldb -f %t -o "settings set interpreter.stop-command-source-on-error false" -s \
+// RUN:   %S/Inputs/cleanup.lldbinit
+int main() { return 0; }
Index: lldb/test/Shell/Error/Inputs/cleanup.lldbinit
===================================================================
--- /dev/null
+++ lldb/test/Shell/Error/Inputs/cleanup.lldbinit
@@ -0,0 +1,5 @@
+b main
+run
+dis a
+dis -a $pc
+exit
Index: lldb/source/Interpreter/CommandObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandObject.cpp
+++ lldb/source/Interpreter/CommandObject.cpp
@@ -741,6 +741,7 @@
         if (cmd_args.GetArgumentCount() != 0 && m_arguments.empty()) {
           result.AppendErrorWithFormatv("'{0}' doesn't take any arguments.",
                                         GetCommandName());
+          Cleanup();
           return false;
         }
         handled = DoExecute(cmd_args, result);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132397.455410.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220824/edba3370/attachment-0001.bin>


More information about the lldb-commits mailing list