Author: Zequan Wu Date: 2022-08-24T16:00:50-07:00 New Revision: b6d56ddac1bf50d532abdc86a84f9bc8e3e7a266
URL: https://github.com/llvm/llvm-project/commit/b6d56ddac1bf50d532abdc86a84f9bc8e3e7a266 DIFF: https://github.com/llvm/llvm-project/commit/b6d56ddac1bf50d532abdc86a84f9bc8e3e7a266.diff LOG: [LLDB] Clean up after command fails `CommandObject::CheckRequirements()` requires m_exe_ctx being cleaned up. Differential Revision: https://reviews.llvm.org/D132397 Added: lldb/test/Shell/Error/Inputs/cleanup.lldbinit lldb/test/Shell/Error/cleanup.cpp Modified: lldb/source/Interpreter/CommandObject.cpp Removed: ################################################################################ diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 719cfbc9e8023..5ab3392040c9e 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -741,6 +741,7 @@ bool CommandObjectParsed::Execute(const char *args_string, 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); diff --git a/lldb/test/Shell/Error/Inputs/cleanup.lldbinit b/lldb/test/Shell/Error/Inputs/cleanup.lldbinit new file mode 100644 index 0000000000000..56a323ca74ff7 --- /dev/null +++ b/lldb/test/Shell/Error/Inputs/cleanup.lldbinit @@ -0,0 +1,5 @@ +b main +run +dis a +dis -a $pc +exit diff --git a/lldb/test/Shell/Error/cleanup.cpp b/lldb/test/Shell/Error/cleanup.cpp new file mode 100644 index 0000000000000..6abc62dc4af99 --- /dev/null +++ b/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; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits