dyninst icon indicating copy to clipboard operation
dyninst copied to clipboard

Initial support for parsing vtables out of DWARF information

Open mplegendre opened this issue 4 years ago • 3 comments

I took a stab at adding vtable support to SymtabAPI via the DW_AT_vtable_elem_location attribute in DWARF for #1173 .

This is only a prototype. It parses the attribute and adds vtable information to SymtabAPI internal data structures. I haven't finalized a public interface, nor added tests or documentation.

BUT, I don't think the DW_AT_vtable_elem_location fields are accurate. With GCC compilers, I'm missing information about destructors. With clang compilers, the info is all over the place, with different functions occupying the same slots in the same class's vtable. Based on inspection with dwarfdump, I think this code is reading DW_AT_vtable_elem_location information correctly and it's the compilers that are wrong. Or, I've got a bug/misunderstanding.

So I'm not immediately sure how to proceed. @woodard , any insight?

mplegendre avatar Dec 18 '21 02:12 mplegendre

@woodard @mplegendre do you have a simple script (or library example in spack) that will generate dwarf with this attribute? I'm testing in Go so I can look at how it works and the standard libs that I use (tcl and libtest) don't have it.

vsoch avatar Dec 20 '21 18:12 vsoch

I'm using these as examples - will try different compilers next in case that's the issue. https://www.geeksforgeeks.org/virtual-function-cpp/

vsoch avatar Dec 20 '21 18:12 vsoch

Also one thing I think could be an extra check - DW_AT_virtuality (here in Go) and here for docs should be set if it's virtual.

vsoch avatar Dec 20 '21 18:12 vsoch