+2009-09-09 Petr Machata <pmachata@redhat.com>
+
+ * dwarfstrings.c (dwarf_line_standard_opcode_string): New function.
+ * dwarfstrings.h: Declare it.
+ * dwarflint.c (check_line_structural): Use it.
+
2009-08-27 Roland McGrath <roland@redhat.com>
* dwarfcmp.cc (do_writer_test): New function, broken out of ...
char buf[128];
if (opcode != 0)
sprintf (buf, "operand #%d of DW_LNS_%s",
- i, dwarf_locexpr_opcode_string (opcode));
+ i, dwarf_line_standard_opcode_string (opcode));
else
sprintf (buf, "operand #%d of extended opcode %d",
i, extended);
return ret;
}
+
+
+const char *
+dwarf_line_standard_opcode_string (unsigned int code)
+{
+ static const char *const known[] =
+ {
+#define ONE_KNOWN_DW_LNS(NAME, CODE) [CODE] = #NAME,
+ ALL_KNOWN_DW_LNS
+#undef ONE_KNOWN_DW_LNS
+ };
+
+ const char *ret = NULL;
+ if (likely (code < sizeof (known) / sizeof (known[0])))
+ ret = known[code];
+
+ if (ret == NULL)
+ {
+ static char buf[40];
+ snprintf (buf, sizeof buf, gettext ("unknown opcode %x"), code);
+ ret = buf;
+ }
+
+ return ret;
+}
const char *dwarf_locexpr_opcode_string (unsigned int code);
+const char *dwarf_line_standard_opcode_string (unsigned int code);
+
#ifdef __cplusplus
}
#endif