summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 2d2e4058159..2c8f3489d81 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -251,6 +251,32 @@ AppleObjCRuntime::AppleIsModuleObjCLibrary (const ModuleSP &module_sp)
return false;
}
+// we use the version of Foundation to make assumptions about the ObjC runtime on a target
+uint32_t
+AppleObjCRuntime::GetFoundationVersion ()
+{
+ if (!m_Foundation_major.hasValue())
+ {
+ const ModuleList& modules = m_process->GetTarget().GetImages();
+ uint32_t major = UINT32_MAX;
+ for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
+ {
+ lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
+ if (!module_sp)
+ continue;
+ if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),"Foundation") == 0)
+ {
+ module_sp->GetVersion(&major,1);
+ m_Foundation_major = major;
+ return major;
+ }
+ }
+ return LLDB_INVALID_MODULE_VERSION;
+ }
+ else
+ return m_Foundation_major.getValue();
+}
+
bool
AppleObjCRuntime::IsModuleObjCLibrary (const ModuleSP &module_sp)
{
OpenPOWER on IntegriCloud