getFunction() of DISubprogram return 0?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

getFunction() of DISubprogram return 0?

Lu Zhao
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.

Thanks.
Lu
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: getFunction() of DISubprogram return 0?

Devang Patel
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

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev