summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-09-08 20:04:08 +0000
committerSean Callanan <scallanan@apple.com>2010-09-08 20:04:08 +0000
commitafa4237d9bb155e5b28b5626d2e07757895b0153 (patch)
tree6f5eab264edca777d1321e17bfd17ab8628fcc20
parent22658bc0b7bdf89023bb7e7f0127e7b22aff7ec8 (diff)
downloadbcm5719-llvm-afa4237d9bb155e5b28b5626d2e07757895b0153.tar.gz
bcm5719-llvm-afa4237d9bb155e5b28b5626d2e07757895b0153.zip
Fixed an expression parser bug that prevented
certain functions from being resolved correctly. Some functions (particularly varargs functions) are BitCast before being called, and the problem was that a CallInst where getCalledValue() returned a BitCast ConstantExpr was not being relocated at all. This problem should now be resolved for the case of BitCast. llvm-svn: 113396
-rw-r--r--lldb/source/Expression/ClangFunction.cpp6
-rw-r--r--lldb/source/Expression/IRDynamicChecks.cpp12
-rw-r--r--lldb/source/Expression/IRForTarget.cpp18
3 files changed, 35 insertions, 1 deletions
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index 3044d51ed69..7e0f531945a 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -460,8 +460,14 @@ ClangFunction::ExecuteFunction (
if (call_plan_sp == NULL)
return eExecutionSetupError;
+//#define SINGLE_STEP_EXPRESSIONS
+
+#ifdef SINGLE_STEP_EXPRESSIONS
+ return eExecutionInterrupted;
+#else
call_plan_sp->SetPrivate(true);
exe_ctx.thread->QueueThreadPlan(call_plan_sp, true);
+#endif
// We need to call the function synchronously, so spin waiting for it to return.
// If we get interrupted while executing, we're going to lose our context, and
diff --git a/lldb/source/Expression/IRDynamicChecks.cpp b/lldb/source/Expression/IRDynamicChecks.cpp
index f2ce5b2d84f..0f98123e471 100644
--- a/lldb/source/Expression/IRDynamicChecks.cpp
+++ b/lldb/source/Expression/IRDynamicChecks.cpp
@@ -343,6 +343,18 @@ IRDynamicChecks::runOnModule(llvm::Module &M)
if (!vpc.Instrument())
return false;
+ if (log)
+ {
+ std::string s;
+ raw_string_ostream oss(s);
+
+ M.print(oss, NULL);
+
+ oss.flush();
+
+ log->Printf("Module after dynamic checks: \n%s", s.c_str());
+ }
+
return true;
}
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp
index 345ae349633..e220b16f00c 100644
--- a/lldb/source/Expression/IRForTarget.cpp
+++ b/lldb/source/Expression/IRForTarget.cpp
@@ -579,7 +579,23 @@ IRForTarget::MaybeHandleCall(Module &M,
Function *fun = C->getCalledFunction();
if (fun == NULL)
- return true;
+ {
+ Value *val = C->getCalledValue();
+
+ ConstantExpr *const_expr = dyn_cast<ConstantExpr>(val);
+
+ if (const_expr && const_expr->getOpcode() == Instruction::BitCast)
+ {
+ fun = dyn_cast<Function>(const_expr->getOperand(0));
+
+ if (!fun)
+ return true;
+ }
+ else
+ {
+ return true;
+ }
+ }
clang::NamedDecl *fun_decl = DeclForGlobalValue(M, fun);
uint64_t fun_addr;
OpenPOWER on IntegriCloud