[LLVMdev] How to read memory data througn adress of unsigned long
Michael.Kang
blackfin.kang at gmail.com
Fri Mar 25 20:53:21 PDT 2011
I have a value of long type and like to get the data at the adress in the value:
#################
unsigned long v = 0xc0008000
Value* addr = ConstantInt::get(getIntegerType(64), v)
####################
Then I try to use LoadInstr to get a load instruction of ir as the following:
############################
Value* data = new LoadInst(addr, "", false, bb);
encounter segmentation fault.
########################
I also try to use IntToPtrInstr to do some transform as the following:
################################
Type const *intptr_type =
cpu->dyncom_engine->exec_engine->getTargetData()->getIntPtrType(_CTX());
Value* ptr = new IntToPtrInst(v, intptr_type, "", bb);
Value* data = new LoadInst(ptr, "", false, bb);
########################################
still encounter segmentation fault
Any person can give me some hints for my case? Thanks in advance. I
have tried a long time with different ways.
Thanks
MK
--
www.skyeye.org
More information about the llvm-dev
mailing list