Bill O'Hara via llvm-dev
2018-Apr-05 20:22 UTC
[llvm-dev] print signature of function from dwarf info in file?
Hi I'm using llvm-5. Browsing the source of llvm-dwarfdump and trying it on some shared libraries, I see I can print the debug info (assuming it exists). For some function, I'm wondering if there's a short cut to prettyprinting the signature of a function in the library? I think, looking at the output, that enough information exists but it seems to involve looking at the subprogram and then chasing references to parameters elsewhere in the debug info and so on. Browsing the llvm headers, I see classes like DISubprogram which appear to represent a function. But no obvious way to get to a string for the function signature. Can someone point me in the right direction? TIA! bill -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180405/eb27e808/attachment.html>
incertia via llvm-dev
2018-Apr-05 20:29 UTC
[llvm-dev] print signature of function from dwarf info in file?
>From my understanding, the LLVM classes are just representing the DWARFinformation without doing any extra work, so I am afraid that you will have to explicitly chase through all the DWARF information yourself. On 4/5/2018 3:22 PM, Bill O'Hara via llvm-dev wrote:> Hi > > I'm using llvm-5. Browsing the source of llvm-dwarfdump and trying it on > some shared libraries, I see I can print the debug info (assuming it > exists). For some function, I'm wondering if there's a short cut to > prettyprinting the signature of a function in the library? I think, > looking at the output, that enough information exists but it seems to > involve looking at the subprogram and then chasing references to > parameters elsewhere in the debug info and so on. > > Browsing the llvm headers, I see classes like DISubprogram which appear > to represent a function. But no obvious way to get to a string for the > function signature. > > Can someone point me in the right direction? > > TIA! > bill > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Will
via llvm-dev
2018-Apr-05 21:53 UTC
[llvm-dev] print signature of function from dwarf info in file?
> -----Original Message----- > From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of > incertia via llvm-dev > Sent: Thursday, April 05, 2018 4:30 PM > To: llvm-dev at lists.llvm.org > Subject: Re: [llvm-dev] print signature of function from dwarf info in > file? > > From my understanding, the LLVM classes are just representing the DWARF > information without doing any extra work, so I am afraid that you will > have to explicitly chase through all the DWARF information yourself.That's mostly true. The only exception is if the function was written in C++, and the subprogram entry has a DW_AT_linkage_name attribute, that will be the C++ mangled name, and you could demangle that. Aside from that case, you would need to troll through the DWARF to find the function's return type and parameters, and pretty-print those.> > On 4/5/2018 3:22 PM, Bill O'Hara via llvm-dev wrote: > > Hi > > > > I'm using llvm-5. Browsing the source of llvm-dwarfdump and trying it on > > some shared libraries, I see I can print the debug info (assuming it > > exists). For some function, I'm wondering if there's a short cut to > > prettyprinting the signature of a function in the library? I think, > > looking at the output, that enough information exists but it seems to > > involve looking at the subprogram and then chasing references to > > parameters elsewhere in the debug info and so on. > > > > Browsing the llvm headers, I see classes like DISubprogram which appear > > to represent a function. But no obvious way to get to a string for the > > function signature.DISubprogram and friends are internal structures built by the front-end to pass information to the back-end; the back-end converts those into DWARF, and DWARF is what you'll see in an object file. (Or CodeView, in a Windows object.) --paulr> > > > Can someone point me in the right direction? > > > > TIA! > > bill > > > > > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > > -- > Will > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev