summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-08-03 01:03:17 +0000
committerJim Ingham <jingham@apple.com>2011-08-03 01:03:17 +0000
commitb53cb271ca371737a0114cb5b61688e6f523e73e (patch)
treebe7eb8078b6203731dd69d8b308cba44afa9e5b9 /lldb/source/Core/Module.cpp
parente716ae02a9e1178a9e2c386fa6220b65a7329cfb (diff)
downloadbcm5719-llvm-b53cb271ca371737a0114cb5b61688e6f523e73e.tar.gz
bcm5719-llvm-b53cb271ca371737a0114cb5b61688e6f523e73e.zip
Add method Module::IsLoadedInTarget, and then in the MacOS X dynamic loader, after we
have initialized our shared library state, discard all the modules that didn't make it into the running process. llvm-svn: 136755
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 28780f4f99a..0e5f67a0ba6 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -690,6 +690,29 @@ Module::IsExecutable ()
return GetObjectFile()->IsExecutable();
}
+bool
+Module::IsLoadedInTarget (Target *target)
+{
+ ObjectFile *obj_file = GetObjectFile();
+ if (obj_file)
+ {
+ SectionList *sections = obj_file->GetSectionList();
+ if (sections != NULL)
+ {
+ size_t num_sections = sections->GetSize();
+ bool loaded = false;
+ for (size_t sect_idx = 0; sect_idx < num_sections; sect_idx++)
+ {
+ SectionSP section_sp = sections->GetSectionAtIndex(sect_idx);
+ if (section_sp->GetLoadBaseAddress(target) != LLDB_INVALID_ADDRESS)
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
bool
Module::SetArchitecture (const ArchSpec &new_arch)
{
OpenPOWER on IntegriCloud