case DW_AT_byte_size:
case DW_AT_byte_stride:
- case DW_AT_bit_offset:
case DW_AT_bit_size:
+ case DW_AT_bit_offset:
+ case DW_AT_bit_stride:
case DW_AT_lower_bound:
case DW_AT_upper_bound:
case DW_AT_count:
case DW_AT_allocated:
case DW_AT_associated:
- return VS(reference) | VS(constant);
+ return VS(reference) | VS(constant) | VS(location); // XXX non-loc expr
case DW_AT_stmt_list:
return VS(lineptr);
case DW_AT_start_scope:
return VS(constant);
- case DW_AT_bit_stride:
case DW_AT_binary_scale:
case DW_AT_decimal_scale:
case DW_AT_decimal_sign:
dwarf::value_space
dwarf::attr_value::what_space () const
{
+ unsigned int expected = expected_value_space (dwarf_whatattr (thisattr ()),
+ _m_tag);
unsigned int possible = 0;
-
switch (dwarf_whatform (thisattr ()))
{
case DW_FORM_flag:
case DW_FORM_block4:
/* Location expression or target constant. */
possible = VS(location) | VS(constant);
+ if ((expected & possible) == possible)
+ /* When both are expected, a block is a location expression. */
+ return VS_location;
break;
case DW_FORM_data1:
| VS(source_file) | VS(source_line) | VS(source_column)
| VS(location) // loclistptr
| VS(lineptr) | VS(macptr) | VS(rangelistptr));
+ if ((expected & possible) == (VS(constant) | VS(location)))
+ /* When both are expected, a constant is not a loclistptr. */
+ return VS_constant;
break;
case DW_FORM_string:
throw std::runtime_error ("XXX bad form");
}
- unsigned int expected = expected_value_space (dwarf_whatattr (thisattr ()),
- _m_tag);
if (unlikely ((expected & possible) == 0))
{
if (expected == 0 && possible == (VS(unit_reference) | VS(reference)))
{
if (is_list ())
return hex_string (_m_attr.constant (), "#");
- return "XXX";
+ return "XXX-expr";
}
if (die.has_children ())
{
- if (indent >= limit)
+ if (limit != 0 && indent >= limit)
{
cout << ">...\n";
return;
cout << file << ":\n";
- if (limit > 0)
- for (dwarf::compile_units::const_iterator i = dw.compile_units ().begin ();
- i != dw.compile_units ().end ();
- ++i)
- print_die (*i, 1, limit);
+ for (dwarf::compile_units::const_iterator i = dw.compile_units ().begin ();
+ i != dw.compile_units ().end ();
+ ++i)
+ print_die (*i, 1, limit);
}
int
cout << hex << setiosflags (ios::showbase);
- unsigned int depth = 1;
+ unsigned int depth = 0;
if (argc > 1 && sscanf (argv[1], "--depth=%u", &depth) == 1)
{
--argc;