+static Dwarf_Off MC_dwarf_attr_dieoffset(Dwarf_Die* die, int attribute) {
+ Dwarf_Attribute attr;
+ if (dwarf_hasattr_integrate(die, attribute)) {
+ dwarf_attr_integrate(die, attribute, &attr);
+ Dwarf_Die subtype_die;
+ if (dwarf_formref_die(&attr, &subtype_die)==NULL) {
+ xbt_die("Could not find DIE");
+ }
+ return dwarf_dieoffset(&subtype_die);
+ }
+ else return 0;
+}
+
+static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die* die, int attribute) {
+ Dwarf_Attribute attr;
+ if (dwarf_hasattr_integrate(die, attribute)) {
+ dwarf_attr_integrate(die, DW_AT_type, &attr);
+ Dwarf_Die subtype_die;
+ if (dwarf_formref_die(&attr, &subtype_die)==NULL) {
+ xbt_die("Could not find DIE");
+ }
+ return dwarf_dieoffset(&subtype_die);
+ }
+ else return 0;
+}
+