summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2012-07-29 23:47:28 +0200
committerMark Wielaard <[email protected]>2012-08-16 22:26:23 +0200
commitfdf68c53b1dc3ff42d19fdbce5ddebbf8df2724d (patch)
tree97a9da973fa4d7725c2e5448a8b88db05cd37c5e /src
parentcfcc7025e4f93e6732593a03ef02ebe3bd441d38 (diff)
libdw: Add dwarfstrings functions.
Introduce dwarf_access_string, dwarf_attr_string, dwarf_calling_convention_string, dwarf_discr_list_string, dwarf_encoding_string, dwarf_form_string, dwarf_identifier_case_string, dwarf_inline_string, dwarf_lang_string, dwarf_line_extended_opcode_string, dwarf_line_standard_opcode_string, dwarf_locexpr_opcode_string, dwarf_ordering_string, dwarf_tag_string, dwarf_virtuality_string, dwarf_visibility_string from dwarf branch. Remove similar functions from readelf and tests. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog17
-rw-r--r--src/readelf.c235
2 files changed, 17 insertions, 235 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3c7e221d..7acf9d92 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,22 @@
2012-07-27 Mark Wielaard <[email protected]>
+ * readelf.c (dwarf_tag_string): Removed.
+ (dwarf_attr_string): Likewise.
+ (dwarf_form_string): Likewise.
+ (dwarf_lang_string): Likewise.
+ (dwarf_inline_string): Likewise.
+ (dwarf_encoding_string): Likewise.
+ (dwarf_access_string): Likewise.
+ (dwarf_visibility_string): Likewise.
+ (dwarf_virtuality_string): Likewise.
+ (dwarf_identifier_case_string): Likewise.
+ (dwarf_calling_convention_string): Likewise.
+ (dwarf_ordering_string): Likewise.
+ (dwarf_discr_list_string): Likewise.
+ (dwarf_locexpr_opcode_string): Likewise.
+
+2012-07-27 Mark Wielaard <[email protected]>
+
* readelf.c (dwarf_tag_name): Renamed from dwarf_tag_string.
Uses new dwarf_tag_string or adds unknown_%#x.
(dwarf_attr_name): Likewise.
diff --git a/src/readelf.c b/src/readelf.c
index 11e63316..2711006d 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -51,8 +51,6 @@
#include "../libdwfl/libdwflP.h"
#include "../libdw/memory-access.h"
-#include "../libdw/known-dwarf.h"
-
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
@@ -3183,239 +3181,6 @@ format_dwarf_addr (Dwfl_Module *dwflmod,
return result;
}
-static const char *
-dwarf_tag_string (unsigned int tag)
-{
- switch (tag)
- {
-#define ONE_KNOWN_DW_TAG(NAME, CODE) case CODE: return #NAME;
- ALL_KNOWN_DW_TAG
-#undef ONE_KNOWN_DW_TAG
- default:
- return NULL;
- }
-}
-
-
-static const char *
-dwarf_attr_string (unsigned int attrnum)
-{
- switch (attrnum)
- {
-#define ONE_KNOWN_DW_AT(NAME, CODE) case CODE: return #NAME;
- ALL_KNOWN_DW_AT
-#undef ONE_KNOWN_DW_AT
- default:
- return NULL;
- }
-}
-
-
-static const char *
-dwarf_form_string (unsigned int form)
-{
- switch (form)
- {
-#define ONE_KNOWN_DW_FORM_DESC(NAME, CODE, DESC) ONE_KNOWN_DW_FORM(NAME, CODE)
-#define ONE_KNOWN_DW_FORM(NAME, CODE) case CODE: return #NAME;
- ALL_KNOWN_DW_FORM
-#undef ONE_KNOWN_DW_FORM
-#undef ONE_KNOWN_DW_FORM_DESC
- default:
- return NULL;
- }
-}
-
-
-static const char *
-dwarf_lang_string (unsigned int lang)
-{
- switch (lang)
- {
-#define ONE_KNOWN_DW_LANG_DESC(NAME, CODE, DESC) case CODE: return #NAME;
- ALL_KNOWN_DW_LANG
-#undef ONE_KNOWN_DW_LANG_DESC
- default:
- return NULL;
- }
-}
-
-
-static const char *
-dwarf_inline_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_INL(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_INL
-#undef ONE_KNOWN_DW_INL
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_encoding_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_ATE(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_ATE
-#undef ONE_KNOWN_DW_ATE
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_access_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_ACCESS(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_ACCESS
-#undef ONE_KNOWN_DW_ACCESS
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_visibility_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_VIS(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_VIS
-#undef ONE_KNOWN_DW_VIS
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_virtuality_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_VIRTUALITY(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_VIRTUALITY
-#undef ONE_KNOWN_DW_VIRTUALITY
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_identifier_case_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_ID(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_ID
-#undef ONE_KNOWN_DW_ID
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_calling_convention_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_CC(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_CC
-#undef ONE_KNOWN_DW_CC
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_ordering_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_ORD(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_ORD
-#undef ONE_KNOWN_DW_ORD
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_discr_list_string (unsigned int code)
-{
- static const char *const known[] =
- {
-#define ONE_KNOWN_DW_DSC(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_DSC
-#undef ONE_KNOWN_DW_DSC
- };
-
- if (likely (code < sizeof (known) / sizeof (known[0])))
- return known[code];
-
- return NULL;
-}
-
-
-static const char *
-dwarf_locexpr_opcode_string (unsigned int code)
-{
- static const char *const known[] =
- {
- /* Normally we can't affort building huge table of 64K entries,
- most of them zero, just because there are a couple defined
- values at the far end. In case of opcodes, it's OK. */
-#define ONE_KNOWN_DW_OP_DESC(NAME, CODE, DESC) ONE_KNOWN_DW_OP(NAME, CODE)
-#define ONE_KNOWN_DW_OP(NAME, CODE) [CODE] = #NAME,
- ALL_KNOWN_DW_OP
-#undef ONE_KNOWN_DW_OP
-#undef ONE_KNOWN_DW_OP_DESC
- };
-
- const char *ret = NULL;
- if (likely (code < sizeof (known) / sizeof (known[0])))
- ret = known[code];
-
- return ret;
-}
-
/* Reused by all dwarf_foo_name functions. */
static char unknown_buf[16];