2010-09-23 10:01:19 +08:00
|
|
|
//===-- CPPLanguageRuntime.cpp -------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2010-09-30 08:54:27 +08:00
|
|
|
#include "clang/AST/Type.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
|
2010-09-28 09:25:32 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
#include "lldb/Core/PluginManager.h"
|
2010-09-30 08:54:27 +08:00
|
|
|
#include "lldb/Core/ValueObject.h"
|
|
|
|
#include "lldb/Symbol/ClangASTContext.h"
|
2010-09-28 09:25:32 +08:00
|
|
|
#include "lldb/Target/ObjCLanguageRuntime.h"
|
2010-09-23 10:01:19 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Destructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
ObjCLanguageRuntime::~ObjCLanguageRuntime()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) :
|
|
|
|
LanguageRuntime (process)
|
|
|
|
{
|
|
|
|
|
2010-09-28 09:25:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
log->Printf ("Caching: class 0x%llx selector 0x%llx implementation 0x%llx.", class_addr, selector, impl_addr);
|
|
|
|
}
|
|
|
|
m_impl_cache.insert (std::pair<ClassAndSel,lldb::addr_t> (ClassAndSel(class_addr, selector), impl_addr));
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::addr_t
|
|
|
|
ObjCLanguageRuntime::LookupInMethodCache (lldb::addr_t class_addr, lldb::addr_t selector)
|
|
|
|
{
|
|
|
|
MsgImplMap::iterator pos, end = m_impl_cache.end();
|
|
|
|
pos = m_impl_cache.find (ClassAndSel(class_addr, selector));
|
|
|
|
if (pos != end)
|
|
|
|
return (*pos).second;
|
|
|
|
return LLDB_INVALID_ADDRESS;
|
|
|
|
}
|