From 3d1ad34033e6f77368287927049e112d9ee3677e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 19 Aug 2009 17:27:18 -0700 Subject: Create a dwarf_attr_die idiom We commonly do a dwarf_attr_integrate followed by dwarf_formref_die, with no care for the Dwarf_Attribute, so I captured that idiom in an inline function. * dwarf_wrappers.h (dwarf_attr_die): New. * dwarf_wrappers.cxx (dwarf_type_name): Call dwarf_attr_die. * dwflpp.cxx (dwflpp::print_members): Ditto. (dwflpp::find_struct_member): Ditto. * tapsets.cxx (dwarf_derived_probe::saveargs): Ditto. (uprobe_derived_probe::saveargs): Ditto. (resolve_tracepoint_arg_type): Ditto. (tracepoint_derived_probe::build_args): Ditto. --- dwflpp.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index dcf04678..dce19f21 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -1588,10 +1588,7 @@ dwflpp::print_members(Dwarf_Die *vardie, ostream &o) else { Dwarf_Die temp_die; - Dwarf_Attribute temp_attr; - - if (!dwarf_attr_integrate (die, DW_AT_type, &temp_attr) || - !dwarf_formref_die (&temp_attr, &temp_die)) + if (!dwarf_attr_die (die, DW_AT_type, &temp_die)) { string source = dwarf_decl_file(die) ?: ""; int line = -1; @@ -1642,12 +1639,8 @@ dwflpp::find_struct_member(const target_symbol::component& c, { // need to recurse for anonymous structs/unions Dwarf_Die subdie; - - if (!dwarf_attr_integrate (&die, DW_AT_type, &attr) || - !dwarf_formref_die (&attr, &subdie)) - continue; - - if (find_struct_member(c, &subdie, memberdie, locs)) + if (dwarf_attr_die (&die, DW_AT_type, &subdie) && + find_struct_member(c, &subdie, memberdie, locs)) goto success; } else if (name == c.member) -- cgit