This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH 05/10] libdw: Export dwarfstrings functions.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 26 Jul 2012 00:49:54 +0200
- Subject: [PATCH 05/10] libdw: Export dwarfstrings functions.
Add public functions dwarf_tag_string, dwarf_attr_string,
dwarf_form_string, dwarf_lang_string, dwarf_lang_description,
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.
Fix include usage in readelf and tests.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
libdw/ChangeLog | 13 ++++++++
libdw/libdw.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++-
libdw/libdw.map | 21 +++++++++++++
src/ChangeLog | 4 +++
src/readelf.c | 2 --
tests/ChangeLog | 5 +++
tests/allregs.c | 2 --
tests/show-die-info.c | 2 --
8 files changed, 126 insertions(+), 7 deletions(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 886ce56..bda66d2 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,16 @@
+2012-07-25 Mark Wielaard <mjw@redhat.com>
+
+ * 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.154): New symbol version directive for
+ new dwarfstrings.c functions.
+
2012-07-24 Mark Wielaard <mjw@redhat.com>
* dwarfstrings.c (dwarf_tag_string): Use known-dwarf.h
diff --git a/libdw/libdw.h b/libdw/libdw.h
index f5fc4e2..eea6cf1 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,88 @@ 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. */
+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. */
+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. */
+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. */
+const char *dwarf_lang_string (unsigned int code);
+
+/* Returns the language description used with the DW_AT_language
+ attribute, if known. Returns NULL if the given DW_LANG code is
+ unknown. */
+const char *dwarf_lang_description (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. */
+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. */
+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. */
+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. */
+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. */
+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. */
+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. */
+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. */
+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. */
+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. */
+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. */
+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. */
+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..8944eb5 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -254,3 +254,24 @@ ELFUTILS_0.149 {
dwfl_dwarf_line;
} ELFUTILS_0.148;
+
+ELFUTILS_0.154 {
+ global:
+ dwarf_tag_string;
+ dwarf_attr_string;
+ dwarf_form_string;
+ dwarf_lang_string;
+ dwarf_lang_description;
+ 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 31eb350..7c6ed6d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2012-07-25 Mark Wielaard <mjw@redhat.com>
+
+ * readelf.c: Remove dwarfstrings.c include.
+
2012-07-24 Mark Wielaard <mjw@redhat.com>
* readelf.c (dwarf_lang_name): Use dwarf_lang_description.
diff --git a/src/readelf.c b/src/readelf.c
index a0f1b33..947c7be 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -51,8 +51,6 @@
#include "../libdwfl/libdwflP.h"
#include "../libdw/memory-access.h"
-#include "../libdw/dwarfstrings.c"
-
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 3ea724a..dec6b54 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-25 Mark Wielaard <mjw@redhat.com>
+
+ * allregs.c: Remove dwarfstrings.c include.
+ * show-die-info.c: Likewise.
+
2012-07-17 Mark Wielaard <mjw@redhat.com>
* allregs.c (dwarf_encoding_string): Removed.
diff --git a/tests/allregs.c b/tests/allregs.c
index 11ad918..279ddb5 100644
--- a/tests/allregs.c
+++ b/tests/allregs.c
@@ -28,8 +28,6 @@
#include ELFUTILS_HEADER(dwfl)
#include <dwarf.h>
-#include "../libdw/dwarfstrings.c"
-
static int
first_module (Dwfl_Module *mod,
diff --git a/tests/show-die-info.c b/tests/show-die-info.c
index 5a4521d..01d36b4 100644
--- a/tests/show-die-info.c
+++ b/tests/show-die-info.c
@@ -26,8 +26,6 @@
#include <string.h>
#include <unistd.h>
-#include "../libdw/dwarfstrings.c"
-
void
handle (Dwarf *dbg, Dwarf_Die *die, int n)
{
--
1.7.11.2