Skip to content

Commit 844472e

Browse files
authored
Merge pull request #7065 from jimingham/check-null-exe-ctx
"settings set -g target.load-script-from-symbol-file" shouldn't crash.
2 parents f8c4926 + 8e08c94 commit 844472e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lldb/source/Core/Debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
213213

214214
TargetSP target_sp;
215215
LoadScriptFromSymFile load_script_old_value = eLoadScriptFromSymFileFalse;
216-
if (is_load_script && exe_ctx->GetTargetSP()) {
216+
if (is_load_script && exe_ctx && exe_ctx->GetTargetSP()) {
217217
target_sp = exe_ctx->GetTargetSP();
218218
load_script_old_value =
219219
target_sp->TargetProperties::GetLoadScriptFromSymbolFile();

lldb/test/API/commands/settings/TestSettings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,3 +971,11 @@ def test_settings_api(self):
971971

972972
# Test OptionValueLanguage
973973
self.verify_setting_value_json("repl-lang", "c++")
974+
975+
def test_global_option(self):
976+
# This command used to crash the settings because -g was signaled by a
977+
# NULL execution context (not one with an empty Target...) and in the
978+
# special handling for load-script-from-symbol-file this wasn't checked.
979+
self.runCmd("settings set -g target.load-script-from-symbol-file true")
980+
981+

0 commit comments

Comments
 (0)