public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 5/6] libdw: Handle immutable, packed and shared types in dwarf_peel_type.
@ 2016-10-28 16:06 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2016-10-28 16:06 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 4038 bytes --]

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 peel. Explicitly mention pointer and reference
types, which aren't peeled.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libdw/dwarf_peel_type.c |  7 +++++--
 libdw/libdw.h           | 28 ++++++++++++++++++----------
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/libdw/dwarf_peel_type.c b/libdw/dwarf_peel_type.c
index 5dca8f8..29c7cac 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) (die, DW_AT_type,
diff --git a/libdw/libdw.h b/libdw/libdw.h
index 3a05595..56d6141 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
@@ -399,8 +399,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
@@ -408,13 +411,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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-28 16:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-28 16:06 [PATCH 5/6] libdw: Handle immutable, packed and shared types in dwarf_peel_type Mark Wielaard

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).