https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/142684
>From 0bf47c19e63c3b72a4b3861fa286e273a99bd80c Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <yerimy...@gmail.com> Date: Tue, 3 Jun 2025 23:22:30 +0100 Subject: [PATCH 1/2] [lldb] Return an error when if process save-core plugin is invalid Fixes #142581 --- lldb/source/Commands/CommandObjectProcess.cpp | 2 +- lldb/source/Symbol/SaveCoreOptions.cpp | 1 - .../command-process-save-core-not-a-plugin.test | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index d0f5eaf2dfd9a..b1f243c9e2777 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1303,7 +1303,7 @@ class CommandObjectProcessSaveCore : public CommandObjectParsed { llvm_unreachable("Unimplemented option"); } - return {}; + return error; } void OptionParsingStarting(ExecutionContext *execution_context) override { diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp b/lldb/source/Symbol/SaveCoreOptions.cpp index e51ae27954934..d884b00a47b00 100644 --- a/lldb/source/Symbol/SaveCoreOptions.cpp +++ b/lldb/source/Symbol/SaveCoreOptions.cpp @@ -24,7 +24,6 @@ Status SaveCoreOptions::SetPluginName(const char *name) { if (!PluginManager::IsRegisteredObjectFilePluginName(name)) { return Status::FromErrorStringWithFormat( "plugin name '%s' is not a valid ObjectFile plugin name", name); - return error; } m_plugin_name = name; diff --git a/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test b/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test new file mode 100644 index 0000000000000..bd23777998a40 --- /dev/null +++ b/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test @@ -0,0 +1,16 @@ +# RUN: %clang_host -g %S/Inputs/main.c -o %t +# RUN: %lldb %t -s %s -o exit 2>&1 | FileCheck %s + +b main +# CHECK-LABEL: b main +# CHECK: Breakpoint 1: where = {{.*}}`main + +run +# CHECK-LABEL: run +# CHECK: Process {{.*}} stopped +# CHECK: stop reason = breakpoint 1 +# CHECK: frame #0: {{.*}}`main at main.c + +process save-core --plugin-name=notaplugin dump +# CHECK-LABEL: process save-core --plugin-name=notaplugin dump +# CHECK: error: plugin name 'notaplugin' is not a valid ObjectFile plugin name >From c18ffcdfabb8494efb94130070a2e5bae6876910 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <yerimy...@gmail.com> Date: Tue, 3 Jun 2025 23:27:22 +0100 Subject: [PATCH 2/2] [lldb] Add test note --- .../Shell/Commands/command-process-save-core-not-a-plugin.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test b/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test index bd23777998a40..c034c8ebbf87d 100644 --- a/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test +++ b/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test @@ -1,3 +1,6 @@ +# This checks that lldb returns an error if process save-core is called +# with a plugin that does not exist. + # RUN: %clang_host -g %S/Inputs/main.c -o %t # RUN: %lldb %t -s %s -o exit 2>&1 | FileCheck %s _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits