summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-03-09 19:59:28 +0000
committerJim Ingham <jingham@apple.com>2012-03-09 19:59:28 +0000
commit34aae5b9bc8c20895b386e0dbbb67825a5a7129b (patch)
tree2d0c36179935f517d53954a7c1a82d17b1d88d45
parente4775e165981eae6747d7cf9610880ed83b92726 (diff)
downloadbcm5719-llvm-34aae5b9bc8c20895b386e0dbbb67825a5a7129b.tar.gz
bcm5719-llvm-34aae5b9bc8c20895b386e0dbbb67825a5a7129b.zip
Handle the case where we get called to determine the ObjC runtime version BEFORE the loader code has
winnowed all the unloaded libraries from the process module list. <rdar://problem/11015223> llvm-svn: 152427
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 5a341307d65..0cb727b589d 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -260,12 +260,21 @@ AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others
enum ObjCRuntimeVersions
AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
{
- ModuleList &images = process->GetTarget().GetImages();
+ if (!process)
+ return eObjC_VersionUnknown;
+
+ Target &target = process->GetTarget();
+ ModuleList &images = target.GetImages();
size_t num_images = images.GetSize();
for (size_t i = 0; i < num_images; i++)
{
ModuleSP module_sp = images.GetModuleAtIndex(i);
- if (AppleIsModuleObjCLibrary (module_sp))
+ // One tricky bit here is that we might get called as part of the initial module loading, but
+ // before all the pre-run libraries get winnowed from the module list. So there might actually
+ // be an old and incorrect ObjC library sitting around in the list, and we don't want to look at that.
+ // That's why we call IsLoadedInTarget.
+
+ if (AppleIsModuleObjCLibrary (module_sp) && module_sp->IsLoadedInTarget(&target))
{
objc_module_sp = module_sp;
ObjectFile *ofile = module_sp->GetObjectFile();
OpenPOWER on IntegriCloud