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);


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);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to