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. --- dwarf_wrappers.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'dwarf_wrappers.h') diff --git a/dwarf_wrappers.h b/dwarf_wrappers.h index bc1cde2b..766abb6d 100644 --- a/dwarf_wrappers.h +++ b/dwarf_wrappers.h @@ -103,6 +103,16 @@ public: }; +// Look up the DIE for a reference-form attribute name +inline Dwarf_Die * +dwarf_attr_die (Dwarf_Die *die, unsigned int attr, Dwarf_Die *result) +{ + Dwarf_Attribute attr_mem; + return dwarf_formref_die (dwarf_attr_integrate (die, attr, &attr_mem), + result); +} + + #if !_ELFUTILS_PREREQ(0, 143) // Elfutils prior to 0.143 didn't use attr_integrate when looking up the // decl_file or decl_line, so the attributes would sometimes be missed. For -- cgit