[LLVMdev] Segment section

Tim Northover t.p.northover at gmail.com
Thu Feb 20 10:46:11 PST 2014


Hi Jasmin,

> During the load process of variable, at some random point during execution
> (loadInst), how can I know (based on instruction or its value) is the
> variable allocated on the stack, in the heap or elsewhere?

I'm afraid I'm still not clear on whether this is execution-time or
before. If you've got a LoadInst, that suggests it's before execution
has started (in which case the question is unanswerable: the answer
can depend on the runtime path the program takes[*]), but on the other
hand you're talking about the interpreter and mentioned "during
execution".

Have you somehow paused the interpreter? Do you want your program to
print out reasonably helpful debugging information at that LoadInst
(and if so, by hacking the interpreter or by modifying the LLVM IR to
do it automatically, or don't you care)? Or am I barking up the wrong
tree entirely?

Cheers.

Tim.

[*] E.g. "int *getVar() { return rand() % 2 ? malloc(sizeof(int)) :
&globalVar; }". Is a LoadInst acting on the result of that function
loading a heap or global variable?



More information about the llvm-dev mailing list