public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH 8/9] libdw: Handle DWARF5 immutable, packed and shared in dwarf_peel_type.
Date: Wed, 26 Jul 2017 22:08:00 -0000	[thread overview]
Message-ID: <1501106866-5846-9-git-send-email-mark@klomp.org> (raw)
In-Reply-To: <1501106866-5846-1-git-send-email-mark@klomp.org>

Also update the documentation to explain that any type alias or modifier
that doesn't modify, change the structural layout or the way to access
the underlying type is peeled. Explicitly mention pointer and reference
types as examples of modifiers that don't obey that rule and so aren't
peeled.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 ChangeLog               |  4 ++++
 NEWS                    |  1 +
 libdw/ChangeLog         |  6 ++++++
 libdw/dwarf_peel_type.c |  7 +++++--
 libdw/libdw.h           | 28 ++++++++++++++++++----------
 5 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b4722db..b7efc84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-07-26  Mark Wielaard  <mark@klomp.org>
 
+	* NEWS: Mention dwarf_peel_type DWARF5 tags improvement.
+
+2017-07-26  Mark Wielaard  <mark@klomp.org>
+
 	* NEWS: Mention new DWARF5 calling conventions and defaulted member
 	function.
 
diff --git a/NEWS b/NEWS
index 5f85fc2..054ac95 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ Version 0.170
 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.
+       dwarf_peel_type now handles DWARF5 immutable, packed and shared tags.
 
 strip: Add -R, --remove-section=SECTION and --keep-section=SECTION.
 
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index a74733c..d0b3f4c 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,11 @@
 2017-07-26  Mark Wielaard  <mark@klomp.org>
 
+	* dwarf_peel_type.c (dwarf_peel_type): Handle DW_TAG_immutable_type,
+	DW_TAG_packed_type and DW_TAG_shared_type.
+	* libdw.h (dwarf_peel_type): Extend documentation.
+
+2017-07-26  Mark Wielaard  <mark@klomp.org>
+
 	* dwarf.h: Add DW_DEFAULTED_no, DW_DEFAULTED_in_class and
 	DW_DEFAULTED_out_of_class.
 
diff --git a/libdw/dwarf_peel_type.c b/libdw/dwarf_peel_type.c
index 9735694..6bbfd42 100644
--- a/libdw/dwarf_peel_type.c
+++ b/libdw/dwarf_peel_type.c
@@ -1,5 +1,5 @@
 /* Peel type aliases and qualifier tags from a type DIE.
-   Copyright (C) 2014, 2015 Red Hat, Inc.
+   Copyright (C) 2014, 2015, 2016 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -50,7 +50,10 @@ dwarf_peel_type (Dwarf_Die *die, Dwarf_Die *result)
 	 || tag == DW_TAG_const_type
 	 || tag == DW_TAG_volatile_type
 	 || tag == DW_TAG_restrict_type
-	 || tag == DW_TAG_atomic_type)
+	 || tag == DW_TAG_atomic_type
+	 || tag == DW_TAG_immutable_type
+	 || tag == DW_TAG_packed_type
+	 || tag == DW_TAG_shared_type)
     {
       Dwarf_Attribute attr_mem;
       Dwarf_Attribute *attr = INTUSE (dwarf_attr_integrate) (result, DW_AT_type,
diff --git a/libdw/libdw.h b/libdw/libdw.h
index 49c4ebb..63a38ff 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
@@ -1,5 +1,5 @@
 /* Interfaces for libdw.
-   Copyright (C) 2002-2010, 2013, 2014 Red Hat, Inc.
+   Copyright (C) 2002-2010, 2013, 2014, 2016 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -378,8 +378,11 @@ extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
 extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
      __nonnull_attribute__ (2);
 
-/* For type aliases and qualifier type DIEs follow the DW_AT_type
-   attribute (recursively) and return the underlying type Dwarf_Die.
+/* For type aliases and qualifier type DIEs, which don't modify or
+   change the structural layout of the underlying type, follow the
+   DW_AT_type attribute (recursively) and return the underlying type
+   Dwarf_Die.
+
    Returns 0 when RESULT contains a Dwarf_Die (possibly equal to the
    given DIE) that isn't a type alias or qualifier type.  Returns 1
    when RESULT contains a type alias or qualifier Dwarf_Die that
@@ -387,13 +390,18 @@ extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
    attribute).  Returns -1 when an error occured.
 
    The current DWARF specification defines one type alias tag
-   (DW_TAG_typedef) and three qualifier type tags (DW_TAG_const_type,
-   DW_TAG_volatile_type, DW_TAG_restrict_type).  DWARF5 defines one
-   other qualifier type tag (DW_TAG_atomic_type).  A future version of
-   this function might peel other alias or qualifier type tags if a
-   future DWARF version or GNU extension defines other type aliases or
-   qualifier type tags that don't modify or change the structural
-   layout of the underlying type.  */
+   (DW_TAG_typedef) and seven modifier/qualifier type tags
+   (DW_TAG_const_type, DW_TAG_volatile_type, DW_TAG_restrict_type,
+   DW_TAG_atomic_type, DW_TAG_immutable_type, DW_TAG_packed_type and
+   DW_TAG_shared_type).  This function won't peel modifier type
+   tags that change the way the underlying type is accessed such
+   as the pointer or reference type tags (DW_TAG_pointer_type,
+   DW_TAG_reference_type or DW_TAG_rvalue_reference_type).
+
+   A future version of this function might peel other alias or
+   qualifier type tags if a future DWARF version or GNU extension
+   defines other type aliases or qualifier type tags that don't modify,
+   change the structural layout or the way to access the underlying type.  */
 extern int dwarf_peel_type (Dwarf_Die *die, Dwarf_Die *result)
     __nonnull_attribute__ (2);
 
-- 
1.8.3.1

  parent reply	other threads:[~2017-07-26 22:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 22:07 Some easy DWARF5 extensions Mark Wielaard
2017-07-26 22:08 ` [PATCH 6/9] libdw: DWARF5 Add DW_CC_pass_by_reference and DW_CC_pass_by_reference Mark Wielaard
2017-07-26 22:08 ` [PATCH 1/9] libdw: Add DWARF5 attributes Mark Wielaard
2017-07-26 22:08 ` [PATCH 4/9] libdw: DWARF5 Add new DW_LANG codes and default lower array bound Mark Wielaard
2017-07-26 22:08 ` [PATCH 2/9] libdw: Add new DWARF5 tag constants Mark Wielaard
2017-07-26 22:08 ` [PATCH 9/9] libdw: Add DW_MACRO constants and DW_MACRO_GNU compatibility defines Mark Wielaard
2017-07-26 22:08 ` [PATCH 3/9] libdw: Add new DWARF5 character encodings Mark Wielaard
2017-07-26 22:08 ` [PATCH 7/9] Handle DWARF5 defaulted member function encodings Mark Wielaard
2017-07-26 22:08 ` Mark Wielaard [this message]
2017-07-26 22:08 ` [PATCH 5/9] libdw: Add dwarf_default_lower_bound Mark Wielaard
2017-08-02 12:03 ` Some easy DWARF5 extensions Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1501106866-5846-9-git-send-email-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).