[Lldb-commits] [lldb] r181709 - <rdar://problem/13183720>

Enrico Granata egranata at apple.com
Mon May 13 10:03:52 PDT 2013


Author: enrico
Date: Mon May 13 12:03:52 2013
New Revision: 181709

URL: http://llvm.org/viewvc/llvm-project?rev=181709&view=rev
Log:
<rdar://problem/13183720>

Provide a mechanism through which users can disable loading the Python scripts from dSYM files
This relies on a target setting: target.load-script-from-symbol-file which defaults to false ("do NOT load the script")
You need to set it to true before creating your target (or in your lldbinit file if you constantly rely on this feature) to allow the scripts to load


Modified:
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/source/Commands/CommandObjectTarget.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=181709&r1=181708&r2=181709&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Mon May 13 12:03:52 2013
@@ -147,6 +147,12 @@ public:
     bool
     GetUseFastStepping() const;
     
+    bool
+    GetLoadScriptFromSymbolFile() const;
+
+    void
+    SetLoadScriptFromSymbolFile(bool b);
+
 };
 
 typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=181709&r1=181708&r2=181709&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Mon May 13 12:03:52 2013
@@ -4330,6 +4330,10 @@ protected:
                             // in the debug info files in case the platform supports that.
                             Error error;
                             module_sp->LoadScriptingResourceInTarget (target, error);
+                            if (error.Fail())
+                                result.AppendWarningWithFormat("unable to load scripting data for module %s - error reported was %s",
+                                                               module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
+                                                               error.AsCString());
 
                             flush = true;
                             result.SetStatus (eReturnStatusSuccessFinishResult);

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=181709&r1=181708&r2=181709&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Mon May 13 12:03:52 2013
@@ -1243,6 +1243,8 @@ Module::LoadScriptingResourceInTarget (T
         return false;
     }
     
+    bool shoud_load = target->TargetProperties::GetLoadScriptFromSymbolFile();
+    
     Debugger &debugger = target->GetDebugger();
     const ScriptLanguage script_language = debugger.GetScriptLanguage();
     if (script_language != eScriptLanguageNone)
@@ -1271,7 +1273,11 @@ Module::LoadScriptingResourceInTarget (T
                     FileSpec scripting_fspec (file_specs.GetFileSpecAtIndex(i));
                     if (scripting_fspec && scripting_fspec.Exists())
                     {
-
+                        if (!shoud_load)
+                        {
+                            error.SetErrorString("Target doesn't allow loading scripting resource. Please set target.load-script-from-symbol-file and retry.");
+                            return false;
+                        }
                         StreamString scripting_stream;
                         scripting_fspec.Dump(&scripting_stream);
                         const bool can_reload = false;

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=181709&r1=181708&r2=181709&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon May 13 12:03:52 2013
@@ -2301,6 +2301,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." },
     { NULL                                 , OptionValue::eTypeInvalid   , false, 0                         , NULL, NULL, NULL }
 };
 enum
@@ -2326,7 +2327,8 @@ enum
     ePropertyDisableSTDIO,
     ePropertyInlineStrategy,
     ePropertyDisassemblyFlavor,
-    ePropertyUseFastStepping
+    ePropertyUseFastStepping,
+    ePropertyLoadScriptFromSymbolFile
 };
 
 
@@ -2672,6 +2674,20 @@ TargetProperties::GetUseFastStepping ()
     return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
 }
 
+bool
+TargetProperties::GetLoadScriptFromSymbolFile () const
+{
+    const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
+    return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+
+void
+TargetProperties::SetLoadScriptFromSymbolFile (bool b)
+{
+    const uint32_t idx = ePropertyLoadScriptFromSymbolFile;
+    m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, b);
+}
+
 const TargetPropertiesSP &
 Target::GetGlobalProperties()
 {





More information about the lldb-commits mailing list