[Dwarf-Discuss] How to interpret DW_AT_artificial tag?
Mon Feb 28 20:55:38 GMT 2022
> On Feb 28, 2022, at 5:49 AM, Ron Louzon via Dwarf-Discuss <dwarf-discuss at lists.dwarfstd.org> wrote:
> I have an application which uses DwarfLib to extract type information from debug executable images. I have found in the DWARF data that some structure types have a "virtual" pointer added as their first member and this pointer's DIE contains the tag DW_AT_artificial=true. How does that pointer member affect the offsets of the members that follow it in the structure.
This will cause all other members to be pushed out by a pointer size.
> Should this 4-byte pointer be ignored or will its size cause the other structure members to be pushed out in memory by 4 bytes?
All offsets in the DWARF should be correct for all members, including artificial members and any members that follow it in memory. So yes, if there is a vtable pointer added as the first member, its offset and all other offsets will be correct, so there is no need to adjust anything when reading this data.
You could choose to not show this, but I find it is often easier to show this information in case some compiler change in the future marks something that you might want to see as artificial. For example the "this" parameter to C++ methods is marked as artificial, and people do want to see the "this" in the variables view. Granted that is a variable vs a member variable.
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Dwarf-discuss