diff options
| author | Sean Callanan <scallanan@apple.com> | 2010-12-02 19:47:57 +0000 |
|---|---|---|
| committer | Sean Callanan <scallanan@apple.com> | 2010-12-02 19:47:57 +0000 |
| commit | d7a1ca2a123bd4f853e71a8c647bf680b2a4bc99 (patch) | |
| tree | d0fae34410995a455177efc7fc4d9646757f9aac /lldb/source/Expression/IRForTarget.cpp | |
| parent | 96303ea8532d33695a70517363562f5339f1558e (diff) | |
| download | bcm5719-llvm-d7a1ca2a123bd4f853e71a8c647bf680b2a4bc99.tar.gz bcm5719-llvm-d7a1ca2a123bd4f853e71a8c647bf680b2a4bc99.zip | |
Fixed IRForTarget so that it errors out when function
pointers are used. Previously, they caused a crash
in the JIT because we didn't resolve them correctly.
llvm-svn: 120728
Diffstat (limited to 'lldb/source/Expression/IRForTarget.cpp')
| -rw-r--r-- | lldb/source/Expression/IRForTarget.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index cfe400760cf..fe67417dd60 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -844,6 +844,9 @@ bool IRForTarget::MaybeHandleVariable (Module &llvm_module, Value *llvm_value_ptr) { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + + if (log) + log->Printf("MaybeHandleVariable (%s)\n", PrintValue(llvm_value_ptr).c_str()); if (ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(llvm_value_ptr)) { @@ -854,7 +857,8 @@ IRForTarget::MaybeHandleVariable (Module &llvm_module, Value *llvm_value_ptr) case Instruction::GetElementPtr: case Instruction::BitCast: Value *s = constant_expr->getOperand(0); - MaybeHandleVariable(llvm_module, s); + if (!MaybeHandleVariable(llvm_module, s)) + return false; } } if (GlobalVariable *global_variable = dyn_cast<GlobalVariable>(llvm_value_ptr)) @@ -909,6 +913,13 @@ IRForTarget::MaybeHandleVariable (Module &llvm_module, Value *llvm_value_ptr) value_alignment)) return false; } + else if (llvm::Function *function = dyn_cast<llvm::Function>(llvm_value_ptr)) + { + if (log) + log->Printf("Function pointers aren't handled right now"); + + return false; + } return true; } @@ -916,7 +927,10 @@ IRForTarget::MaybeHandleVariable (Module &llvm_module, Value *llvm_value_ptr) bool IRForTarget::MaybeHandleCallArguments (Module &llvm_module, CallInst *Old) { - // lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + + if (log) + log->Printf("MaybeHandleCallArguments(%s)", PrintValue(Old).c_str()); for (unsigned op_index = 0, num_ops = Old->getNumArgOperands(); op_index < num_ops; @@ -945,11 +959,11 @@ IRForTarget::MaybeHandleCall (Module &llvm_module, CallInst *llvm_call_inst) fun = dyn_cast<Function>(const_expr->getOperand(0)); if (!fun) - return true; + return false; } else { - return true; + return false; } } @@ -1065,6 +1079,9 @@ IRForTarget::ResolveCalls(Module &llvm_module, BasicBlock &basic_block) if (call && !MaybeHandleCall(llvm_module, call)) return false; + + if (call && !MaybeHandleCallArguments(llvm_module, call)) + return false; } return true; |

