[LLVMdev] Identifying functions writing to memory at LLVM-IR level

Saeed, Ahmed Ahmed.Saeed at gcu.ac.uk
Thu May 29 09:04:54 PDT 2014


Dear All,


I am new to LLVM and using it create a simple pass for array bounds checking.

How can i retrieve pointer to a memory area that is accessed by a function call . I have written a Pass that can intercept function calls and detect whether it is writing to a memory on not using Instruction::mayWriteToMemory(). Whether a function accessing memory or not can be checked by Instruction::mayReadFromMemory() and Instruction::mayWriteToMemory() but how can i get staring address of those memory areas (program variables) that are being written by.

For example, for the c code
int main(){
char arrd[]="This is destination ";
char arrs[]="COPIED STRING";
strcpy(arrd, arrs);
printf("Final copied string : %s\n", arrd);
return 0;
}
Does LLVM at IR level provide such functionality to intercept call to "strcpy" and provide starting and end address of any data variables being written by it?

Regards,

Ahmed Saeed,
Research Student,
Glasgow Caledonian University, UK.


Glasgow Caledonian University is a registered Scottish charity, number SC021474
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140529/f74978e3/attachment.html>


More information about the llvm-dev mailing list