This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/5] 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 <mjw@redhat.com>
---
 libdw/ChangeLog                           |  41 ++++++
 libdw/Makefile.am                         |  12 +-
 libdw/dwarf_access_string.c               |  51 +++++++
 libdw/dwarf_attr_string.c                 |  48 ++++++
 libdw/dwarf_calling_convention_string.c   |  51 +++++++
 libdw/dwarf_discr_list_string.c           |  51 +++++++
 libdw/dwarf_encoding_string.c             |  51 +++++++
 libdw/dwarf_form_string.c                 |  50 +++++++
 libdw/dwarf_identifier_case_string.c      |  51 +++++++
 libdw/dwarf_inline_string.c               |  51 +++++++
 libdw/dwarf_lang_string.c                 |  48 ++++++
 libdw/dwarf_line_extended_opcode_string.c |  52 +++++++
 libdw/dwarf_line_standard_opcode_string.c |  52 +++++++
 libdw/dwarf_locexpr_opcode_string.c       |  57 ++++++++
 libdw/dwarf_ordering_string.c             |  51 +++++++
 libdw/dwarf_tag_string.c                  |  48 ++++++
 libdw/dwarf_virtuality_string.c           |  51 +++++++
 libdw/dwarf_visibility_string.c           |  51 +++++++
 libdw/libdw.h                             |  79 +++++++++-
 libdw/libdw.map                           |  20 +++
 src/ChangeLog                             |  17 +++
 src/readelf.c                             | 235 ------------------------------
 tests/ChangeLog                           |   6 +
 tests/allregs.c                           |  20 +--
 tests/show-die-info.c                     |  28 ----
 25 files changed, 988 insertions(+), 284 deletions(-)
 create mode 100644 libdw/dwarf_access_string.c
 create mode 100644 libdw/dwarf_attr_string.c
 create mode 100644 libdw/dwarf_calling_convention_string.c
 create mode 100644 libdw/dwarf_discr_list_string.c
 create mode 100644 libdw/dwarf_encoding_string.c
 create mode 100644 libdw/dwarf_form_string.c
 create mode 100644 libdw/dwarf_identifier_case_string.c
 create mode 100644 libdw/dwarf_inline_string.c
 create mode 100644 libdw/dwarf_lang_string.c
 create mode 100644 libdw/dwarf_line_extended_opcode_string.c
 create mode 100644 libdw/dwarf_line_standard_opcode_string.c
 create mode 100644 libdw/dwarf_locexpr_opcode_string.c
 create mode 100644 libdw/dwarf_ordering_string.c
 create mode 100644 libdw/dwarf_tag_string.c
 create mode 100644 libdw/dwarf_virtuality_string.c
 create mode 100644 libdw/dwarf_visibility_string.c

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 53da0b0..38cdb8a 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,46 @@
 2012-07-27  Mark Wielaard  <mjw@redhat.com>
 
+	* Makefile.am (libdw_a_SOURCES): Add dwarf_aggregate_size.c,
+	dwarf_getlocation_implicit_pointer.c,
+	dwarf_access_string.c, dwarf_inline_string.c,
+	dwarf_attr_string.c dwarf_lang_string.c,
+	dwarf_calling_convention_string.c,
+	dwarf_line_extended_opcode_string.c,
+	dwarf_discr_list_string.c,
+	dwarf_line_standard_opcode_string.c,
+	dwarf_encoding_string.c dwarf_locexpr_opcode_string.c,
+	dwarf_form_string.c dwarf_ordering_string.c,
+	dwarf_tag_string.c dwarf_virtuality_string.c,
+	dwarf_identifier_case_string.c and dwarf_visibility_string.c
+	* dwarf_access_string.c: New file.
+	* dwarf_attr_string.c: Likewise.
+	* dwarf_calling_convention_string.c: Likewise.
+	* dwarf_discr_list_string.c: Likewise.
+	* dwarf_encoding_string.c: Likewise.
+	* dwarf_form_string.c: Likewise.
+	* dwarf_identifier_case_string.c: Likewise.
+	* dwarf_inline_string.c: Likewise.
+	* dwarf_lang_string.c: Likewise.
+	* dwarf_line_extended_opcode_string.c: Likewise.
+	* dwarf_line_standard_opcode_string.c: Likewise.
+	* dwarf_locexpr_opcode_string.c: Likewise.
+	* dwarf_ordering_string.c: Likewise.
+	* dwarf_tag_string.c: Likewise.
+	* dwarf_virtuality_string.c: Likewise.
+	* dwarf_visibility_string.c: Likewise.
+	* libdw.h: Declare dwarf_tag_string, dwarf_attr_string,
+	dwarf_lang_string, dwarf_inline_string, dwarf_encoding_string,
+	dwarf_access_string, dwarf_visibility_string,
+	dwarf_virtuality_string, dwarf_identifier_case_string,
+	dwarf_calling_convention_string, dwarf_ordering_string,
+	dwarf_discr_list_string, dwarf_locexpr_opcode_string,
+	dwarf_line_standard_opcode_string and
+	dwarf_line_extended_opcode_string.
+	* libdw.map (ELFUTILS_0.155): New symbol version directive for
+	new functions.
+
+2012-07-27  Mark Wielaard  <mjw@redhat.com>
+
 	* Makefile.am (EXTRA_DIST): Add known-dwarf.h.
 	* dwarf.h (DW_LANG_Go): Update comment.
 	(DW_LANG_Mips_Assembler): Likewise.
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index c6ac264..f695e89 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -87,7 +87,17 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
 		  dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \
 		  dwarf_cfi_addrframe.c \
 		  dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
-		  dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c
+		  dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \
+		  dwarf_access_string.c dwarf_inline_string.c \
+		  dwarf_attr_string.c dwarf_lang_string.c \
+		  dwarf_calling_convention_string.c \
+		  dwarf_line_extended_opcode_string.c \
+		  dwarf_discr_list_string.c \
+		  dwarf_line_standard_opcode_string.c \
+		  dwarf_encoding_string.c dwarf_locexpr_opcode_string.c \
+		  dwarf_form_string.c dwarf_ordering_string.c \
+		  dwarf_tag_string.c dwarf_virtuality_string.c \
+		  dwarf_identifier_case_string.c dwarf_visibility_string.c
 
 if MAINTAINER_MODE
 BUILT_SOURCES = $(srcdir)/known-dwarf.h
diff --git a/libdw/dwarf_access_string.c b/libdw/dwarf_access_string.c
new file mode 100644
index 0000000..6ad6e24
--- /dev/null
+++ b/libdw/dwarf_access_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_attr_string.c b/libdw/dwarf_attr_string.c
new file mode 100644
index 0000000..a7c4ce4
--- /dev/null
+++ b/libdw/dwarf_attr_string.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+    }
+}
diff --git a/libdw/dwarf_calling_convention_string.c b/libdw/dwarf_calling_convention_string.c
new file mode 100644
index 0000000..f91fdef
--- /dev/null
+++ b/libdw/dwarf_calling_convention_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_discr_list_string.c b/libdw/dwarf_discr_list_string.c
new file mode 100644
index 0000000..8967052
--- /dev/null
+++ b/libdw/dwarf_discr_list_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_encoding_string.c b/libdw/dwarf_encoding_string.c
new file mode 100644
index 0000000..299957e
--- /dev/null
+++ b/libdw/dwarf_encoding_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_form_string.c b/libdw/dwarf_form_string.c
new file mode 100644
index 0000000..980c311
--- /dev/null
+++ b/libdw/dwarf_form_string.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+    }
+}
diff --git a/libdw/dwarf_identifier_case_string.c b/libdw/dwarf_identifier_case_string.c
new file mode 100644
index 0000000..53bcde4
--- /dev/null
+++ b/libdw/dwarf_identifier_case_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_inline_string.c b/libdw/dwarf_inline_string.c
new file mode 100644
index 0000000..04c18a2
--- /dev/null
+++ b/libdw/dwarf_inline_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_lang_string.c b/libdw/dwarf_lang_string.c
new file mode 100644
index 0000000..d6dd288
--- /dev/null
+++ b/libdw/dwarf_lang_string.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+    }
+}
diff --git a/libdw/dwarf_line_extended_opcode_string.c b/libdw/dwarf_line_extended_opcode_string.c
new file mode 100644
index 0000000..c90061a
--- /dev/null
+++ b/libdw/dwarf_line_extended_opcode_string.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+const char *
+dwarf_line_extended_opcode_string (unsigned int code)
+{
+  static const char *const known[] =
+    {
+#define ONE_KNOWN_DW_LNE(NAME, CODE) [CODE] = #NAME,
+      ALL_KNOWN_DW_LNE
+#undef ONE_KNOWN_DW_LNE
+    };
+
+  const char *ret = NULL;
+  if (likely (code < sizeof (known) / sizeof (known[0])))
+    ret = known[code];
+
+  return ret;
+}
diff --git a/libdw/dwarf_line_standard_opcode_string.c b/libdw/dwarf_line_standard_opcode_string.c
new file mode 100644
index 0000000..b154ec3
--- /dev/null
+++ b/libdw/dwarf_line_standard_opcode_string.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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];
+
+  return ret;
+}
diff --git a/libdw/dwarf_locexpr_opcode_string.c b/libdw/dwarf_locexpr_opcode_string.c
new file mode 100644
index 0000000..beba721
--- /dev/null
+++ b/libdw/dwarf_locexpr_opcode_string.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_ordering_string.c b/libdw/dwarf_ordering_string.c
new file mode 100644
index 0000000..4c8abc6
--- /dev/null
+++ b/libdw/dwarf_ordering_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_tag_string.c b/libdw/dwarf_tag_string.c
new file mode 100644
index 0000000..ad26326
--- /dev/null
+++ b/libdw/dwarf_tag_string.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+    }
+}
diff --git a/libdw/dwarf_virtuality_string.c b/libdw/dwarf_virtuality_string.c
new file mode 100644
index 0000000..129e0fd
--- /dev/null
+++ b/libdw/dwarf_virtuality_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/dwarf_visibility_string.c b/libdw/dwarf_visibility_string.c
new file mode 100644
index 0000000..ce99a5e
--- /dev/null
+++ b/libdw/dwarf_visibility_string.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stddef.h>
+
+#include "known-dwarf.h"
+#include "dwarf.h"
+
+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;
+}
diff --git a/libdw/libdw.h b/libdw/libdw.h
index f5fc4e2..4ed3a45 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
@@ -1,5 +1,5 @@
 /* Interfaces for libdw.
-   Copyright (C) 2002-2010 Red Hat, Inc.
+   Copyright (C) 2002-2010, 2012 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -830,6 +830,83 @@ extern const char *dwarf_errmsg (int err);
 extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler);
 
 
+/* Returns the tag name, without the DW_TAG_ prefix, if known.
+   Returns NULL if the given tag code is unknown.  */
+extern const char *dwarf_tag_string (unsigned int code);
+
+/* Returns the attribute name, without the DW_AT_ prefix, if known.
+   Returns NULL if the given attribute code is unknown.  */
+extern const char *dwarf_attr_string (unsigned int code);
+
+/* Returns the form name, without the DW_FORM_ prefix, if known.
+   Returns NULL if the given form code is unknown.  */
+extern const char *dwarf_form_string (unsigned int code);
+
+/* Returns the language name, without the DW_LANG_ prefix, if known.
+   Returns NULL if the given language code is unknown.  */
+extern const char *dwarf_lang_string (unsigned int code);
+
+/* Returns the inline name, without the DW_INL_ prefix, as used with
+   the DW_AT_inline attribute, if known.  Returns NULL if the given
+   DW_LANG code is unknown.  */
+extern const char *dwarf_inline_string (unsigned int code);
+
+/* Returns the encoding name, without the DW_ATE_ prefix, as used with
+   the DW_AT_encoding attribute, if known.  Returns NULL if the given
+   DW_ATE code is unknown.  */
+extern const char *dwarf_encoding_string (unsigned int code);
+
+/* Returns the access name, without the DW_ACCESS_ prefix, as used with
+   the DW_AT_accessibility attribute, if known.  Returns NULL if the given
+   DW_ACCESS code is unknown.  */
+extern const char *dwarf_access_string (unsigned int code);
+
+/* Returns the access name, without the DW_VIS_ prefix, as used with
+   the DW_AT_visibility attribute, if known.  Returns NULL if the given
+   DW_VIS code is unknown.  */
+extern const char *dwarf_visibility_string (unsigned int code);
+
+/* Returns the virtuality name, with the DW_VIRTUALITY_ prefix, as used
+   with the DW_AT_virtuality attribute, if known.  Returns NULL if the
+   given DW_VIRTUALITY code is unknown.  */
+extern const char *dwarf_virtuality_string (unsigned int code);
+
+/* Returns the identifier case name, without the DW_ID_ prefix, as used
+   with the DW_AT_identifier_case attribute, if known.  Returns NULL if
+   the given DW_ID code is unknown.  */
+extern const char *dwarf_identifier_case_string (unsigned int code);
+
+/* Returns the calling convention name, without the DW_CC_ prefix, as
+   used with the DW_AT_calling_convention attribute, if known.  Returns
+   NULL if the given DW_CC code is unknown.  */
+extern const char *dwarf_calling_convention_string (unsigned int code);
+
+/* Returns the ordering name, without the DW_ORD_ prefix, as
+   used with the DW_AT_ordering attribute, if known.  Returns
+   NULL if the given DW_CC code is unknown.  */
+extern const char *dwarf_ordering_string (unsigned int code);
+
+/* Returns the discriminant list name, without the DW_ORD_ prefix, as
+   used in the DW_AT_ordering attribute block, if known.  Returns
+   NULL if the given DW_CC code is unknown.  */
+extern const char *dwarf_discr_list_string (unsigned int code);
+
+/* Returns the operation name, without the DW_OP_ prefix, as
+   used in a DWARF location expression block, if known.  Returns
+   NULL if the given DW_OP code is unknown.  */
+extern const char *dwarf_locexpr_opcode_string (unsigned int code);
+
+/* Returns the standard line information opcode name, without the
+   DW_LNS_ prefix, as used in the line number program instructions,
+   if known.  Returns NULL if the given DW_LNS opcode is unknown.  */
+extern const char *dwarf_line_standard_opcode_string (unsigned int code);
+
+/* Returns the extended line information opcode name, without the
+   DW_LNE_ prefix, as used in the line number program instructions,
+   if known.  Returns NULL if the given DW_LNE opcode is unknown.  */
+extern const char *dwarf_line_extended_opcode_string (unsigned int code);
+
+
 /* Inline optimizations.  */
 #ifdef __OPTIMIZE__
 /* Return attribute code of given attribute.  */
diff --git a/libdw/libdw.map b/libdw/libdw.map
index 1f71d03..c3d7c25 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -254,3 +254,23 @@ ELFUTILS_0.149 {
 
     dwfl_dwarf_line;
 } ELFUTILS_0.148;
+
+ELFUTILS_0.155 {
+  global:
+    dwarf_tag_string;
+    dwarf_attr_string;
+    dwarf_form_string;
+    dwarf_lang_string;
+    dwarf_inline_string;
+    dwarf_encoding_string;
+    dwarf_access_string;
+    dwarf_visibility_string;
+    dwarf_virtuality_string;
+    dwarf_identifier_case_string;
+    dwarf_calling_convention_string;
+    dwarf_ordering_string;
+    dwarf_discr_list_string;
+    dwarf_locexpr_opcode_string;
+    dwarf_line_standard_opcode_string;
+    dwarf_line_extended_opcode_string;
+} ELFUTILS_0.149;
diff --git a/src/ChangeLog b/src/ChangeLog
index 3c7e221..7acf9d9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,22 @@
 2012-07-27  Mark Wielaard  <mjw@redhat.com>
 
+	* 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  <mjw@redhat.com>
+
 	* 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 5a583ff..53625e1 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];
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 823f82e..24ba17e 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,11 @@
 2012-07-27  Mark Wielaard  <mjw@redhat.com>
 
+	* allregs.c (dwarf_encoding_string): Removed.
+	* show-die-info.c (dwarf_tag_string): Removed.
+	(dwarf_attr_string): Removed.
+
+2012-07-27  Mark Wielaard  <mjw@redhat.com>
+
 	* allregs.c (dwarf_encoding_string): Rewritten using known-dwarf
 	macros.
 	* show-die-info.c (tagnames): Removed.
diff --git a/tests/allregs.c b/tests/allregs.c
index b103ce1..85bcb5c 100644
--- a/tests/allregs.c
+++ b/tests/allregs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Red Hat, Inc.
+/* Copyright (C) 2005, 2006, 2012 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -28,24 +28,6 @@
 #include ELFUTILS_HEADER(dwfl)
 #include <dwarf.h>
 
-#include "../libdw/known-dwarf.h"
-
-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 int
 first_module (Dwfl_Module *mod,
diff --git a/tests/show-die-info.c b/tests/show-die-info.c
index 0c298ac..624a71d 100644
--- a/tests/show-die-info.c
+++ b/tests/show-die-info.c
@@ -26,34 +26,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "../libdw/known-dwarf.h"
-
-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;
-    }
-}
-
 
 void
 handle (Dwarf *dbg, Dwarf_Die *die, int n)
-- 
1.7.11.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]