diff options
Diffstat (limited to 'loc2c-test.c')
-rw-r--r-- | loc2c-test.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/loc2c-test.c b/loc2c-test.c index ccd9510c..3c260385 100644 --- a/loc2c-test.c +++ b/loc2c-test.c @@ -21,15 +21,12 @@ #include <stdarg.h> #include "loc2c.h" -#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)); -} +#if !defined(_ELFUTILS_PREREQ) +// make a dummy PREREQ check for elfutils < 0.138 +#define _ELFUTILS_PREREQ(major, minor) (0 >= 1) +#endif +#define _(msg) msg static void __attribute__ ((noreturn)) fail (void *arg __attribute__ ((unused)), const char *fmt, ...) @@ -187,13 +184,13 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out, { 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; @@ -201,7 +198,7 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out, 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); @@ -230,11 +227,11 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out, 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; @@ -252,7 +249,7 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out, 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: @@ -261,7 +258,7 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out, default: error (2, 0, _("%s: unexpected type tag %#x"), - dwarf_diename_integrate (die) ?: "<anonymous type>", + dwarf_diename (die) ?: "<anonymous type>", dwarf_tag (die)); break; } @@ -527,7 +524,6 @@ main (int argc, char **argv) { Dwarf_Op *cfa_ops = NULL; -#ifdef _ELFUTILS_PREREQ #if _ELFUTILS_PREREQ(0,142) size_t cfa_nops; Dwarf_Addr bias; @@ -554,7 +550,6 @@ main (int argc, char **argv) } } #endif -#endif handle_variable (scopes, n, out, cubias, &vardie, pc, cfa_ops, &argv[argi]); |