This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH 7/9] Handle DWARF5 defaulted member function encodings.
- From: Mark Wielaard <mark at klomp dot org>
- To: elfutils-devel at sourceware dot org
- Cc: Mark Wielaard <mark at klomp dot org>
- Date: Thu, 27 Jul 2017 00:07:44 +0200
- Subject: [PATCH 7/9] Handle DWARF5 defaulted member function encodings.
- Authentication-results: sourceware.org; auth=none
- References: <1501106866-5846-1-git-send-email-mark@klomp.org>
Add DW_DEFAULTED_no, DW_DEFAULTED_in_class and DW_DEFAULTED_out_of_class
to dwarf.h.
Print value (no, in_class or out_of_class) of DW_AT_defaulted in readelf.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
ChangeLog | 3 ++-
NEWS | 4 ++--
libdw/ChangeLog | 5 +++++
libdw/dwarf.h | 8 ++++++++
src/ChangeLog | 7 +++++++
src/readelf.c | 28 ++++++++++++++++++++++++++++
6 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7748f13..b4722db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
2017-07-26 Mark Wielaard <mark@klomp.org>
- * NEWS: Mention new DWARF5 calling conventions.
+ * NEWS: Mention new DWARF5 calling conventions and defaulted member
+ function.
2017-07-26 Mark Wielaard <mark@klomp.org>
diff --git a/NEWS b/NEWS
index 409805e..5f85fc2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
Version 0.170
-libdw: Added new DWARF5 attribute, tag, character encoding, language code
- and calling convention constants to dwarf.h.
+libdw: Added new DWARF5 attribute, tag, character encoding, language code,
+ calling convention and defaulted member function constants to dwarf.h.
New function dwarf_default_lower_bound.
strip: Add -R, --remove-section=SECTION and --keep-section=SECTION.
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 1c4eb36..a74733c 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,10 @@
2017-07-26 Mark Wielaard <mark@klomp.org>
+ * dwarf.h: Add DW_DEFAULTED_no, DW_DEFAULTED_in_class and
+ DW_DEFAULTED_out_of_class.
+
+2017-07-26 Mark Wielaard <mark@klomp.org>
+
* dwarf.h: Add DW_CC_pass_by_reference and DW_CC_pass_by_reference.
2017-07-26 Mark Wielaard <mark@klomp.org>
diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index de8f7e5..82a68f2 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -729,6 +729,14 @@ enum
DW_DSC_range = 1
};
+/* DWARF defaulted member function encodings. */
+enum
+ {
+ DW_DEFAULTED_no = 0,
+ DW_DEFAULTED_in_class = 1,
+ DW_DEFAULTED_out_of_class = 2
+ };
+
/* DWARF standard opcode encodings. */
enum
diff --git a/src/ChangeLog b/src/ChangeLog
index f92f10d..3ebc704 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2017-07-26 Mark Wielaard <mark@klomp.org>
+
+ * readelf.c (dwarf_defaulted_string): New function.
+ (dwarf_defaulted_name): Likewise.
+ (attr_callback): Use dwarf_defaulted_name to get value of
+ DW_AT_defaulted.
+
2017-07-20 Mark Wielaard <mark@klomp.org>
* strip.c (handle_elf): Deal with data marker symbols pointing to
diff --git a/src/readelf.c b/src/readelf.c
index 40d4913..5e1685d 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3797,6 +3797,23 @@ dwarf_access_string (unsigned int code)
static const char *
+dwarf_defaulted_string (unsigned int code)
+{
+ static const char *const known[] =
+ {
+#define DWARF_ONE_KNOWN_DW_DEFAULTED(NAME, CODE) [CODE] = #NAME,
+ DWARF_ALL_KNOWN_DW_DEFAULTED
+#undef DWARF_ONE_KNOWN_DW_DEFAULTED
+ };
+
+ 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[] =
@@ -4002,6 +4019,14 @@ dwarf_access_name (unsigned int code)
static const char *
+dwarf_defaulted_name (unsigned int code)
+{
+ const char *ret = dwarf_defaulted_string (code);
+ return string_or_unknown (ret, code, 0, 0, false);
+}
+
+
+static const char *
dwarf_visibility_name (unsigned int code)
{
const char *ret = dwarf_visibility_string (code);
@@ -6053,6 +6078,9 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
case DW_AT_accessibility:
valuestr = dwarf_access_name (num);
break;
+ case DW_AT_defaulted:
+ valuestr = dwarf_defaulted_name (num);
+ break;
case DW_AT_visibility:
valuestr = dwarf_visibility_name (num);
break;
--
1.8.3.1