[Lldb-commits] [lldb] r145554 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h source/Expression/ClangExpressionDeclMap.cpp source/Expression/IRForTarget.cpp
Sean Callanan
scallanan at apple.com
Wed Nov 30 18:04:16 PST 2011
Author: spyffe
Date: Wed Nov 30 20:04:16 2011
New Revision: 145554
URL: http://llvm.org/viewvc/llvm-project?rev=145554&view=rev
Log:
Made symbol lookup in the expression parser more
robust:
- Now a client can specify what kind of symbols
are needed; notably, this allows looking up
Objective-C class symbols specifically.
- In the class of symbols being looked up, if
one is non-NULL and others are NULL, LLDB now
prefers the non-NULL one.
Modified:
lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=145554&r1=145553&r2=145554&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Wed Nov 30 20:04:16 2011
@@ -336,10 +336,12 @@
//------------------------------------------------------------------
lldb::addr_t
GetSymbolAddress (Target &target,
- const ConstString &name);
+ const ConstString &name,
+ lldb::SymbolType symbol_type);
lldb::addr_t
- GetSymbolAddress (const ConstString &name);
+ GetSymbolAddress (const ConstString &name,
+ lldb::SymbolType symbol_type);
//------------------------------------------------------------------
/// [Used by IRInterpreter] Get basic target information.
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=145554&r1=145553&r2=145554&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Nov 30 20:04:16 2011
@@ -718,16 +718,16 @@
}
addr_t
-ClangExpressionDeclMap::GetSymbolAddress (Target &target, const ConstString &name)
+ClangExpressionDeclMap::GetSymbolAddress (Target &target, const ConstString &name, lldb::SymbolType symbol_type)
{
SymbolContextList sc_list;
- target.GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeAny, sc_list);
+ target.GetImages().FindSymbolsWithNameAndType(name, symbol_type, sc_list);
const uint32_t num_matches = sc_list.GetSize();
addr_t symbol_load_addr = LLDB_INVALID_ADDRESS;
- for (uint32_t i=0; i<num_matches && symbol_load_addr == LLDB_INVALID_ADDRESS; i++)
+ for (uint32_t i=0; i<num_matches && (symbol_load_addr == 0 || symbol_load_addr == LLDB_INVALID_ADDRESS); i++)
{
SymbolContext sym_ctx;
sc_list.GetContextAtIndex(i, sym_ctx);
@@ -778,7 +778,7 @@
}
addr_t
-ClangExpressionDeclMap::GetSymbolAddress (const ConstString &name)
+ClangExpressionDeclMap::GetSymbolAddress (const ConstString &name, lldb::SymbolType symbol_type)
{
assert (m_parser_vars.get());
@@ -786,7 +786,7 @@
!m_parser_vars->m_exe_ctx->GetTargetPtr())
return false;
- return GetSymbolAddress(m_parser_vars->m_exe_ctx->GetTargetRef(), name);
+ return GetSymbolAddress(m_parser_vars->m_exe_ctx->GetTargetRef(), name, symbol_type);
}
// Interface for IRInterpreter
@@ -1741,7 +1741,7 @@
}
else if (sym)
{
- addr_t location_load_addr = GetSymbolAddress(*target, name);
+ addr_t location_load_addr = GetSymbolAddress(*target, name, lldb::eSymbolTypeAny);
if (location_load_addr == LLDB_INVALID_ADDRESS)
{
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=145554&r1=145553&r2=145554&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Wed Nov 30 20:04:16 2011
@@ -1676,7 +1676,7 @@
lldb_private::ConstString name(symbol->getName().str().c_str());
- lldb::addr_t symbol_addr = m_decl_map->GetSymbolAddress (name);
+ lldb::addr_t symbol_addr = m_decl_map->GetSymbolAddress (name, lldb::eSymbolTypeAny);
if (symbol_addr == LLDB_INVALID_ADDRESS)
{
@@ -1748,7 +1748,7 @@
StringRef name(initializer->getName());
lldb_private::ConstString name_cstr(name.str().c_str());
- lldb::addr_t class_ptr = m_decl_map->GetSymbolAddress(name_cstr);
+ lldb::addr_t class_ptr = m_decl_map->GetSymbolAddress(name_cstr, lldb::eSymbolTypeRuntime);
if (log)
log->Printf("Found reference to Objective-C class %s (0x%llx)", name_cstr.AsCString(), (unsigned long long)class_ptr);
More information about the lldb-commits
mailing list