diff options
Diffstat (limited to 'lldb/source/Core')
| -rw-r--r-- | lldb/source/Core/Debugger.cpp | 13 | ||||
| -rw-r--r-- | lldb/source/Core/Module.cpp | 11 | ||||
| -rw-r--r-- | lldb/source/Core/ModuleList.cpp | 19 |
3 files changed, 25 insertions, 18 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 4cda3417de2..15cf2fe31d4 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -173,7 +173,7 @@ Debugger::SetPropertyValue (const ExecutionContext *exe_ctx, { bool is_load_script = strcmp(property_path,"target.load-script-from-symbol-file") == 0; TargetSP target_sp; - LoadScriptFromSymFile load_script_old_value; + bool load_script_old_value; if (is_load_script && exe_ctx->GetTargetSP()) { target_sp = exe_ctx->GetTargetSP(); @@ -189,17 +189,20 @@ Debugger::SetPropertyValue (const ExecutionContext *exe_ctx, EventSP prompt_change_event_sp (new Event(CommandInterpreter::eBroadcastBitResetPrompt, new EventDataBytes (new_prompt))); GetCommandInterpreter().BroadcastEvent (prompt_change_event_sp); } - else if (is_load_script && target_sp && load_script_old_value == LoadScriptFromSymFile::eDefault) + else if (is_load_script && target_sp && load_script_old_value == false) { - if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() == LoadScriptFromSymFile::eYes) + if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() == true) { std::list<Error> errors; - if (!target_sp->LoadScriptingResources(errors)) + StreamString feedback_stream; + if (!target_sp->LoadScriptingResources(errors,&feedback_stream)) { for (auto error : errors) { - GetErrorStream().Printf("unable to autoload scripting data: %s\n",error.AsCString()); + GetErrorStream().Printf("%s\n",error.AsCString()); } + if (feedback_stream.GetSize()) + GetErrorStream().Printf("%s",feedback_stream.GetData()); } } } diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 86057c17eff..f00afc10ad2 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -1235,7 +1235,7 @@ Module::IsLoadedInTarget (Target *target) } bool -Module::LoadScriptingResourceInTarget (Target *target, Error& error) +Module::LoadScriptingResourceInTarget (Target *target, Error& error, Stream* feedback_stream) { if (!target) { @@ -1243,7 +1243,8 @@ Module::LoadScriptingResourceInTarget (Target *target, Error& error) return false; } - LoadScriptFromSymFile shoud_load = target->TargetProperties::GetLoadScriptFromSymbolFile(); + bool shoud_load = target->TargetProperties::GetLoadScriptFromSymbolFile(); + bool should_warn = target->TargetProperties::GetWarnForScriptInSymbolFile(); Debugger &debugger = target->GetDebugger(); const ScriptLanguage script_language = debugger.GetScriptLanguage(); @@ -1273,10 +1274,10 @@ Module::LoadScriptingResourceInTarget (Target *target, Error& error) FileSpec scripting_fspec (file_specs.GetFileSpecAtIndex(i)); if (scripting_fspec && scripting_fspec.Exists()) { - if (shoud_load != LoadScriptFromSymFile::eYes) + if (shoud_load == false) { - if (shoud_load == LoadScriptFromSymFile::eDefault) - error.SetErrorStringWithFormat("the setting target.load-script-from-symbol-file disallows loading script files - change it to yes or manually command script import %s",scripting_fspec.GetPath().c_str()); + if (should_warn == true && feedback_stream) + feedback_stream->Printf("warning: the debug info scripting resource for '%s' was not loaded for security reasons. to override, set the \"target.load-script-from-symbol-file\" setting to true or manually run \"command script import %s\"\n",GetFileSpec().GetFileNameStrippingExtension().GetCString(),scripting_fspec.GetPath().c_str()); return false; } StreamString scripting_stream; diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 449a800949e..07b20b8d91e 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -1011,6 +1011,7 @@ ModuleList::RemoveSharedModuleIfOrphaned (const Module *module_ptr) bool ModuleList::LoadScriptingResourcesInTarget (Target *target, std::list<Error>& errors, + Stream *feedback_stream, bool continue_on_error) { if (!target) @@ -1021,16 +1022,18 @@ ModuleList::LoadScriptingResourcesInTarget (Target *target, Error error; if (module) { - module->LoadScriptingResourceInTarget(target, error); - if (error.Fail() && error.AsCString()) + if (!module->LoadScriptingResourceInTarget(target, error, feedback_stream)) { - error.SetErrorStringWithFormat("unable to load scripting data for module %s - error reported was %s", - module->GetFileSpec().GetFileNameStrippingExtension().GetCString(), - error.AsCString()); - errors.push_back(error); + if (error.Fail() && error.AsCString()) + { + error.SetErrorStringWithFormat("unable to load scripting data for module %s - error reported was %s", + module->GetFileSpec().GetFileNameStrippingExtension().GetCString(), + error.AsCString()); + errors.push_back(error); + } + if (!continue_on_error) + return false; } - if (!continue_on_error) - return false; } } return errors.size() == 0; |

