Add dwarf_aggregate_size helper function to libdw.
authorRoland McGrath <roland@redhat.com>
Wed, 6 Jan 2010 06:53:31 +0000 (22:53 -0800)
committerRoland McGrath <roland@redhat.com>
Wed, 6 Jan 2010 06:53:31 +0000 (22:53 -0800)
NEWS
libdw/ChangeLog
libdw/Makefile.am
libdw/dwarf_srclang.c
libdw/libdw.h
libdw/libdw.map
libdw/libdwP.h

diff --git a/NEWS b/NEWS
index 5680b15..24aa18b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 Version 0.144:
 
+libdw: New function dwarf_aggregate_size for computing (constant) type
+       sizes, including array_type cases with nontrivial calculation.
+
 readelf: Don't give errors for missing info under -a.
         Handle Linux "VMCOREINFO" notes under -n.
 
index bbbebfe..0afa850 100644 (file)
@@ -1,5 +1,14 @@
 2010-01-05  Roland McGrath  <roland@redhat.com>
 
+       * dwarf_aggregate_size.c: New file.
+       * Makefile.am (libdw_a_SOURCES): Add it.
+       * libdw.h: Declare it.
+       * libdwP.h: Add INTDECL.
+       * libdw.map (ELFUTILS_0.144): New set.  Add dwarf_aggregate_size.
+
+       * dwarf_srclang.c: Add INTDEF.
+       * libdwP.h: Add INTDECL.
+
        * dwarf.h: Add some more DW_AT_GNU_* types from gcc.
 
        * dwarf.h: Add DW_AT_GNU_vector, DW_AT_GNU_template_name.
index 4d041cf..23896fa 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 ##
-## Copyright (C) 2002-2009 Red Hat, Inc.
+## Copyright (C) 2002-2010 Red Hat, Inc.
 ## This file is part of Red Hat elfutils.
 ##
 ## Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -88,7 +88,8 @@ libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
                  cie.c fde.c cfi.c frame-cache.c \
                  dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \
                  dwarf_cfi_addrframe.c \
-                 dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c
+                 dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
+                 dwarf_aggregate_size.c
 
 if MAINTAINER_MODE
 BUILT_SOURCES = $(srcdir)/known-dwarf.h
index f1ff954..305ffcd 100644 (file)
@@ -1,5 +1,5 @@
 /* Return source language attribute of DIE.
-   Copyright (C) 2003, 2005, 2009 Red Hat, Inc.
+   Copyright (C) 2003-2010 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -67,5 +67,6 @@ dwarf_srclang (die)
                                  (die, DW_AT_language, &attr_mem),
                                  &value) == 0 ? (int) value : -1;
 }
+INTDEF (dwarf_srclang)
 OLD_VERSION (dwarf_srclang, ELFUTILS_0.122)
 NEW_VERSION (dwarf_srclang, ELFUTILS_0.143)
index 7602e61..94320c7 100644 (file)
@@ -1,5 +1,5 @@
 /* Interfaces for libdw.
-   Copyright (C) 2002-2009 Red Hat, Inc.
+   Copyright (C) 2002-2010 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -362,7 +362,7 @@ extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
    Returns 1 if no sibling could be found and, if RESULT is not
    the same as DIE, it sets RESULT->addr to the address of the
    (non-sibling) DIE that follows this one, or NULL if this DIE
-   was the last one in the cokmpilation unit.  */
+   was the last one in the compilation unit.  */
 extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
      __nonnull_attribute__ (2);
 
@@ -632,6 +632,11 @@ extern int dwarf_getlocation_implicit_value (Dwarf_Attribute *attr,
   __nonnull_attribute__ (2, 3);
 
 
+/* Compute the byte-size of a type DIE according to DWARF rules.
+   For most types, this is just DW_AT_byte_size.
+   For DW_TAG_array_type it can apply much more complex rules.  */
+extern int dwarf_aggregate_size (Dwarf_Die *die, Dwarf_Word *size);
+
 
 /* Return scope DIEs containing PC address.
    Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
index b39db48..8eaeacd 100644 (file)
@@ -227,3 +227,8 @@ ELFUTILS_0.143 {
     dwarf_srclang;
 
 } ELFUTILS_0.142;
+
+ELFUTILS_0.144 {
+  global:
+    dwarf_aggregate_size;
+} ELFUTILS_0.143;
index 0284580..248a58d 100644 (file)
@@ -1,5 +1,5 @@
 /* Internal definitions for libdwarf.
-   Copyright (C) 2002-2009 Red Hat, Inc.
+   Copyright (C) 2002-2010 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -595,6 +595,7 @@ unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
 
 
 /* Aliases to avoid PLTs.  */
+INTDECL (dwarf_aggregate_size)
 INTDECL (dwarf_attr)
 INTDECL (dwarf_attr_integrate)
 INTDECL (dwarf_begin_elf)
@@ -624,6 +625,7 @@ INTDECL (dwarf_nextcu)
 INTDECL (dwarf_offdie)
 INTDECL (dwarf_ranges)
 INTDECL (dwarf_siblingof)
+INTDECL (dwarf_srclang)
 INTDECL (dwarf_tag)
 
 #endif /* libdwP.h */