[Lldb-commits] [lldb] r178920 - Reorder the Platform plugin settings so that they're now

Jason Molenda jmolenda at apple.com
Fri Apr 5 15:40:43 PDT 2013


Author: jmolenda
Date: Fri Apr  5 17:40:42 2013
New Revision: 178920

URL: http://llvm.org/viewvc/llvm-project?rev=178920&view=rev
Log:
Reorder the Platform plugin settings so that they're now

platform.plugin.darwin-kernel.kext-directories
platform.plugin.darwin-kernel.search-locally-for-kexts

and fix a few FileSpec handling issues for the kext-directories setting.

Modified:
    lldb/trunk/source/Core/PluginManager.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Modified: lldb/trunk/source/Core/PluginManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=178920&r1=178919&r2=178920&view=diff
==============================================================================
--- lldb/trunk/source/Core/PluginManager.cpp (original)
+++ lldb/trunk/source/Core/PluginManager.cpp Fri Apr  5 17:40:42 2013
@@ -1844,11 +1844,14 @@ PluginManager::DebuggerInitialize (Debug
     }
 }
 
+// This will put a plugin's settings under e.g. "plugin.dynamic-loader.darwin-kernel.SETTINGNAME".
+// The new preferred ordering is to put plugins under "dynamic-loader.plugin.darwin-kernel.SETTINGNAME"
+// and if there were a generic dynamic-loader setting, it would be "dynamic-loader.SETTINGNAME".
 static lldb::OptionValuePropertiesSP
-GetDebuggerPropertyForPlugins (Debugger &debugger,
-                               const ConstString &plugin_type_name,
-                               const ConstString &plugin_type_desc,
-                               bool can_create)
+GetDebuggerPropertyForPluginsOldStyle (Debugger &debugger,
+                                       const ConstString &plugin_type_name,
+                                       const ConstString &plugin_type_desc,
+                                       bool can_create)
 {
     lldb::OptionValuePropertiesSP parent_properties_sp (debugger.GetValueProperties());
     if (parent_properties_sp)
@@ -1882,11 +1885,52 @@ GetDebuggerPropertyForPlugins (Debugger
     return lldb::OptionValuePropertiesSP();
 }
 
+// This is the preferred new way to register plugin specific settings.  e.g.
+// "platform.plugin.darwin-kernel.SETTINGNAME"
+// and Platform generic settings would be under "platform.SETTINGNAME".
+static lldb::OptionValuePropertiesSP
+GetDebuggerPropertyForPlugins (Debugger &debugger, 
+                               const ConstString &plugin_type_name,
+                               const ConstString &plugin_type_desc,
+                               bool can_create)
+{
+    static ConstString g_property_name("plugin");
+    lldb::OptionValuePropertiesSP parent_properties_sp (debugger.GetValueProperties());
+    if (parent_properties_sp)
+    {
+        OptionValuePropertiesSP plugin_properties_sp = parent_properties_sp->GetSubProperty (NULL, plugin_type_name);
+        if (!plugin_properties_sp && can_create)
+        {
+            plugin_properties_sp.reset (new OptionValueProperties (plugin_type_name));
+            parent_properties_sp->AppendProperty (plugin_type_name,
+                                                  plugin_type_desc,
+                                                  true,
+                                                  plugin_properties_sp);
+        }
+        
+        if (plugin_properties_sp)
+        {
+            lldb::OptionValuePropertiesSP plugin_type_properties_sp = plugin_properties_sp->GetSubProperty (NULL, g_property_name);
+            if (!plugin_type_properties_sp && can_create)
+            {
+                plugin_type_properties_sp.reset (new OptionValueProperties (g_property_name));
+                plugin_properties_sp->AppendProperty (g_property_name,
+                                                      ConstString("Settings specific to plugins"),
+                                                      true,
+                                                      plugin_type_properties_sp);
+            }
+            return plugin_type_properties_sp;
+        }
+    }
+    return lldb::OptionValuePropertiesSP();
+}
+
+
 lldb::OptionValuePropertiesSP
 PluginManager::GetSettingForDynamicLoaderPlugin (Debugger &debugger, const ConstString &setting_name)
 {
     lldb::OptionValuePropertiesSP properties_sp;
-    lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
+    lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
                                                                                             ConstString("dynamic-loader"),
                                                                                             ConstString(), // not creating to so we don't need the description
                                                                                             false));
@@ -1903,7 +1947,7 @@ PluginManager::CreateSettingForDynamicLo
 {
     if (properties_sp)
     {
-        lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
+        lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
                                                                                                 ConstString("dynamic-loader"),
                                                                                                 ConstString("Settings for dynamic loader plug-ins"),
                                                                                                 true));

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=178920&r1=178919&r2=178920&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Fri Apr  5 17:40:42 2013
@@ -286,15 +286,15 @@ PlatformDarwinKernel::GetStatus (Stream
         strm.Printf ("Mac OS X kernel debugging\n");
     else
             strm.Printf ("unknown kernel debugging\n");
-    const uint32_t num_kdk_dirs = m_directories_searched.size();
-    for (uint32_t i=0; i<num_kdk_dirs; ++i)
+    const uint32_t num_kext_dirs = m_directories_searched.size();
+    for (uint32_t i=0; i<num_kext_dirs; ++i)
     {
-        const FileSpec &kdk_dir = m_directories_searched[i];
-
-        strm.Printf (" Kext directories: [%2u] \"%s/%s\"\n",
-                     i,
-                     kdk_dir.GetDirectory().GetCString(),
-                     kdk_dir.GetFilename().GetCString());
+        const FileSpec &kext_dir = m_directories_searched[i];
+        char pathbuf[PATH_MAX];
+        if (kext_dir.GetPath (pathbuf, sizeof (pathbuf)))
+        {
+            strm.Printf (" Kext directories: [%2u] \"%s\"\n", i, pathbuf);
+        }
     }
     strm.Printf (" Total number of kexts indexed: %d\n", (int) m_name_to_kext_path_map.size());
 }
@@ -421,19 +421,24 @@ PlatformDarwinKernel::GetUserSpecifiedDi
     const uint32_t user_dirs_count = user_dirs.GetSize();
     for (uint32_t i = 0; i < user_dirs_count; i++)
     {
-        const FileSpec &dir = user_dirs.GetFileSpecAtIndex (i);
+        FileSpec dir = user_dirs.GetFileSpecAtIndex (i);
+        dir.ResolvePath();
         if (dir.Exists() && dir.GetFileType() == FileSpec::eFileTypeDirectory)
         {
             directories.push_back (dir);
             possible_sdk_dirs.push_back (dir);  // does this directory have a *.sdk or *.kdk that we should look in?
 
-            // Is there a "System/Library/Extensions" subdir of this directory?
-            char pathbuf[PATH_MAX];
-            ::snprintf (pathbuf, sizeof (pathbuf), "%s/%s/System/Library/Extensions", dir.GetDirectory().GetCString(), dir.GetFilename().GetCString());
-            FileSpec dir_sle(pathbuf, true);
-            if (dir_sle.Exists() && dir_sle.GetFileType() == FileSpec::eFileTypeDirectory)
+            char dir_pathbuf[PATH_MAX];
+            if (dir.GetPath (dir_pathbuf, sizeof (dir_pathbuf)))
             {
-                directories.push_back (dir_sle);
+                // Is there a "System/Library/Extensions" subdir of this directory?
+                char pathbuf[PATH_MAX];
+                ::snprintf (pathbuf, sizeof (pathbuf), "%s/System/Library/Extensions", dir_pathbuf);
+                FileSpec dir_sle(pathbuf, true);
+                if (dir_sle.Exists() && dir_sle.GetFileType() == FileSpec::eFileTypeDirectory)
+                {
+                    directories.push_back (dir_sle);
+                }
             }
         }
     }





More information about the lldb-commits mailing list