[Lldb-commits] [lldb] r182414 - <rdar://problem/13878726>
Enrico Granata
egranata at apple.com
Tue May 21 13:13:34 PDT 2013
Author: enrico
Date: Tue May 21 15:13:34 2013
New Revision: 182414
URL: http://llvm.org/viewvc/llvm-project?rev=182414&view=rev
Log:
<rdar://problem/13878726>
Yet another implementation of the python in dSYM autoload :)
This time we are going with a ternary setting:
true - load, do not warn
false - do not load, do not warn
warn - do not load, warn (default)
Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=182414&r1=182413&r2=182414&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue May 21 15:13:34 2013
@@ -47,6 +47,13 @@ typedef enum InlineStrategy
eInlineBreakpointsAlways
} InlineStrategy;
+typedef enum LoadScriptFromSymFile
+{
+ eLoadScriptFromSymFileTrue,
+ eLoadScriptFromSymFileFalse,
+ eLoadScriptFromSymFileWarn
+} LoadScriptFromSymFile;
+
//----------------------------------------------------------------------
// TargetProperties
//----------------------------------------------------------------------
@@ -148,12 +155,9 @@ public:
bool
GetUseFastStepping() const;
- bool
+ LoadScriptFromSymFile
GetLoadScriptFromSymbolFile() const;
- bool
- GetWarnForScriptInSymbolFile() const;
-
};
typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=182414&r1=182413&r2=182414&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Tue May 21 15:13:34 2013
@@ -84,7 +84,7 @@
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- launchStyle = "0"
+ launchStyle = "1"
useCustomWorkingDirectory = "NO"
customWorkingDirectory = "/Volumes/work/gclayton/Documents/devb/attach"
buildConfiguration = "Debug"
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=182414&r1=182413&r2=182414&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue May 21 15:13:34 2013
@@ -173,7 +173,7 @@ Debugger::SetPropertyValue (const Execut
{
bool is_load_script = strcmp(property_path,"target.load-script-from-symbol-file") == 0;
TargetSP target_sp;
- bool load_script_old_value;
+ LoadScriptFromSymFile load_script_old_value;
if (is_load_script && exe_ctx->GetTargetSP())
{
target_sp = exe_ctx->GetTargetSP();
@@ -189,9 +189,9 @@ Debugger::SetPropertyValue (const Execut
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 == false)
+ else if (is_load_script && target_sp && load_script_old_value == eLoadScriptFromSymFileWarn)
{
- if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() == true)
+ if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() == eLoadScriptFromSymFileTrue)
{
std::list<Error> errors;
StreamString feedback_stream;
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=182414&r1=182413&r2=182414&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue May 21 15:13:34 2013
@@ -1243,8 +1243,7 @@ Module::LoadScriptingResourceInTarget (T
return false;
}
- bool shoud_load = target->TargetProperties::GetLoadScriptFromSymbolFile();
- bool should_warn = target->TargetProperties::GetWarnForScriptInSymbolFile();
+ LoadScriptFromSymFile shoud_load = target->TargetProperties::GetLoadScriptFromSymbolFile();
Debugger &debugger = target->GetDebugger();
const ScriptLanguage script_language = debugger.GetScriptLanguage();
@@ -1274,10 +1273,13 @@ Module::LoadScriptingResourceInTarget (T
FileSpec scripting_fspec (file_specs.GetFileSpecAtIndex(i));
if (scripting_fspec && scripting_fspec.Exists())
{
- if (shoud_load == false)
+ if (shoud_load == eLoadScriptFromSymFileFalse)
+ return false;
+ if (shoud_load == eLoadScriptFromSymFileWarn)
{
- 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());
+ if (feedback_stream)
+ feedback_stream->Printf("warning: '%s' contains a debug script. To run this script in this debug session:\n\n command script import \"%s\"\n\nTo run all discovered debug scripts in this session:\n\n settings set target.load-script-from-symbol-file true"
+ ,GetFileSpec().GetFileNameStrippingExtension().GetCString(),scripting_fspec.GetPath().c_str());
return false;
}
StreamString scripting_stream;
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=182414&r1=182413&r2=182414&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue May 21 15:13:34 2013
@@ -2270,6 +2270,15 @@ g_x86_dis_flavor_value_types[] =
{ 0, NULL, NULL }
};
+static OptionEnumValueElement
+g_load_script_from_sym_file_values[] =
+{
+ { eLoadScriptFromSymFileTrue, "true", "Load debug scripts inside symbol files"},
+ { eLoadScriptFromSymFileFalse, "false", "Do not load debug scripts inside symbol files."},
+ { eLoadScriptFromSymFileWarn, "warn", "Warn about debug scripts inside symbol files but do not load them."},
+ { 0, NULL, NULL }
+};
+
static PropertyDefinition
g_properties[] =
{
@@ -2306,8 +2315,7 @@ g_properties[] =
// FIXME: This is the wrong way to do per-architecture settings, but we don't have a general per architecture settings system in place yet.
{ "x86-disassembly-flavor" , OptionValue::eTypeEnum , false, eX86DisFlavorDefault, NULL, g_x86_dis_flavor_value_types, "The default disassembly flavor to use for x86 or x86-64 targets." },
{ "use-fast-stepping" , OptionValue::eTypeBoolean , false, true, NULL, NULL, "Use a fast stepping algorithm based on running from branch to branch rather than instruction single-stepping." },
- { "load-script-from-symbol-file" , OptionValue::eTypeBoolean , false, false, NULL, NULL, "Allow LLDB to load scripting resources embedded in symbol files when available." },
- { "warn-on-script-from-symbol-file" , OptionValue::eTypeBoolean , false, true, NULL, NULL, "Tell me about scripting resources embedded in symbol files when available." },
+ { "load-script-from-symbol-file" , OptionValue::eTypeEnum , false, eLoadScriptFromSymFileWarn, NULL, g_load_script_from_sym_file_values, "Allow LLDB to load scripting resources embedded in symbol files when available." },
{ NULL , OptionValue::eTypeInvalid , false, 0 , NULL, NULL, NULL }
};
enum
@@ -2335,7 +2343,6 @@ enum
ePropertyDisassemblyFlavor,
ePropertyUseFastStepping,
ePropertyLoadScriptFromSymbolFile,
- ePropertyWarnForScriptFromSymbolFile
};
@@ -2688,18 +2695,11 @@ TargetProperties::GetUseFastStepping ()
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
-bool
+LoadScriptFromSymFile
TargetProperties::GetLoadScriptFromSymbolFile () const
{
const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
-}
-
-bool
-TargetProperties::GetWarnForScriptInSymbolFile() const
-{
- const uint32_t idx = ePropertyWarnForScriptFromSymbolFile;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+ return (LoadScriptFromSymFile)m_collection_sp->GetPropertyAtIndexAsEnumeration(NULL, idx, g_properties[idx].default_uint_value);
}
const TargetPropertiesSP &
More information about the lldb-commits
mailing list