Skip to content

Commit 7214a3d

Browse files
authored
[lldb] Do not accept invalid process save-core plugins (#142684)
Fixes #142581
1 parent cf348e8 commit 7214a3d

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

lldb/source/Commands/CommandObjectProcess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ class CommandObjectProcessSaveCore : public CommandObjectParsed {
13031303
llvm_unreachable("Unimplemented option");
13041304
}
13051305

1306-
return {};
1306+
return error;
13071307
}
13081308

13091309
void OptionParsingStarting(ExecutionContext *execution_context) override {

lldb/source/Symbol/SaveCoreOptions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Status SaveCoreOptions::SetPluginName(const char *name) {
2424
if (!PluginManager::IsRegisteredObjectFilePluginName(name)) {
2525
return Status::FromErrorStringWithFormat(
2626
"plugin name '%s' is not a valid ObjectFile plugin name", name);
27-
return error;
2827
}
2928

3029
m_plugin_name = name;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This checks that lldb returns an error if process save-core is called
2+
# with a plugin that does not exist.
3+
4+
# RUN: %clang_host -g %S/Inputs/main.c -o %t
5+
# RUN: %lldb %t -s %s -o exit 2>&1 | FileCheck %s
6+
7+
b main
8+
# CHECK-LABEL: b main
9+
# CHECK: Breakpoint 1: where = {{.*}}`main
10+
11+
run
12+
# CHECK-LABEL: run
13+
# CHECK: Process {{.*}} stopped
14+
# CHECK: stop reason = breakpoint 1
15+
# CHECK: frame #0: {{.*}}`main at main.c
16+
17+
process save-core --plugin-name=notaplugin dump
18+
# CHECK-LABEL: process save-core --plugin-name=notaplugin dump
19+
# CHECK: error: plugin name 'notaplugin' is not a valid ObjectFile plugin name

0 commit comments

Comments
 (0)