[Dwarf-Discuss] How to interpret DW_AT_artificial tag?

Greg Clayton clayborg@gmail.com
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.

> thanks,
> ron
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20220228/02b7fd01/attachment-0001.html>

More information about the Dwarf-discuss mailing list