Re: [PATCH] Handle DW_TAG_subrange_type

Joel Brobecker
2003-12-04T17:49:40Z

> Can you post an example of the debug info you see for Ada in this
> case, just for the record?

In addition to the example posted by Andreas, here is the code in GCC
that generates these subrange types:

static dw_die_ref
subrange_type_die (tree type)
{
dw_die_ref subtype_die;
dw_die_ref subrange_die;
tree name = TYPE_NAME (type);

subtype_die = base_type_die (TREE_TYPE (type));

if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);

subrange_die = new_die (DW_TAG_subrange_type, comp_unit_die, type);
add_name_attribute (subrange_die, IDENTIFIER_POINTER (name));
if (TYPE_MIN_VALUE (type) != NULL)
add_bound_info (subrange_die, DW_AT_lower_bound,
TYPE_MIN_VALUE (type));
if (TYPE_MAX_VALUE (type) != NULL)
add_bound_info (subrange_die, DW_AT_upper_bound,
TYPE_MAX_VALUE (type));
add_AT_die_ref (subrange_die, DW_AT_type, subtype_die);

return subrange_die;
}

So the only information we are stuffing in these types are the name,
the bounds, and a reference to the parent type.

--
Joel