[LLVMdev] MallocInst/CallInst bitcast,

Chris Lattner clattner at apple.com
Fri Oct 16 09:26:45 PDT 2009


On Oct 16, 2009, at 4:43 AM, Daniel Waterworth wrote:

> Never mind, I used ExecutionEngine's InstallLazyFunctionCreator and  
> DisableSymbolSearching to cause malloc and free calls to be handled  
> by my logging functions. Sorry for the unnecessary list mail.

No problem, this is a better way to go.  The MallocInst and FreeInst  
instructions are about to be removed from LLVM IR.  Malloc and free  
will be represented normal 'call' instructions.

> Is it possible to find out the size and beginning pointer of the  
> current stack frame, from a function operating outside of the  
> virtual machine, but called by a function within it?

I don't think so.  Typically, applications that need this sort of  
thing get the address of the function and then do a fuzzy disassembly  
of the prolog.

-Chris

>
> Thanks,
>
> Daniel
>
> 2009/10/16 Daniel Waterworth <da.waterworth at googlemail.com>
> Hello,
>
> I'm writing a virtual machine that functions as a sandbox based on  
> llvm. In order to prevent programs from accessing memory that has  
> not been allocated to them, I want to replace calls to malloc and  
> free with calls to a logged functions that will record the memory  
> that is being allocated to the program. Is it possible to cast/ 
> convert a MallocInst or FreeInst to a CallInst?
>
> Thanks,
>
> Daniel
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091016/efa96b69/attachment.html>


More information about the llvm-dev mailing list