]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Handle DWARF5 defaulted member function encodings.
authorMark Wielaard <mark@klomp.org>
Wed, 26 Jul 2017 16:32:27 +0000 (18:32 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 2 Aug 2017 11:51:52 +0000 (13:51 +0200)
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
NEWS
libdw/ChangeLog
libdw/dwarf.h
src/ChangeLog
src/readelf.c

index 7748f139ebd549c744c3f6f89d638bea5417f4eb..b4722db630fda947e76b3b0360372cc252f72fa2 100644 (file)
--- 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 409805e701f21b669d57a39c6eaa147de82a52a3..5f85fc26eb2947897d66f53de6d97b94603f8c3e 100644 (file)
--- 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.
index 1c4eb3668447421322226be5053a8ea163a54a05..a74733c29b7ebd4db73c20bd48cc32ae77921901 100644 (file)
@@ -1,3 +1,8 @@
+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.
index de8f7e5a7abdc69f77a0fb5f0095c7e502f18a81..82a68f26cc56d6616b1212a11daf72e1d64d25bc 100644 (file)
@@ -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
index f92f10d732012f30adc2832ae0b0490e7df00712..3ebc7044860ac1fd6e67e35e56afc1b846187bf1 100644 (file)
@@ -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
index 40d49139dc6b91ea61d2494b5407c9c0f06d5e9d..5e1685df1fc69adf48d708a4817938aeda7d8127 100644 (file)
@@ -3796,6 +3796,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)
 {
@@ -4001,6 +4018,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)
 {
@@ -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;