diff options
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp')
| -rw-r--r-- | lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp index 0cc96e43e195..b387de38d3bf 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp @@ -19,8 +19,9 @@ #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/Variable.h" -#include "lldb/Target/Target.h" #include "lldb/Target/ABI.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Timer.h" @@ -36,7 +37,7 @@ char ObjCLanguageRuntime::ID = 0; ObjCLanguageRuntime::~ObjCLanguageRuntime() = default; ObjCLanguageRuntime::ObjCLanguageRuntime(Process *process) - : LanguageRuntime(process), m_impl_cache(), + : LanguageRuntime(process), m_impl_cache(), m_impl_str_cache(), m_has_new_literals_and_indexing(eLazyBoolCalculate), m_isa_to_descriptor(), m_hash_to_isa_map(), m_type_size_cache(), m_isa_to_descriptor_stop_id(UINT32_MAX), m_complete_class_cache(), @@ -63,7 +64,7 @@ bool ObjCLanguageRuntime::AddClass(ObjCISA isa, void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr) { - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); + Log *log = GetLog(LLDBLog::Step); if (log) { LLDB_LOGF(log, "Caching: class 0x%" PRIx64 " selector 0x%" PRIx64 @@ -74,6 +75,18 @@ void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr, ClassAndSel(class_addr, selector), impl_addr)); } +void ObjCLanguageRuntime::AddToMethodCache(lldb::addr_t class_addr, + llvm::StringRef sel_str, + lldb::addr_t impl_addr) { + Log *log = GetLog(LLDBLog::Step); + + LLDB_LOG(log, "Caching: class {0} selector {1} implementation {2}.", + class_addr, sel_str, impl_addr); + + m_impl_str_cache.insert(std::pair<ClassAndSelStr, lldb::addr_t>( + ClassAndSelStr(class_addr, sel_str), impl_addr)); +} + lldb::addr_t ObjCLanguageRuntime::LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t selector) { MsgImplMap::iterator pos, end = m_impl_cache.end(); @@ -83,6 +96,15 @@ lldb::addr_t ObjCLanguageRuntime::LookupInMethodCache(lldb::addr_t class_addr, return LLDB_INVALID_ADDRESS; } +lldb::addr_t ObjCLanguageRuntime::LookupInMethodCache(lldb::addr_t class_addr, + llvm::StringRef sel_str) { + MsgImplStrMap::iterator pos, end = m_impl_str_cache.end(); + pos = m_impl_str_cache.find(ClassAndSelStr(class_addr, sel_str)); + if (pos != end) + return (*pos).second; + return LLDB_INVALID_ADDRESS; +} + lldb::TypeSP ObjCLanguageRuntime::LookupInCompleteClassCache(ConstString &name) { CompleteClassMap::iterator complete_class_iter = |
