[Lldb-commits] [lldb] r169063 - /lldb/trunk/source/Expression/IRInterpreter.cpp
Sean Callanan
scallanan at apple.com
Fri Nov 30 16:09:34 PST 2012
Author: spyffe
Date: Fri Nov 30 18:09:34 2012
New Revision: 169063
URL: http://llvm.org/viewvc/llvm-project?rev=169063&view=rev
Log:
Added support for PtrToInt to the IR
interpreter.
<rdar://problem/12657742>
Modified:
lldb/trunk/source/Expression/IRInterpreter.cpp
Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=169063&r1=169062&r2=169063&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Fri Nov 30 18:09:34 2012
@@ -558,6 +558,7 @@
default:
return false;
case Instruction::IntToPtr:
+ case Instruction::PtrToInt:
case Instruction::BitCast:
return ResolveConstantValue(value, constant_expr->getOperand(0));
case Instruction::GetElementPtr:
@@ -991,6 +992,7 @@
}
break;
case Instruction::IntToPtr:
+ case Instruction::PtrToInt:
case Instruction::Load:
case Instruction::Mul:
case Instruction::Ret:
@@ -1506,6 +1508,42 @@
}
}
break;
+ case Instruction::PtrToInt:
+ {
+ const PtrToIntInst *ptr_to_int_inst = dyn_cast<PtrToIntInst>(inst);
+
+ if (!ptr_to_int_inst)
+ {
+ if (log)
+ log->Printf("getOpcode() returns PtrToInt, but instruction is not an PtrToIntInst");
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
+ return false;
+ }
+
+ Value *src_operand = ptr_to_int_inst->getOperand(0);
+
+ lldb_private::Scalar I;
+
+ if (!frame.EvaluateValue(I, src_operand, llvm_module))
+ {
+ if (log)
+ log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
+ return false;
+ }
+
+ frame.AssignValue(inst, I, llvm_module);
+
+ if (log)
+ {
+ log->Printf("Interpreted a PtrToInt");
+ log->Printf(" Src : %s", frame.SummarizeValue(src_operand).c_str());
+ log->Printf(" = : %s", frame.SummarizeValue(inst).c_str());
+ }
+ }
+ break;
case Instruction::Load:
{
const LoadInst *load_inst = dyn_cast<LoadInst>(inst);
More information about the lldb-commits
mailing list