}
-// Helper for dealing with selected portions of libdwfl in a more readable
-// fashion, and with specific cleanup / checking / logging options.
-
-const char *
-dwarf_diename_integrate (Dwarf_Die *die)
-{
- Dwarf_Attribute attr_mem;
- return dwarf_formstring (dwarf_attr_integrate (die, DW_AT_name, &attr_mem));
-}
-
-
/* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
}
};
-const char *dwarf_diename_integrate (Dwarf_Die *die);
-
#endif
if (typetag != DW_TAG_structure_type && typetag != DW_TAG_union_type)
{
o << " Error: "
- << (dwarf_diename_integrate (vardie) ?: "<anonymous>")
+ << (dwarf_diename (vardie) ?: "<anonymous>")
<< " isn't a struct/union";
return;
}
{
case 1: // No children.
o << ((typetag == DW_TAG_union_type) ? " union " : " struct ")
- << (dwarf_diename_integrate (die) ?: "<anonymous>")
+ << (dwarf_diename (die) ?: "<anonymous>")
<< " is empty";
break;
case -1: // Error.
default: // Shouldn't happen.
o << ((typetag == DW_TAG_union_type) ? " union " : " struct ")
- << (dwarf_diename_integrate (die) ?: "<anonymous>")
+ << (dwarf_diename (die) ?: "<anonymous>")
<< ": " << dwarf_errmsg (-1);
break;
// Output each sibling's name to 'o'.
while (dwarf_tag (die) == DW_TAG_member)
{
- const char *member = dwarf_diename_integrate (die) ;
+ const char *member = dwarf_diename (die) ;
if ( member != NULL )
o << " " << member;
case -1: /* Error. */
default: /* Shouldn't happen */
throw semantic_error (string (dwarf_tag(&die) == DW_TAG_union_type ? "union" : "struct")
- + string (dwarf_diename_integrate (&die) ?: "<anonymous>")
+ + string (dwarf_diename (&die) ?: "<anonymous>")
+ string (dwarf_errmsg (-1)),
c.tok);
}
if (dwarf_tag(&die) != DW_TAG_member)
continue;
- const char *name = dwarf_diename_integrate(&die);
+ const char *name = dwarf_diename(&die);
if (name == NULL)
{
// need to recurse for anonymous structs/unions
Dwarf_Die *tmpdie = dwflpp::declaration_resolve(dwarf_diename(die));
if (tmpdie == NULL)
throw semantic_error ("unresolved struct "
- + string (dwarf_diename_integrate (die) ?: "<anonymous>"),
+ + string (dwarf_diename (die) ?: "<anonymous>"),
c.tok);
*die_mem = *tmpdie;
}
alternatives = " (alternatives:" + members.str();
throw semantic_error("unable to find member '" +
c.member + "' for struct "
- + string(dwarf_diename_integrate(die) ?: "<unknown>")
+ + string(dwarf_diename(die) ?: "<unknown>")
+ alternatives,
c.tok);
}
throw semantic_error ("invalid access '"
+ lex_cast<string>(c)
+ "' vs. enum type "
- + string(dwarf_diename_integrate (die) ?: "<anonymous type>"),
+ + string(dwarf_diename (die) ?: "<anonymous type>"),
c.tok);
break;
case DW_TAG_base_type:
throw semantic_error ("invalid access '"
+ lex_cast<string>(c)
+ "' vs. base type "
- + string(dwarf_diename_integrate (die) ?: "<anonymous type>"),
+ + string(dwarf_diename (die) ?: "<anonymous type>"),
c.tok);
break;
case -1:
break;
default:
- throw semantic_error (string(dwarf_diename_integrate (die) ?: "<anonymous type>")
+ throw semantic_error (string(dwarf_diename (die) ?: "<anonymous type>")
+ ": unexpected type tag "
+ lex_cast<string>(dwarf_tag (die)),
c.tok);
#define _(msg) msg
-static const char *
-dwarf_diename_integrate (Dwarf_Die *die)
-{
- Dwarf_Attribute attr_mem;
- return dwarf_formstring (dwarf_attr_integrate (die, DW_AT_name, &attr_mem));
-}
-
-
static void __attribute__ ((noreturn))
fail (void *arg __attribute__ ((unused)), const char *fmt, ...)
{
{
case 1: /* No children. */
error (2, 0, _("empty struct %s"),
- dwarf_diename_integrate (die) ?: "<anonymous>");
+ dwarf_diename (die) ?: "<anonymous>");
break;
case -1: /* Error. */
default: /* Shouldn't happen */
error (2, 0, _("%s %s: %s"),
typetag == DW_TAG_union_type ? "union" : "struct",
- dwarf_diename_integrate (die) ?: "<anonymous>",
+ dwarf_diename (die) ?: "<anonymous>",
dwarf_errmsg (-1));
break;
break;
}
while (dwarf_tag (die) != DW_TAG_member
- || ({ const char *member = dwarf_diename_integrate (die);
+ || ({ const char *member = dwarf_diename (die);
member == NULL || strcmp (member, *fields); }))
if (dwarf_siblingof (die, &die_mem) != 0)
error (2, 0, _("field name %s not found"), *fields);
if (dwarf_formsdata (&attr_mem, &off) != 0)
error (2, 0, _("Bad offset for %s %s: %s"),
typetag == DW_TAG_union_type ? "union" : "struct",
- dwarf_diename_integrate (die) ?: "<anonymous>",
+ dwarf_diename (die) ?: "<anonymous>",
dwarf_errmsg (-1));
if (off != 0)
c_translate_add_offset (&pool, 1,
- dwarf_diename_integrate (die)
+ dwarf_diename (die)
?: "", off, &tail);
break;
case DW_TAG_base_type:
error (2, 0, _("field %s vs base type %s"),
- *fields, dwarf_diename_integrate (die) ?: "<anonymous type>");
+ *fields, dwarf_diename (die) ?: "<anonymous type>");
break;
case -1:
default:
error (2, 0, _("%s: unexpected type tag %#x"),
- dwarf_diename_integrate (die) ?: "<anonymous type>",
+ dwarf_diename (die) ?: "<anonymous type>",
dwarf_tag (die));
break;
}
}
if (done)
{
- c_type.append(dwarf_diename_integrate(&type_die));
+ c_type.append(dwarf_diename(&type_die));
return true;
}
{
// build a tracepoint_arg for this parameter
tracepoint_arg tparg;
- tparg.name = dwarf_diename_integrate(&arg);
+ tparg.name = dwarf_diename(&arg);
// read the type of this parameter
Dwarf_Attribute type_attr;