diff options
author | Enrico Granata <egranata@apple.com> | 2014-03-25 20:53:33 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2014-03-25 20:53:33 +0000 |
commit | afcbdb1570db71e6488bfb8ae064329aa9c0e683 (patch) | |
tree | 8a0eb115b20966a1d27b6ca2a7d677d57a12659d /lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp | |
parent | f596145ac52f9ef814f380ff258d984a1e65a788 (diff) | |
download | bcm5719-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.cpp | 26 |
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) { |