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.

llvm-svn: 178920
This commit is contained in:
Jason Molenda 2013-04-05 22:40:42 +00:00
parent 3005c299b5
commit 3b59f5c804
2 changed files with 70 additions and 21 deletions

View File

@ -1844,11 +1844,14 @@ PluginManager::DebuggerInitialize (Debugger &debugger)
}
}
// 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 &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::CreateSettingForDynamicLoaderPlugin (Debugger &debugger,
{
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));

View File

@ -286,15 +286,15 @@ PlatformDarwinKernel::GetStatus (Stream &strm)
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::GetUserSpecifiedDirectoriesToSearch (std::vector<lldb_priv
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);
}
}
}
}