summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2014-03-25 20:53:33 +0000
committerEnrico Granata <egranata@apple.com>2014-03-25 20:53:33 +0000
commitafcbdb1570db71e6488bfb8ae064329aa9c0e683 (patch)
tree8a0eb115b20966a1d27b6ca2a7d677d57a12659d /lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
parentf596145ac52f9ef814f380ff258d984a1e65a788 (diff)
downloadbcm5719-llvm-afcbdb1570db71e6488bfb8ae064329aa9c0e683.tar.gz
bcm5719-llvm-afcbdb1570db71e6488bfb8ae064329aa9c0e683.zip
<rdar://problem/14515139>
Add a GetFoundationVersion() to AppleObjCRuntime This API is used to return and cache the major version of Foundation.framework, which is potentially a useful piece of data to key off of to enable or disable certain ObjC related behaviors (especially in data formatters) llvm-svn: 204756
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