This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] libdw: Add dwarf_peel_type. Use it in dwarf_aggregate_size.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 10 Oct 2014 11:42:50 -0700
- Subject: Re: [PATCH] libdw: Add dwarf_peel_type. Use it in dwarf_aggregate_size.
The description in your prologue and the libdw.h comment do not match what
the code actually does. You describe it as going until it hits one of the
known categories of actual type. But what it actually does is go only as
long as it is seeing one of the known categories of wrapper type. I'm not
really sure which it should do (or if it should instead do something
different from either), but the description should match the behavior.
As described, it would fall down if a new tag were introduced for a new
category of actual type. As implemented, it would fall down if a new tag
were introduced for a new category of wrapper type.
A third potential approach would be to attempt future-proofing for those
cases. That is, just keep going as long as there is a DW_AT_type
attribute. But that would need a special case for DW_TAG_pointer_type and
DW_TAG_reference_type, where you want to stop even though it has a
DW_AT_type referring to another type. I can't think of any other cases
where an "actual" type has a DW_AT_type, but there might well be some. If
any new tag were like DW_TAG_pointer_type rather than like
DW_TAG_const_type et al, then this approach would fall down there.
So firstly we need to decide which kinds of future addition we expect and
thus how to handle the future-proofing. Then we need to have descriptions
and implementation that match.