Hi I was wondering whether I can extract the function signature from the dwarf debugging information or symbol table. I mean the argument list and the return variables. I know that in dwarf debugging information, a subprogram represents a function. However, I could not find the information that is related to the function signature. Any ideas? Many Thanks Regards Muhui -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180930/edcfe583/attachment.html>
The subprogram DIE provides the return type in DW_AT_type. Formal parameters are described using children of the subprogram DIE; note that the formal_parameter DIEs are required to be in the correct order, but are not required to be consective (that is, you need to look at all the direct children of the subprogram DIE). Also, implicit parameters will be described explicitly in the DWARF; this includes things like a hidden return-value pointer, or the 'this' pointer for a C++ class method. Implicit parameters ought to have the DW_AT_artificial flag. Hope this helps, --paulr From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Muhui Jiang via llvm-dev Sent: Saturday, September 29, 2018 9:09 AM To: llvm-dev Subject: [llvm-dev] Function Signature Hi I was wondering whether I can extract the function signature from the dwarf debugging information or symbol table. I mean the argument list and the return variables. I know that in dwarf debugging information, a subprogram represents a function. However, I could not find the information that is related to the function signature. Any ideas? Many Thanks Regards Muhui -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180929/083c58bb/attachment.html>
Also you can just find the DW_TAG_subprogram entry for the interesting function then look at DW_AT_linkage_name and demangle it. Although if it's a C function, this won't work because it's not mangled. This is easier than enumerating children recursively, but does not cover all possible use cases. On Sat, Sep 29, 2018 at 9:56 AM via llvm-dev <llvm-dev at lists.llvm.org> wrote:> The subprogram DIE provides the return type in DW_AT_type. Formal > parameters are described using children of the subprogram DIE; note that > the formal_parameter DIEs are required to be in the correct order, but are > not required to be consective (that is, you need to look at all the direct > children of the subprogram DIE). Also, implicit parameters will be > described explicitly in the DWARF; this includes things like a hidden > return-value pointer, or the 'this' pointer for a C++ class method. > Implicit parameters ought to have the DW_AT_artificial flag. > > > > Hope this helps, > > --paulr > > > > *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf Of *Muhui > Jiang via llvm-dev > *Sent:* Saturday, September 29, 2018 9:09 AM > *To:* llvm-dev > *Subject:* [llvm-dev] Function Signature > > > > Hi > > > > I was wondering whether I can extract the function signature from the > dwarf debugging information or symbol table. I mean the argument list and > the return variables. > > > > I know that in dwarf debugging information, a subprogram represents a > function. However, I could not find the information that is related to the > function signature. Any ideas? Many Thanks > > > > Regards > > Muhui > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180929/2552703d/attachment.html>
Reasonably Related Threads
- print signature of function from dwarf info in file?
- [LLVMdev] Wrong type qualifier for this pointer in case of ARM compiled binary
- A question to the DWARF experts on symbol indirection
- Debug info scope of explicit casting type does not seem correct
- Debug info scope of explicit casting type does not seem correct