[LLVMdev] getFunction() of DISubprogram return 0?

Devang Patel dpatel at apple.com
Mon Jul 25 10:14:37 PDT 2011


Hi,
On Jul 22, 2011, at 6:37 PM, Lu Zhao wrote:

> Hi,
> 
> I'd like to get the Function* that is described by a DISubprogram. I 
> found this method getFunction() in the class. However, when I use it in 
> my code, the function always returns 0. I tried to dig into it and saw 
> that a mysterious number 16 is used in getFunctionField(16). I'm 
> wondering if my failure of the function was caused by my incorrect use, 
> e.g., without fulfilling necessary assumptions by running some passes 
> first, or by that this number was planned but not implemented yet.

It is likely that your front end did not emit include Function * while emitting debugging information entry for a subprogram. Initially, Function * was not part of DISubprogram.

If you wonder how do you determine field number 16 is used for Function * then see, http://llvm.org/docs/SourceLevelDebugging.html#format_subprograms


-
Devang




More information about the llvm-dev mailing list