summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-07-31 01:32:05 +0000
committerSean Callanan <scallanan@apple.com>2010-07-31 01:32:05 +0000
commit5300d37aa743418298ebb36c5041b71674d9cb8e (patch)
tree6fe029c0dc8f459501c238db76eae7d05a1d83a1 /lldb/source/Expression/ClangExpressionDeclMap.cpp
parent0e11955c7a128b61884576500261603f427979b8 (diff)
downloadbcm5719-llvm-5300d37aa743418298ebb36c5041b71674d9cb8e.tar.gz
bcm5719-llvm-5300d37aa743418298ebb36c5041b71674d9cb8e.zip
Added support for rewriting objc_msgSend so we can
call Objective-C methods from expressions. Also added some more logging to the function-calling thread plan so that we can see the registers when a function finishes. Also documented things maybe a bit better. llvm-svn: 109938
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 694c59d0936..7e733e4ce0b 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -204,6 +204,39 @@ ClangExpressionDeclMap::GetFunctionInfo (const clang::NamedDecl *decl,
return false;
}
+bool
+ClangExpressionDeclMap::GetFunctionAddress (const char *name,
+ uint64_t &ptr)
+{
+ // Back out in all cases where we're not fully initialized
+ if (!m_exe_ctx || !m_exe_ctx->frame || !m_sym_ctx)
+ return false;
+
+ ConstString name_cs(name);
+ SymbolContextList sym_ctxs;
+
+ m_sym_ctx->FindFunctionsByName(name_cs, false, sym_ctxs);
+
+ if (!sym_ctxs.GetSize())
+ return false;
+
+ SymbolContext sym_ctx;
+ sym_ctxs.GetContextAtIndex(0, sym_ctx);
+
+ const Address *fun_address;
+
+ if (sym_ctx.function)
+ fun_address = &sym_ctx.function->GetAddressRange().GetBaseAddress();
+ else if (sym_ctx.symbol)
+ fun_address = &sym_ctx.symbol->GetAddressRangeRef().GetBaseAddress();
+ else
+ return false;
+
+ ptr = fun_address->GetLoadAddress(m_exe_ctx->process);
+
+ return true;
+}
+
// Interface for DwarfExpression
lldb_private::Value
*ClangExpressionDeclMap::GetValueForIndex (uint32_t index)
@@ -547,7 +580,7 @@ ClangExpressionDeclMap::FindVariableInScope(const SymbolContext &sym_ctx,
if (type->GetASTContext() == var->GetType()->GetClangAST())
{
- if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type, var->GetType()->GetOpaqueClangQualType()))
+ if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetOpaqueQualType(), var->GetType()->GetOpaqueClangQualType()))
continue;
}
else
@@ -778,7 +811,7 @@ ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
m_tuples.push_back(tuple);
if (log)
- log->PutCString("Found variable");
+ log->Printf("Found variable %s, returned (NamedDecl)%p", context.Name.getAsString().c_str(), var_decl);
}
void
@@ -851,5 +884,5 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
m_tuples.push_back(tuple);
if (log)
- log->PutCString("Found function");
+ log->Printf("Found function %s, returned (NamedDecl)%p", context.Name.getAsString().c_str(), fun_decl);
}
OpenPOWER on IntegriCloud