summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/PluginManager.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-04-24 22:29:28 +0000
committerGreg Clayton <gclayton@apple.com>2013-04-24 22:29:28 +0000
commitf4d6de6a5385e18e0b7746d3037f2029069c6ef3 (patch)
treee9e6c4d2b765b926e5ec4dc75e006059730d8aef /lldb/source/Core/PluginManager.cpp
parent8d1d25222ec4b1c0d590cd888499d2061eaa67e3 (diff)
downloadbcm5719-llvm-f4d6de6a5385e18e0b7746d3037f2029069c6ef3.tar.gz
bcm5719-llvm-f4d6de6a5385e18e0b7746d3037f2029069c6ef3.zip
Added the ability to extract a ModuleSpecList (a new class) from an ObjectFile. This is designed to be used when you have an object file that contains one or more architectures (MacOSX universal (fat) files) and/or one or more objects (BSD archive (.a files)).
There is a new static ObjectFile function you can call: size_t ObjectFile::GetModuleSpecifications (const FileSpec &file, lldb::offset_t file_offset, ModuleSpecList &specs) This will fill in "specs" which the details of all the module specs (file + arch + UUID (if there is one) + object name (for BSD archive objects eventually) + file offset to the object in question). This helps us when a user specifies a file that contains a single architecture, and also helps us when we are given a debug symbol file (like a dSYM file on MacOSX) that contains one or more architectures and we need to be able to match it up to an existing Module that has no debug info. llvm-svn: 180224
Diffstat (limited to 'lldb/source/Core/PluginManager.cpp')
-rw-r--r--lldb/source/Core/PluginManager.cpp55
1 files changed, 39 insertions, 16 deletions
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index 4498182e754..0cc916b115d 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -870,7 +870,9 @@ struct ObjectFileInstance
ObjectFileInstance() :
name(),
description(),
- create_callback(NULL)
+ create_callback(NULL),
+ create_memory_callback (NULL),
+ get_module_specifications (NULL)
{
}
@@ -878,7 +880,7 @@ struct ObjectFileInstance
std::string description;
ObjectFileCreateInstance create_callback;
ObjectFileCreateMemoryInstance create_memory_callback;
-
+ ObjectFileGetModuleSpecifications get_module_specifications;
};
typedef std::vector<ObjectFileInstance> ObjectFileInstances;
@@ -899,13 +901,11 @@ GetObjectFileInstances ()
bool
-PluginManager::RegisterPlugin
-(
- const char *name,
- const char *description,
- ObjectFileCreateInstance create_callback,
- ObjectFileCreateMemoryInstance create_memory_callback
-)
+PluginManager::RegisterPlugin (const char *name,
+ const char *description,
+ ObjectFileCreateInstance create_callback,
+ ObjectFileCreateMemoryInstance create_memory_callback,
+ ObjectFileGetModuleSpecifications get_module_specifications)
{
if (create_callback)
{
@@ -916,6 +916,7 @@ PluginManager::RegisterPlugin
instance.description = description;
instance.create_callback = create_callback;
instance.create_memory_callback = create_memory_callback;
+ instance.get_module_specifications = get_module_specifications;
Mutex::Locker locker (GetObjectFileMutex ());
GetObjectFileInstances ().push_back (instance);
}
@@ -964,6 +965,16 @@ PluginManager::GetObjectFileCreateMemoryCallbackAtIndex (uint32_t idx)
return NULL;
}
+ObjectFileGetModuleSpecifications
+PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
+{
+ Mutex::Locker locker (GetObjectFileMutex ());
+ ObjectFileInstances &instances = GetObjectFileInstances ();
+ if (idx < instances.size())
+ return instances[idx].get_module_specifications;
+ return NULL;
+}
+
ObjectFileCreateInstance
PluginManager::GetObjectFileCreateCallbackForPluginName (const char *name)
{
@@ -1012,13 +1023,16 @@ struct ObjectContainerInstance
ObjectContainerInstance() :
name(),
description(),
- create_callback(NULL)
+ create_callback (NULL),
+ get_module_specifications (NULL)
{
}
std::string name;
std::string description;
ObjectContainerCreateInstance create_callback;
+ ObjectFileGetModuleSpecifications get_module_specifications;
+
};
typedef std::vector<ObjectContainerInstance> ObjectContainerInstances;
@@ -1038,12 +1052,10 @@ GetObjectContainerInstances ()
}
bool
-PluginManager::RegisterPlugin
-(
- const char *name,
- const char *description,
- ObjectContainerCreateInstance create_callback
-)
+PluginManager::RegisterPlugin (const char *name,
+ const char *description,
+ ObjectContainerCreateInstance create_callback,
+ ObjectFileGetModuleSpecifications get_module_specifications)
{
if (create_callback)
{
@@ -1053,6 +1065,7 @@ PluginManager::RegisterPlugin
if (description && description[0])
instance.description = description;
instance.create_callback = create_callback;
+ instance.get_module_specifications = get_module_specifications;
Mutex::Locker locker (GetObjectContainerMutex ());
GetObjectContainerInstances ().push_back (instance);
}
@@ -1109,6 +1122,16 @@ PluginManager::GetObjectContainerCreateCallbackForPluginName (const char *name)
return NULL;
}
+ObjectFileGetModuleSpecifications
+PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
+{
+ Mutex::Locker locker (GetObjectContainerMutex ());
+ ObjectContainerInstances &instances = GetObjectContainerInstances ();
+ if (idx < instances.size())
+ return instances[idx].get_module_specifications;
+ return NULL;
+}
+
#pragma mark LogChannel
struct LogInstance
OpenPOWER on IntegriCloud