[Dwarf-Discuss] How to interpret DW_AT_artificial tag?

David Blaikie dblaikie@gmail.com
Fri Mar 4 04:45:05 GMT 2022


On Mon, Feb 28, 2022 at 2:58 PM Michael Eager <eager at eagercon.com> wrote:

> On 2/28/22 13:11, David Blaikie via Dwarf-Discuss wrote:
> > On Mon, Feb 28, 2022 at 12:55 PM Greg Clayton via Dwarf-Discuss
> >     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.
> >
> >
> > Probably the important distinction there is that "this", while
> > artificial, is named/usable in the source whereas the vtable isn't.
> >
> > Either having some DWARF attribute to communicate that distinction, or a
> > workaround might be to detect that the vtable name uses a reserved
> > identifier could be good - I guess the reality is that DWARF consumers
> > probably hardcode some sort of "this is the vtable pointer" -o so maybe
> > we should have some DWARF attribute that communicates that, instead of
> > relying on the string name of the member? Not sure.
>
> This is a peculiarity of C++ where an artificial variable has a user-
> accessible name.  Rather than have a special attribute to distinguish
> this oddity, and since "this" is a reserved word in C++, it seems
> easiest to simply check for this special case if the language is C++.
> You can reasonably hard-code "this" knowing it can't be used for any
> other purpose.  You cannot say the same about vtable pointers which can
> have any (or no) name.
>

Other OO languages have this feature under various names (Java also uses
"this", Swift (& Objective C?) uses "self", for instance - guess there are
probably others), such that it'd probably be nice if consumers didn't have
to hardcode these special cases. I would guess some languages might also
have implicit names for loop variables or other constructs?

Not suggesting this is the highest priority to improve in DWARF, but that
it could be improved if someone felt strongly about it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20220303/0800b79f/attachment.html>



More information about the Dwarf-discuss mailing list