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,8 +1844,11 @@ 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 static lldb::OptionValuePropertiesSP
GetDebuggerPropertyForPlugins (Debugger &debugger, GetDebuggerPropertyForPluginsOldStyle (Debugger &debugger,
const ConstString &plugin_type_name, const ConstString &plugin_type_name,
const ConstString &plugin_type_desc, const ConstString &plugin_type_desc,
bool can_create) bool can_create)
@ -1882,11 +1885,52 @@ GetDebuggerPropertyForPlugins (Debugger &debugger,
return lldb::OptionValuePropertiesSP(); 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 lldb::OptionValuePropertiesSP
PluginManager::GetSettingForDynamicLoaderPlugin (Debugger &debugger, const ConstString &setting_name) PluginManager::GetSettingForDynamicLoaderPlugin (Debugger &debugger, const ConstString &setting_name)
{ {
lldb::OptionValuePropertiesSP properties_sp; lldb::OptionValuePropertiesSP properties_sp;
lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger, lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
ConstString("dynamic-loader"), ConstString("dynamic-loader"),
ConstString(), // not creating to so we don't need the description ConstString(), // not creating to so we don't need the description
false)); false));
@ -1903,7 +1947,7 @@ PluginManager::CreateSettingForDynamicLoaderPlugin (Debugger &debugger,
{ {
if (properties_sp) if (properties_sp)
{ {
lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger, lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
ConstString("dynamic-loader"), ConstString("dynamic-loader"),
ConstString("Settings for dynamic loader plug-ins"), ConstString("Settings for dynamic loader plug-ins"),
true)); true));

View File

@ -286,15 +286,15 @@ PlatformDarwinKernel::GetStatus (Stream &strm)
strm.Printf ("Mac OS X kernel debugging\n"); strm.Printf ("Mac OS X kernel debugging\n");
else else
strm.Printf ("unknown kernel debugging\n"); strm.Printf ("unknown kernel debugging\n");
const uint32_t num_kdk_dirs = m_directories_searched.size(); const uint32_t num_kext_dirs = m_directories_searched.size();
for (uint32_t i=0; i<num_kdk_dirs; ++i) for (uint32_t i=0; i<num_kext_dirs; ++i)
{ {
const FileSpec &kdk_dir = m_directories_searched[i]; const FileSpec &kext_dir = m_directories_searched[i];
char pathbuf[PATH_MAX];
strm.Printf (" Kext directories: [%2u] \"%s/%s\"\n", if (kext_dir.GetPath (pathbuf, sizeof (pathbuf)))
i, {
kdk_dir.GetDirectory().GetCString(), strm.Printf (" Kext directories: [%2u] \"%s\"\n", i, pathbuf);
kdk_dir.GetFilename().GetCString()); }
} }
strm.Printf (" Total number of kexts indexed: %d\n", (int) m_name_to_kext_path_map.size()); strm.Printf (" Total number of kexts indexed: %d\n", (int) m_name_to_kext_path_map.size());
} }
@ -421,15 +421,19 @@ PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch (std::vector<lldb_priv
const uint32_t user_dirs_count = user_dirs.GetSize(); const uint32_t user_dirs_count = user_dirs.GetSize();
for (uint32_t i = 0; i < user_dirs_count; i++) 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) if (dir.Exists() && dir.GetFileType() == FileSpec::eFileTypeDirectory)
{ {
directories.push_back (dir); directories.push_back (dir);
possible_sdk_dirs.push_back (dir); // does this directory have a *.sdk or *.kdk that we should look in? possible_sdk_dirs.push_back (dir); // does this directory have a *.sdk or *.kdk that we should look in?
char dir_pathbuf[PATH_MAX];
if (dir.GetPath (dir_pathbuf, sizeof (dir_pathbuf)))
{
// Is there a "System/Library/Extensions" subdir of this directory? // Is there a "System/Library/Extensions" subdir of this directory?
char pathbuf[PATH_MAX]; char pathbuf[PATH_MAX];
::snprintf (pathbuf, sizeof (pathbuf), "%s/%s/System/Library/Extensions", dir.GetDirectory().GetCString(), dir.GetFilename().GetCString()); ::snprintf (pathbuf, sizeof (pathbuf), "%s/System/Library/Extensions", dir_pathbuf);
FileSpec dir_sle(pathbuf, true); FileSpec dir_sle(pathbuf, true);
if (dir_sle.Exists() && dir_sle.GetFileType() == FileSpec::eFileTypeDirectory) if (dir_sle.Exists() && dir_sle.GetFileType() == FileSpec::eFileTypeDirectory)
{ {
@ -437,6 +441,7 @@ PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch (std::vector<lldb_priv
} }
} }
} }
}
SearchSDKsForKextDirectories (possible_sdk_dirs, directories); SearchSDKsForKextDirectories (possible_sdk_dirs, directories);
} }