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.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109938 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index 694c59d..7e733e4 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -204,6 +204,39 @@
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 @@
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 @@
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 @@
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);
}