<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.sysutils.elfutils.devel">
    <title>gmane.comp.sysutils.elfutils.devel</title>
    <link>http://blog.gmane.org/gmane.comp.sysutils.elfutils.devel</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2191"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2183"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2182"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2176"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2172"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2171"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2169"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2166"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2162"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2143"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2131"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2123"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2113"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2112"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2111"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2110"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2109"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2108"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2105"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2103"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2191">
    <title>FYI small test environment tweak</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2191</link>
    <description>&lt;pre&gt;I pushed the following:

commit dbbc67a97ace66c3adc299f26261fdec99d0c0d6
Author: Mark Wielaard &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
Date:   Fri May 11 12:57:57 2012 +0200

    TESTS_ENVIRONMENT set LC_ALL and LANG to C.
    
    Some tests rely on sort order and output of tools that might be localized.
    
    Reported-by: Paweł Sikora &amp;lt;pluto&amp;lt; at &amp;gt;pld-linux.org&amp;gt;

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 4c6e9f7..841742d 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-05-11  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+       * Makefile.am (TESTS_ENVIRONMENT): Set LC_ALL and LANG to C.
+
 2012-05-07  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
        * low_high_pc.c: Allow highpc == lowpc for CU DIEs for buggy GCC.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 61247e4..660791c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -169,13 +169,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
 
 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
                              bindir=$(DESTDIR)$(bindir) \
+                             LC_ALL=C LANG=C \
                              $(srcdir)/test-wrapper.sh \
                              installed $(tests_rpath) \
                              $(program_transform_name)
 if STANDALONE
 TESTS_ENVIRONMENT = $(installed_TESTS_ENVIRONMENT)
 else !STANDALONE
-TESTS_ENVIRONMENT = $(srcdir)/test-wrapper.sh \
+TESTS_ENVIRONMENT = LC_ALL=C LANG=C $(srcdir)/test-wrapper.sh \
                    ../libdw:../backends:../libelf:../libasm
 
 installcheck-local:

_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-05-11T11:08:56</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2183">
    <title>Function symbol retention after stripping</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2183</link>
    <description>&lt;pre&gt;Hi all,

I'm trying to get gbd backtraces to give function names without having
a package's debuginfo installed. Would elfutils take a patch allowing
strip to take an option for keeping the minimal amount of information
needed to do this?

I'm still trying to figure out how to do this exactly but right now I
think I would be keeping SHT_SYMTAB and SHT_DYNSYM function symbols
but I haven't looked at this code before and I'm still trying to
figure out how it all comes together. Any advice would be appreciated
if you'd be okay with this functionality in elfutils.


Thanks,
William
_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Douglas, William</dc:creator>
    <dc:date>2012-05-07T18:51:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2182">
    <title>FYI: tests/low_high_pc.c: Allow highpc == lowpc for CU DIEs forbuggy GCC.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2182</link>
    <description>&lt;pre&gt;I pushed the following. Although the bug is fixed in GCC 4.7 that has
only been released last month. Most distros are still based on 4.6 or
lower.

commit d9bc75fc20f0ce5064cac192a518af3c7192e96d
Author: Mark Wielaard &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
Date:   Mon May 7 13:29:52 2012 +0200

    tests/low_high_pc.c: Allow highpc == lowpc for CU DIEs for buggy GCC.
    
    GCC &amp;lt; 4.7 had a bug where no code CUs got a highpc == lowpc.
    Allow that, because it is not the main purpose of this test.

diff --git a/tests/ChangeLog b/tests/ChangeLog
index abc7340..4c6e9f7 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-05-07  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* low_high_pc.c: Allow highpc == lowpc for CU DIEs for buggy GCC.
+
 2012-04-27  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
 * Makefile.am (TESTS): Add run-low_high_pc.sh
diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
index 3054046..6fc8b15 100644
--- a/tests/low_high_pc.c
+++ b/tests/low_high_pc.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -72,9 +72,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; handle_die (Dwarf_Die *die, void *arg)
   if (dwarf_highpc (die, &amp;amp;highpc) != 0 &amp;amp;&amp;amp; dwarf_hasattr (die, DW_AT_high_pc))
     fail (off, name, "has DW_AT_high_pc but dwarf_highpc fails");
 
+  /* GCC &amp;lt; 4.7 had a bug where no code CUs got a highpc == lowpc.
+     Allow that, because it is not the main purpose of this test.  */
   if (dwarf_hasattr (die, DW_AT_low_pc)
       &amp;amp;&amp;amp; dwarf_hasattr (die, DW_AT_high_pc)
-      &amp;amp;&amp;amp; highpc &amp;lt;= lowpc)
+      &amp;amp;&amp;amp; highpc &amp;lt;= lowpc
+      &amp;amp;&amp;amp; ! (dwarf_tag (die) == DW_TAG_compile_unit &amp;amp;&amp;amp; highpc == lowpc))
     {
       printf("lowpc: %lx, highpc: %lx\n", lowpc, highpc);
       fail (off, name, "highpc &amp;lt;= lowpc");

_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-05-07T11:34:59</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2176">
    <title>PATCH: dwarf_highpc: Handle DW_AT_high_pc being a constant offsetfrom DW_AT_low_pc.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2176</link>
    <description>&lt;pre&gt;Hi,

The DWARF spec says (since version 4) that DW_AT_high_pc can be
represented by a constant form.

        If the value of the DW_AT_high_pc is of class address, it is the
        relocated address of the first location past the last
        instruction associated with the entity; if it is of class
        constant, the value is an unsigned integer offset which when
        added to the low PC gives the address of the first location past
        the last instruction associated with the entity.

I have a patch for gcc to encode DW_AT_high_pc this way (which saves a
lot of relocations) and jakub has a patch for dwz to encode
DW_AT_high_pc in the smallest possible constant form, which can save ~1%
on the size of debuginfo.

The attached patch adds a testcase for this and makes dwarf_highpc ()
handle the constant form.

Does this look OK?

Thanks,

Mark
_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-04-27T11:11:27</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2172">
    <title>FYI: Removed old libdwarf test show-ciefde.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2172</link>
    <description>&lt;pre&gt;Hi,

elfutils libdwarf was removed a long time ago and this testcase was
never actually ran anyway (which is why nobody noticed it was broken).
I just removed it.

commit bdad8e39aede889dbac95944a07eaebdebe4ad89
Author: Mark Wielaard &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
Date:   Thu Apr 26 12:24:33 2012 +0200

    Removed old libdwarf test show-ciefde.

diff --git a/tests/ChangeLog b/tests/ChangeLog
index c38ede5..ffe61d5 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-04-26  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+       * Makefile.am (EXTRA_DIST): Remove run-show-ciefde.sh.
+       * run-show-ciefde.sh: Removed old libdwarf test.
+       * show-ciefde.c: Likewise.

_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-04-26T10:28:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2171">
    <title>elflint: (zero sized section) alloc flag set but section not in anyloaded segment</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2171</link>
    <description>&lt;pre&gt;Hi,

Against development versions of gcc/binutils elflint gives some
complaints like:

section [24] '.tm_clone_table': alloc flag set but section not in any
loaded segment

This is because that section's size is zero. So it is somewhat
reasonable IMHO that the linker doesn't put it in any segment.

Is the following patch to elflint OK?

Thanks,

Mark
_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-04-26T09:58:52</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2169">
    <title>FYI: readelf.c (print_ops): Add missing DW_OP_GNU operands.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2169</link>
    <description>&lt;pre&gt;Pushed the following commit as obvious.

commit 716486d5a15bdfb528c5d011dc623fa0f6fdc2af
Author: Mark Wielaard &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
Date:   Tue Apr 24 11:56:42 2012 +0200

    readelf.c (print_ops): Add missing DW_OP_GNU operands.
    
    DW_OP_GNU_push_tls_address, DW_OP_GNU_uinit and DW_OP_GNU_encoded_addr.

diff --git a/src/ChangeLog b/src/ChangeLog
index 642df1b..cae5e6b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-04-24  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* readelf.c (print_ops): Add DW_OP_GNU_push_tls_address,
+DW_OP_GNU_uinit and DW_OP_GNU_encoded_addr.
+
 2012-03-28  Roland McGrath  &amp;lt;roland&amp;lt; at &amp;gt;hack.frob.com&amp;gt;
 
 * elflint.c (special_sections): Accept SHF_INFO_LINK for reloc sections.
diff --git a/src/readelf.c b/src/readelf.c
index b70779d..b4e9fc8 100644
--- a/src/readelf.c
+++ b/src/readelf.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -4065,6 +4065,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
       [DW_OP_bit_piece] = "bit_piece",
       [DW_OP_implicit_value] = "implicit_value",
       [DW_OP_stack_value] = "stack_value",
+      [DW_OP_GNU_push_tls_address] = "GNU_push_tls_address",
+      [DW_OP_GNU_uninit] = "GNU_uninit",
+      [DW_OP_GNU_encoded_addr] = "GNU_encoded_addr",
       [DW_OP_GNU_implicit_pointer] = "GNU_implicit_pointer",
       [DW_OP_GNU_entry_value] = "GNU_entry_value",
       [DW_OP_GNU_const_type] = "GNU_const_type",

_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-04-24T10:00:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2166">
    <title>Elfutils 0.153 build problem</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2166</link>
    <description>&lt;pre&gt;I'm trying (and failing) to build elfutils 0.153 on my i686 Linux box.

The lines around the error are:

gcc -std=gnu99 -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2
-g -O2   -o libdw.so -shared -o libdw.so
-Wl,--soname,libdw.so.1,-z,defs \
-Wl,--enable-new-dtags,-rpath,/usr/lib/elfutils \
-Wl,--version-script,libdw.map,--no-undefined \
-Wl,--whole-archive libdw_pic.a ../libdwfl/libdwfl_pic.a
../libebl/libebl.a ../libelf/libelf.so -Wl,--no-whole-archive\
-ldl -llzma -lbz2 -lz
if readelf -d libdw.so | fgrep -q TEXTREL; then exit 1; fi
make[1]: *** [libdw.so] Error 1

For good measure I ran "readelf -d | fgrep TEXTREL" on libdl.so,
liblzma.so, libbz2.so, and libz.so, but they all come back clean.

Running readelf -d libdw.so gets me:

Dynamic section at offset 0x49a60 contains 32 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libelf.so.1]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [liblzma.so.5]
 0x00000001 (NEEDED)                     Shared library: [libbz2.so.1.0]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [ld-linux.so.2]
 0x0000000e (SONAME)                     Library soname: [libdw.so.1]
 0x0000000f (RPATH)                      Library rpath: [/usr/lib/elfutils]
 0x0000001d (RUNPATH)                    Library runpath: [/usr/lib/elfutils]
 0x0000000c (INIT)                       0x542c
 0x0000000d (FINI)                       0x39f58
 0x00000004 (HASH)                       0xf4
 0x00000005 (STRTAB)                     0x1df0
 0x00000006 (SYMTAB)                     0xa10
 0x0000000a (STRSZ)                      4725 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000003 (PLTGOT)                     0x4abb0
 0x00000002 (PLTRELSZ)                   992 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x504c
 0x00000011 (REL)                        0x35bc
 0x00000012 (RELSZ)                      6800 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000016 (TEXTREL)                    0x0
 0x6ffffffc (VERDEF)                     0x32e4
 0x6ffffffd (VERDEFNUM)                  14
 0x0000001e (FLAGS)                      TEXTREL
 0x6ffffffe (VERNEED)                    0x34cc
 0x6fffffff (VERNEEDNUM)                 4
 0x6ffffff0 (VERSYM)                     0x3066
 0x6ffffffa (RELCOUNT)                   764
 0x00000000 (NULL)                       0x0


Here's the following versions of packages installed:
gcc 4.6.3
binutils 2.22
glibc 2.15
Linux 3.3.1

Any ideas? I'm stumped.

&lt;/pre&gt;</description>
    <dc:creator>Zachary McGrew</dc:creator>
    <dc:date>2012-04-13T00:54:22</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2162">
    <title>[Patch] gelf_offscn vs SHT_NOBITS</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2162</link>
    <description>&lt;pre&gt;Hi,

While coming up with a test case for rhbz#807823 "elflint doesn't
recognize SHF_INFO_LINK on relocation sections", I came across another
issue. Not just with elflint, but also with readelf -d. If there is a
SHT_NOBITS section before the .dynamic section then gelf_offscn will
miss it. The solution is similar to commit e9c4e8 (Do not match empty
sections at OFFSET), skip SHT_NOBITS sections too if there is a "real"
section at the same offset that does have content. Does the solution
look sane?

The test binary is a testcase for both this issue and the original
rhbz#807823. Both tests fail before and succeed after the fixes.

Patch attached and in git on the mjw/offscn_nobits branch for those that
want to check out the test binary.

Cheers,

Mark
commit 191d1f0b9163593eee8c4f5cbe3e95cabf6ae9a9
Author: Mark Wielaard &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
Date:   Mon Apr 2 17:11:25 2012 +0200

    elf32_offscn.c: Do not match SHT_NOBITS sections at OFFSET.
    
    readelf -d doesn't work if a SHT_NOBITS section is right before the actual
    .dynamic section at the same offset. elflint also fails on such binaries.
    So skip SHT_NOBITS sections at the same offset in [g]elf[32|64]_offscn().

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 19b76e8..89dd35f 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-04-02  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* elf32_offscn.c: Do not match SHT_NOBITS sections at OFFSET unless
+there are no nonempty sections at that offset.
+
 2012-03-21  Roland McGrath  &amp;lt;roland&amp;lt; at &amp;gt;hack.frob.com&amp;gt;
 
 * elf-knowledge.h (SECTION_STRIP_P): Remove &amp;lt; SHT_NUM check.
diff --git a/libelf/elf32_offscn.c b/libelf/elf32_offscn.c
index 86eff8b..5dcfc4a 100644
--- a/libelf/elf32_offscn.c
+++ b/libelf/elf32_offscn.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -101,7 +101,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; elfw2(LIBELFBITS,offscn) (elf, offset)
     /* If this section is empty, the following one has the same
        sh_offset.  We presume the caller is looking for a nonempty
        section, so keep looking if this one is empty.  */
-    if (runp-&amp;gt;data[i].shdr.ELFW(e,LIBELFBITS)-&amp;gt;sh_size != 0)
+    if (runp-&amp;gt;data[i].shdr.ELFW(e,LIBELFBITS)-&amp;gt;sh_size != 0
+&amp;amp;&amp;amp; runp-&amp;gt;data[i].shdr.ELFW(e,LIBELFBITS)-&amp;gt;sh_type != SHT_NOBITS)
       goto out;
   }
 
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 8d2b83f..6f6c592 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-04-02  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* Makefile.am (TESTS): Add run-readelf-d.sh.
+(EXTRA_DIST): Add testlib_dynseg.so.bz2 and run-readelf-d.sh.
+* run-readelf-d.sh: New test.
+* run-elflint-test.sh: Check new testfile.
+
 2012-03-21  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
 * typeiter.c: New file.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f2c211b..980aa12 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -86,7 +86,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 run-disasm-x86.sh run-disasm-x86-64.sh \
 run-early-offscn.sh run-dwarf-getmacros.sh \
 run-test-flag-nobits.sh run-prelink-addr-test.sh \
-run-dwarf-getstring.sh run-rerequest_tag.sh run-typeiter.sh
+run-dwarf-getstring.sh run-rerequest_tag.sh run-typeiter.sh \
+run-readelf-d.sh
 # run-show-ciefde.sh
 
 if !STANDALONE
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -162,7 +163,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
      testfile55-32.prelink.bz2 testfile55-64.bz2 \
      testfile55-64.debug.bz2 testfile55-64.prelink.bz2 \
      testfile56.bz2 testfile57.bz2 testfile58.bz2 \
-     run-typeiter.sh testfile59.bz2
+     run-typeiter.sh testfile59.bz2 \
+     run-readelf-d.sh testlib_dynseg.so.bz2
 
 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
       bindir=$(DESTDIR)$(bindir) \
diff --git a/tests/run-elflint-test.sh b/tests/run-elflint-test.sh
index e0e1c54..0c872fe 100755
--- a/tests/run-elflint-test.sh
+++ b/tests/run-elflint-test.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -44,4 +44,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; testrun ../src/elflint -q --gnu-ld testfile42
 testfiles testfile46
 testrun ../src/elflint -q testfile46
 
+# see also run-readelf-d.sh
+testfiles testlib_dynseg.so
+testrun ../src/elflint -q --gnu-ld testlib_dynseg.so
+
 exit 0
diff --git a/tests/run-readelf-d.sh b/tests/run-readelf-d.sh
new file mode 100755
index 0000000..9022e70
--- /dev/null
+++ b/tests/run-readelf-d.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,78 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#! /bin/sh
+# Copyright (C) 2012 Red Hat, Inc.
+# This file is part of Red Hat elfutils.
+#
+# Red Hat elfutils is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# Red Hat elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Red Hat elfutils; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+#
+# Red Hat elfutils is an included package of the Open Invention Network.
+# An included package of the Open Invention Network is a package for which
+# Open Invention Network licensees cross-license their patents.  No patent
+# license is granted, either expressly or impliedly, by designation as an
+# included package.  Should you wish to participate in the Open Invention
+# Network licensing program, please visit www.openinventionnetwork.com
+# &amp;lt;http://www.openinventionnetwork.com&amp;gt;.
+
+. $srcdir/test-subr.sh
+
+# #include &amp;lt;stdio.h&amp;gt;
+# 
+# __thread int i;
+# 
+# void print_i ()
+# {
+#   printf("%d\n", i);
+# }
+#
+# gcc -fPIC -shared -o testlib_dynseg.so testlib_dynseg.c
+# With ld --version
+# GNU gold (GNU Binutils 2.22.52.20120402) 1.11
+
+testfiles testlib_dynseg.so
+
+testrun_compare ../src/readelf -d testlib_dynseg.so &amp;lt;&amp;lt;\EOF
+
+Dynamic segment contains 28 entries:
+ Addr: 0x00000000000017e0  Offset: 0x0007e0  Link to section: [ 3] '.dynstr'
+  Type              Value
+  PLTGOT            0x00000000000019c8
+  PLTRELSZ          72 (bytes)
+  JMPREL            0x0000000000000568
+  PLTREL            RELA
+  RELA              0x00000000000004d8
+  RELASZ            144 (bytes)
+  RELAENT           24 (bytes)
+  RELACOUNT         1
+  SYMTAB            0x0000000000000228
+  SYMENT            24 (bytes)
+  STRTAB            0x0000000000000360
+  STRSZ             190 (bytes)
+  GNU_HASH          0x0000000000000420
+  NEEDED            Shared library: [libc.so.6]
+  NEEDED            Shared library: [ld-linux-x86-64.so.2]
+  INIT              0x00000000000005b0
+  FINI              0x0000000000000748
+  VERSYM            0x0000000000000460
+  VERDEF            0x000000000000047c
+  VERDEFNUM         1
+  VERNEED           0x0000000000000498
+  VERNEEDNUM        2
+  NULL              
+  NULL              
+  NULL              
+  NULL              
+  NULL              
+  NULL              
+EOF
+
+exit 0
diff --git a/tests/testlib_dynseg.so.bz2 b/tests/testlib_dynseg.so.bz2
new file mode 100755
index 0000000..94296a4
Binary files /dev/null and b/tests/testlib_dynseg.so.bz2 differ
_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-04-02T15:34:41</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2143">
    <title>[Patch] Don't relocate compressed sections</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2143</link>
    <description>&lt;pre&gt;Hi,

As pointed out in https://bugzilla.redhat.com/show_bug.cgi?id=807053
relocating a compressed section will corrupt it. To more properly
support compressed sections we should finish the roland/relocate branch
for lazy relocations work. The best we can do for now is to not corrupt
the contents of the compressed sections and not crash when we don't have
all Dwarf debug section data. The attached two patches do that.

Cheers,

Mark
_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-03-28T09:44:52</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2131">
    <title>FYI: readelf.c (print_gdb_index_section): Accept version 6.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2131</link>
    <description>&lt;pre&gt;Hi,

Just applied the following to accept a newer version number
for .gdb_index in readelf. No real change in the format, the updated
version is just a marker that there are more symbols in the index
available.

Cheers,

Mark
_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Mark Wielaard</dc:creator>
    <dc:date>2012-03-21T15:13:32</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2123">
    <title>Strip on mips</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2123</link>
    <description>&lt;pre&gt;Hi,

I'm trying to debug why strip on mips isn't working properly.
What I see is that for the debug sections, sh_type is not set to
SHT_PROGBITS but to SHT_MIPS_DWARF.

The stripped file still ends up with the debug information it it,
and the file that is supposed to have the debug symbols in it
has it set to SHT_NOBITS, and is rather small.

I'm assuming this is because of the SHT_MIPS_DWARF.  I'm not sure
how to find where it's going wrong.


Kurt

_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Kurt Roeckx</dc:creator>
    <dc:date>2012-03-20T23:13:41</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2113">
    <title>[PATCH 5/5] Make it possible to read multiple .debug_types sections.Each new .debug_types section is added to the end ofthe section vector. Various internal APIs were updatedto understand multiple .debug_types sections. A newfunction, dwarf_next_unit_or_section, was added toallow iteration over multiple type sections.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2113</link>
    <description>&lt;pre&gt; libdw/ChangeLog                            |   29 +++++++++++
 libdw/dwarf_begin_elf.c                    |   53 ++++++++++++++++----
 libdw/dwarf_formref_die.c                  |    4 +-
 libdw/dwarf_getlocation_implicit_pointer.c |    4 +-
 libdw/dwarf_nextcu.c                       |   67 +++++++++++++++++++++++---
 libdw/dwarf_offdie.c                       |   19 +++++---
 libdw/libdw.h                              |   21 ++++++++-
 libdw/libdw.map                            |    5 ++
 libdw/libdwP.h                             |    9 +++-
 libdw/libdw_findcu.c                       |   34 ++++++++-----
 tests/ChangeLog                            |   10 ++++
 tests/Makefile.am                          |   10 ++--
 tests/debugtypes.c                         |   72 ++++++++++++++++++++++++++++
 tests/run-debugtypes.sh                    |   35 +++++++++++++
 tests/testfile59.bz2                       |  Bin 0 -&amp;gt; 1424 bytes
 15 files changed, 325 insertions(+), 47 deletions(-)
 create mode 100644 tests/debugtypes.c
 create mode 100755 tests/run-debugtypes.sh
 create mode 100644 tests/testfile59.bz2

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 60f9ae0..c9e78a9 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,34 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
+* libdw_findcu.c (__libdw_intern_next_unit): Use
+dwarf_next_unit_or_section.  Initialize CU's section index.
+(findcu_cb): Compare section indices.
+(__libdw_findcu): Remove 'debug_type' argument, add 'sec_index'
+argument.  Update.
+* libdwP.h (struct Dwarf) [next_tu_cu]: New field.
+(struct Dwarf_CU) [sec_index]: New field.
+(__libdw_findcu, __libdw_offdie): Update.
+(dwarf_next_unit_or_section): Add INTDECL.
+* libdw.map: Add dwarf_next_unit_or_section.
+* libdw.h (dwarf_next_unit_or_section): Declare.
+* dwarf_offdie.c (__libdw_offdie): Remove 'debug_types' argument,
+add 'sec_index' argument.  Validate section index.
+(dwarf_offdie): Update.
+(dwarf_offdie_types): Update.
+* dwarf_nextcu.c (dwarf_next_unit_or_section): New function.
+(dwarf_next_unit): Rewrite to use dwarf_next_unit_or_section.
+(dwarf_nextcu): Likewise.
+* dwarf_getlocation_implicit_pointer.c
+(dwarf_getlocation_implicit_pointer): Pass CU's section index to
+__libdw_offdie.
+* dwarf_formref_die.c (dwarf_formref_die): Use CU's section
+index.
+* dwarf_begin_elf.c (add_section): New function.
+(check_section): Use it.
+(dwarf_begin_elf): Initialize next_tu_cu.
+
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
 * dwarf_begin_elf.c (check_section): Remove 'inscngrp' argument.
 (global_read, scngrp_read): Update.
 
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 4a726ce..ad253ec 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -87,6 +87,36 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static const char dwarf_scnnames[IDX_last][17] =
 #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
 
 
+static bool
+add_section (Dwarf *result, size_t cnt, Elf_Data *data, bool gzipped)
+{
+  if (unlikely (result-&amp;gt;sectiondata[cnt].data != NULL))
+    {
+      /* Allocate a new entry for .debug_types.  */
+      ++result-&amp;gt;n_sections;
+      result-&amp;gt;sectiondata = realloc (result-&amp;gt;sectiondata,
+     result-&amp;gt;n_sections
+     * sizeof (struct Dwarf_Section));
+      if (result-&amp;gt;sectiondata == NULL)
+{
+  __libdw_free_zdata (result);
+  __libdw_seterrno (DWARF_E_NOMEM);
+  free (result-&amp;gt;sectiondata);
+  free (result);
+  return false;
+}
+
+      cnt = result-&amp;gt;n_sections - 1;
+    }
+
+  result-&amp;gt;sectiondata[cnt].data = data;
+#if USE_ZLIB
+  result-&amp;gt;sectiondata[cnt].gzipped = gzipped;
+#endif
+
+  return true;
+}
+
 static Dwarf *
 check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn)
 {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -128,15 +158,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn)
     if (strcmp (scnname, dwarf_scnnames[cnt]) == 0)
       {
 /* Found it.  Remember where the data is.  */
-if (unlikely (result-&amp;gt;sectiondata[cnt].data != NULL))
-  /* A section appears twice.  That's bad.  We ignore the section.  */
+if (unlikely (result-&amp;gt;sectiondata[cnt].data != NULL
+      &amp;amp;&amp;amp; cnt != IDX_debug_types))
+  /* A section appears twice.  That's bad.  We ignore the
+     section, unless it is a .debug_types section.  */
   break;
 
 /* Get the section data.  */
 Elf_Data *data = elf_getdata (scn, NULL);
 if (data != NULL &amp;amp;&amp;amp; data-&amp;gt;d_size != 0)
   /* Yep, there is actually data available.  */
-  result-&amp;gt;sectiondata[cnt].data = data;
+  if (!add_section (result, cnt, data, false))
+    return NULL;
 
 break;
       }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -146,8 +179,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn)
       {
 /* A compressed section.  */
 
-if (unlikely (result-&amp;gt;sectiondata[cnt].data != NULL))
-  /* A section appears twice.  That's bad.  We ignore the section.  */
+if (unlikely (result-&amp;gt;sectiondata[cnt].data != NULL
+      &amp;amp;&amp;amp; cnt != IDX_debug_types))
+  /* A section appears twice.  That's bad.  We ignore the
+     section, unless it is a .debug_types section.  */
   break;
 
 /* Get the section data.  */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -200,11 +235,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn)
 
     if (unlikely (zrc != Z_OK) || unlikely (z.avail_out != 0))
       free (zdata);
-    else
-      {
-result-&amp;gt;sectiondata[cnt].data = zdata;
-result-&amp;gt;sectiondata[cnt].gzipped = 1;
-      }
+    else if (!add_section (result, cnt, data, true))
+      return NULL;
   }
 
 break;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -345,6 +377,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_begin_elf (elf, cmd, scngrp)
   result-&amp;gt;mem_tail-&amp;gt;remaining = result-&amp;gt;mem_tail-&amp;gt;size;
   result-&amp;gt;mem_tail-&amp;gt;prev = NULL;
 
+  result-&amp;gt;next_tu_cu = IDX_debug_types;
   result-&amp;gt;n_sections = IDX_last;
   result-&amp;gt;sectiondata = calloc (result-&amp;gt;n_sections, sizeof (Dwarf_Section));
   if (unlikely (result-&amp;gt;sectiondata == NULL))
diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c
index 88dc065..f2cfa10 100644
--- a/libdw/dwarf_formref_die.c
+++ b/libdw/dwarf_formref_die.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Look up the DIE in a reference-form attribute.
-   Copyright (C) 2005-2010 Red Hat, Inc.
+   Copyright (C) 2005-2010, 2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -105,7 +105,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_formref_die (attr, result)
   }
 while (cu-&amp;gt;type_sig8 != sig);
 
-      data = cu-&amp;gt;dbg-&amp;gt;sectiondata[IDX_debug_types].data;
+      data = cu-&amp;gt;dbg-&amp;gt;sectiondata[cu-&amp;gt;sec_index].data;
       offset = cu-&amp;gt;type_offset;
     }
   else
diff --git a/libdw/dwarf_getlocation_implicit_pointer.c b/libdw/dwarf_getlocation_implicit_pointer.c
index 4d9f6b9..9385038 100644
--- a/libdw/dwarf_getlocation_implicit_pointer.c
+++ b/libdw/dwarf_getlocation_implicit_pointer.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Return associated attribute for DW_OP_GNU_implicit_pointer.
-   Copyright (C) 2010 Red Hat, Inc.
+   Copyright (C) 2010, 2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -72,7 +72,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getlocation_implicit_pointer (attr, op, result)
 
   Dwarf_Die die;
   if (__libdw_offdie (attr-&amp;gt;cu-&amp;gt;dbg, op-&amp;gt;number, &amp;amp;die,
-      attr-&amp;gt;cu-&amp;gt;type_offset != 0) == NULL)
+      attr-&amp;gt;cu-&amp;gt;sec_index) == NULL)
     return -1;
 
   if (INTUSE(dwarf_attr) (&amp;amp;die, DW_AT_location, result) == NULL
diff --git a/libdw/dwarf_nextcu.c b/libdw/dwarf_nextcu.c
index 66dd191..a765a29 100644
--- a/libdw/dwarf_nextcu.c
+++ b/libdw/dwarf_nextcu.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Advance to next CU header.
-   Copyright (C) 2002-2010 Red Hat, Inc.
+   Copyright (C) 2002-2010, 2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper &amp;lt;drepper&amp;lt; at &amp;gt;redhat.com&amp;gt;, 2002.
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -57,10 +57,14 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 
 
 int
-dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
- address_sizep, offset_sizep, type_signaturep, type_offsetp)
+dwarf_next_unit_or_section (dwarf, off, real_off, next_off, header_sizep,
+    versionp, abbrev_offsetp,
+    address_sizep, offset_sizep,
+    type_signaturep, type_offsetp,
+    type_sectionp)
      Dwarf *dwarf;
      Dwarf_Off off;
+     Dwarf_Off *real_off;
      Dwarf_Off *next_off;
      size_t *header_sizep;
      Dwarf_Half *versionp;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -69,16 +73,37 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
      uint8_t *offset_sizep;
      uint64_t *type_signaturep;
      Dwarf_Off *type_offsetp;
+     size_t *type_sectionp;
 {
   const bool debug_types = type_signaturep != NULL;
-  const size_t sec_idx = debug_types ? IDX_debug_types : IDX_debug_info;
+  size_t sec_idx = (type_sectionp != NULL ? *type_sectionp
+    : debug_types ? IDX_debug_types : IDX_debug_info);
 
   /* Maybe there has been an error before.  */
   if (dwarf == NULL)
     return -1;
 
+  /* Initialize the section if needed.  */
+  if (type_sectionp != NULL &amp;amp;&amp;amp; sec_idx == 0)
+    {
+      *type_sectionp = IDX_debug_types;
+      sec_idx = IDX_debug_types;
+    }
+
+  /* If we are looking at all type sections, and we went off the end,
+     move to the next one.  */
+  if (debug_types &amp;amp;&amp;amp; type_sectionp != NULL
+      &amp;amp;&amp;amp; dwarf-&amp;gt;sectiondata[sec_idx].data != NULL
+      &amp;amp;&amp;amp; unlikely (off + 4 &amp;gt;= dwarf-&amp;gt;sectiondata[sec_idx].data-&amp;gt;d_size))
+    {
+      off = 0;
+      ++*type_sectionp;
+      ++sec_idx;
+    }
+
   /* If we reached the end before don't do anything.  */
   if (off == (Dwarf_Off) -1l
+      || unlikely (sec_idx &amp;gt;= dwarf-&amp;gt;n_sections)
       || unlikely (dwarf-&amp;gt;sectiondata[sec_idx].data == NULL)
       /* Make sure there is enough space in the .debug_info section
  for at least the initial word.  We cannot test the rest since
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -89,6 +114,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
       return 1;
     }
 
+  if (real_off)
+    *real_off = off;
+
   /* This points into the .debug_info section to the beginning of the
      CU entry.  */
   const unsigned char *data = dwarf-&amp;gt;sectiondata[sec_idx].data-&amp;gt;d_buf;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -200,6 +228,29 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
 
   return 0;
 }
+INTDEF(dwarf_next_unit_or_section)
+
+int
+dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
+ address_sizep, offset_sizep, type_signaturep, type_offsetp)
+     Dwarf *dwarf;
+     Dwarf_Off off;
+     Dwarf_Off *next_off;
+     size_t *header_sizep;
+     Dwarf_Half *versionp;
+     Dwarf_Off *abbrev_offsetp;
+     uint8_t *address_sizep;
+     uint8_t *offset_sizep;
+     uint64_t *type_signaturep;
+     Dwarf_Off *type_offsetp;
+{
+  return INTUSE(dwarf_next_unit_or_section) (dwarf, off, NULL, next_off,
+     header_sizep, versionp,
+     abbrev_offsetp, address_sizep,
+     offset_sizep,
+     type_signaturep,
+     type_offsetp, NULL);
+}
 INTDEF(dwarf_next_unit)
 
 int
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -213,8 +264,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp,
      uint8_t *address_sizep;
      uint8_t *offset_sizep;
 {
-  return INTUSE(dwarf_next_unit) (dwarf, off, next_off, header_sizep, NULL,
-  abbrev_offsetp, address_sizep, offset_sizep,
-  NULL, NULL);
+  return INTUSE(dwarf_next_unit_or_section) (dwarf, off, NULL, next_off,
+     header_sizep, NULL,
+     abbrev_offsetp, address_sizep,
+     offset_sizep,
+     NULL, NULL, NULL);
 }
 INTDEF(dwarf_nextcu)
diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c
index 90ada60..f426723 100644
--- a/libdw/dwarf_offdie.c
+++ b/libdw/dwarf_offdie.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Return DIE at given offset.
-   Copyright (C) 2002-2010 Red Hat, Inc.
+   Copyright (C) 2002-2010, 2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper &amp;lt;drepper&amp;lt; at &amp;gt;redhat.com&amp;gt;, 2002.
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -59,13 +59,18 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 Dwarf_Die *
 internal_function
 __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result,
-bool debug_types)
+size_t sec_index)
 {
   if (dbg == NULL)
     return NULL;
 
-  Elf_Data *const data = dbg-&amp;gt;sectiondata[debug_types ? IDX_debug_types
-  : IDX_debug_info].data;
+  if (sec_index &amp;gt;= dbg-&amp;gt;n_sections)
+    {
+      __libdw_seterrno (DWARF_E_INVALID_DWARF);
+      return NULL;
+    }
+
+  Elf_Data *const data = dbg-&amp;gt;sectiondata[sec_index].data;
   if (offset &amp;gt;= data-&amp;gt;d_size)
     {
       __libdw_seterrno (DWARF_E_INVALID_DWARF);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -79,7 +84,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result,
   result-&amp;gt;addr = (char *) data-&amp;gt;d_buf + offset;
 
   /* Get the CU.  */
-  result-&amp;gt;cu = __libdw_findcu (dbg, offset, debug_types);
+  result-&amp;gt;cu = __libdw_findcu (dbg, offset, sec_index);
   if (result-&amp;gt;cu == NULL)
     {
       /* This should never happen.  The input file is malformed.  */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -97,7 +102,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_offdie (dbg, offset, result)
      Dwarf_Off offset;
      Dwarf_Die *result;
 {
-  return __libdw_offdie (dbg, offset, result, false);
+  return __libdw_offdie (dbg, offset, result, IDX_debug_info);
 }
 INTDEF(dwarf_offdie)
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -107,5 +112,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_offdie_types (dbg, offset, result)
      Dwarf_Off offset;
      Dwarf_Die *result;
 {
-  return __libdw_offdie (dbg, offset, result, true);
+  return __libdw_offdie (dbg, offset, result, IDX_debug_types);
 }
diff --git a/libdw/libdw.h b/libdw/libdw.h
index e001b7a..ef82636 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Interfaces for libdw.
-   Copyright (C) 2002-2010 Red Hat, Inc.
+   Copyright (C) 2002-2010, 2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -304,6 +304,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; extern int dwarf_next_unit (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
     uint64_t *type_signaturep, Dwarf_Off *type_offsetp)
      __nonnull_attribute__ (3);
 
+/* Read the header of a DWARF CU or type unit.  If TYPE_SIGNATUREP is
+   not null, this reads a type unit from the .debug_types section;
+   otherwise this reads a CU from the .debug_info section.  If
+   iterating over .debug_types sections, *TYPE_SECTIONP should be
+   initialized to zero before the first call.  *REAL_OFF is set to the
+   real offset of the returned unit; when iterating, the previous
+   offset used in the loop may not point anywhere useful.  */
+extern int dwarf_next_unit_or_section (Dwarf *dwarf, Dwarf_Off off,
+       Dwarf_Off *real_off, Dwarf_Off *next_off,
+       size_t *header_sizep,
+       Dwarf_Half *versionp,
+       Dwarf_Off *abbrev_offsetp,
+       uint8_t *address_sizep,
+       uint8_t *offset_sizep,
+       uint64_t *type_signaturep,
+       Dwarf_Off *type_offsetp,
+       size_t *type_sectionp)
+     __nonnull_attribute__ (4);
+
 
 /* Decode one DWARF CFI entry (CIE or FDE) from the raw section data.
    The E_IDENT from the originating ELF file indicates the address
diff --git a/libdw/libdw.map b/libdw/libdw.map
index 1f71d03..4217f29 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -254,3 +254,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; ELFUTILS_0.149 {
 
     dwfl_dwarf_line;
 } ELFUTILS_0.148;
+
+ELFUTILS_0.153 {
+  global:
+    dwarf_next_unit_or_section;
+} ELFUTILS_0.149;
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index fee0bac..de60399 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -191,6 +191,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct Dwarf
   /* Search tree and sig8 hash table for .debug_types type units.  */
   void *tu_tree;
   Dwarf_Off next_tu_offset;
+  size_t next_tu_cu;
   Dwarf_Sig8_Hash sig8_hash;
 
   /* Address ranges.  */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -303,6 +304,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct Dwarf_CU
   uint8_t offset_size;
   uint16_t version;
 
+  size_t sec_index;
+
   /* Zero if this is a normal CU.  Nonzero if it is a type unit.  */
   size_t type_offset;
   uint64_t type_sig8;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -413,7 +416,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; extern struct Dwarf_CU *__libdw_intern_next_unit (Dwarf *dbg, bool debug_types)
      __nonnull_attribute__ (1) internal_function;
 
 /* Find CU for given offset.  */
-extern struct Dwarf_CU *__libdw_findcu (Dwarf *dbg, Dwarf_Off offset, bool tu)
+extern struct Dwarf_CU *__libdw_findcu (Dwarf *dbg, Dwarf_Off offset,
+size_t sec_idx)
      __nonnull_attribute__ (1) internal_function;
 
 /* Return tag of given DIE.  */
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -480,7 +484,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; extern int __libdw_intern_expression (Dwarf *dbg,
   __nonnull_attribute__ (5, 6, 9, 10) internal_function;
 
 extern Dwarf_Die *__libdw_offdie (Dwarf *dbg, Dwarf_Off offset,
-  Dwarf_Die *result, bool debug_types)
+  Dwarf_Die *result, size_t sec_index)
   internal_function;
 
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -680,6 +684,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; INTDECL (dwarf_highpc)
 INTDECL (dwarf_lowpc)
 INTDECL (dwarf_nextcu)
 INTDECL (dwarf_next_unit)
+INTDECL (dwarf_next_unit_or_section)
 INTDECL (dwarf_offdie)
 INTDECL (dwarf_ranges)
 INTDECL (dwarf_siblingof)
diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c
index 8e5f9e9..2b8a005 100644
--- a/libdw/libdw_findcu.c
+++ b/libdw/libdw_findcu.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Find CU for given offset.
-   Copyright (C) 2003-2010 Red Hat, Inc.
+   Copyright (C) 2003-2010, 2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper &amp;lt;drepper&amp;lt; at &amp;gt;redhat.com&amp;gt;, 2003.
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -67,6 +67,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_intern_next_unit (dbg, debug_types)
     = debug_types ? &amp;amp;dbg-&amp;gt;next_tu_offset : &amp;amp;dbg-&amp;gt;next_cu_offset;
 
   Dwarf_Off oldoff = *offsetp;
+  Dwarf_Off real_off;
   uint16_t version;
   uint8_t address_size;
   uint8_t offset_size;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -74,11 +75,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_intern_next_unit (dbg, debug_types)
   uint64_t type_sig8 = 0;
   Dwarf_Off type_offset = 0;
 
-  if (INTUSE(dwarf_next_unit) (dbg, oldoff, offsetp, NULL,
-       &amp;amp;version, &amp;amp;abbrev_offset,
-       &amp;amp;address_size, &amp;amp;offset_size,
-       debug_types ? &amp;amp;type_sig8 : NULL,
-       debug_types ? &amp;amp;type_offset : NULL) != 0)
+  if (INTUSE(dwarf_next_unit_or_section) (dbg, oldoff, &amp;amp;real_off, offsetp, NULL,
+  &amp;amp;version, &amp;amp;abbrev_offset,
+  &amp;amp;address_size, &amp;amp;offset_size,
+  debug_types ? &amp;amp;type_sig8 : NULL,
+  debug_types ? &amp;amp;type_offset : NULL,
+  debug_types ? &amp;amp;dbg-&amp;gt;next_tu_cu : NULL)
+      != 0)
     /* No more entries.  */
     return NULL;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -93,11 +96,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_intern_next_unit (dbg, debug_types)
   struct Dwarf_CU *newp = libdw_typed_alloc (dbg, struct Dwarf_CU);
 
   newp-&amp;gt;dbg = dbg;
-  newp-&amp;gt;start = oldoff;
+  newp-&amp;gt;start = real_off;
   newp-&amp;gt;end = *offsetp;
   newp-&amp;gt;address_size = address_size;
   newp-&amp;gt;offset_size = offset_size;
   newp-&amp;gt;version = version;
+  newp-&amp;gt;sec_index = debug_types ? dbg-&amp;gt;next_tu_cu : IDX_debug_info;
   newp-&amp;gt;type_sig8 = type_sig8;
   newp-&amp;gt;type_offset = type_offset;
   Dwarf_Abbrev_Hash_init (&amp;amp;newp-&amp;gt;abbrev_hash, 41);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -115,6 +119,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; findcu_cb (const void *arg1, const void *arg2)
   struct Dwarf_CU *cu1 = (struct Dwarf_CU *) arg1;
   struct Dwarf_CU *cu2 = (struct Dwarf_CU *) arg2;
 
+  if (cu1-&amp;gt;sec_index &amp;lt; cu2-&amp;gt;sec_index)
+    return -1;
+  if (cu1-&amp;gt;sec_index &amp;gt; cu2-&amp;gt;sec_index)
+    return 1;
+
   /* Find out which of the two arguments is the search value.  It has
      end offset 0.  */
   if (cu1-&amp;gt;end == 0)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -136,22 +145,23 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; findcu_cb (const void *arg1, const void *arg2)
 }
 
 struct Dwarf_CU *
-__libdw_findcu (dbg, start, debug_types)
+__libdw_findcu (dbg, start, sec_index)
      Dwarf *dbg;
      Dwarf_Off start;
-     bool debug_types;
+     size_t sec_index;
 {
+  const bool debug_types = sec_index != IDX_debug_info;
   void **tree = debug_types ? &amp;amp;dbg-&amp;gt;tu_tree : &amp;amp;dbg-&amp;gt;cu_tree;
   Dwarf_Off *next_offset
     = debug_types ? &amp;amp;dbg-&amp;gt;next_tu_offset : &amp;amp;dbg-&amp;gt;next_cu_offset;
 
   /* Maybe we already know that CU.  */
-  struct Dwarf_CU fake = { .start = start, .end = 0 };
+  struct Dwarf_CU fake = { .start = start, .end = 0, .sec_index = sec_index };
   struct Dwarf_CU **found = tfind (&amp;amp;fake, tree, findcu_cb);
   if (found != NULL)
     return *found;
 
-  if (start &amp;lt; *next_offset)
+  if (!debug_types &amp;amp;&amp;amp; start &amp;lt; *next_offset)
     {
       __libdw_seterrno (DWARF_E_INVALID_DWARF);
       return NULL;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -175,7 +185,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_findcu (dbg, start, debug_types)
 }
 
       /* Is this the one we are looking for?  */
-      if (start &amp;lt; *next_offset)
+      if (!debug_types &amp;amp;&amp;amp; start &amp;lt; *next_offset)
 // XXX Match exact offset.
 return newp;
     }
diff --git a/tests/ChangeLog b/tests/ChangeLog
index a782591..17523b3 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* debugtypes.c: New file.
+* run-debugtypes.sh: New file.
+* testfile59.bz2: New file.
+* Makefile.am (noinst_PROGRAMS): Add debugtypes.
+(TESTS): Add run-debugtypes.sh.
+(EXTRA_DIST): Add run-debugtypes.sh, testfile59.bz2.
+(debugtypes_LDADD): New variable.
+
 2012-02-21  Kurt Roeckx  &amp;lt;kurt&amp;lt; at &amp;gt;roeckx.be&amp;gt;
 
 * run-alldts.sh: testrun ./alldts.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3074c89..1b5ebf3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,6 +1,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 ## Process this file with automake to create Makefile.in
 ##
-## Copyright (C) 1996-2011 Red Hat, Inc.
+## Copyright (C) 1996-2012 Red Hat, Inc.
 ## This file is part of Red Hat elfutils.
 ##
 ## Red Hat elfutils is free software; you can redistribute it and/or modify
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -58,7 +58,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
   dwfl-addr-sect dwfl-bug-report early-offscn \
   dwfl-bug-getmodules dwarf-getmacros addrcfi \
   test-flag-nobits dwarf-getstring rerequest_tag \
-  alldts md5-sha1-test
+  alldts md5-sha1-test debugtypes
 asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
     asm-tst6 asm-tst7 asm-tst8 asm-tst9
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -86,7 +86,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 run-disasm-x86.sh run-disasm-x86-64.sh \
 run-early-offscn.sh run-dwarf-getmacros.sh \
 run-test-flag-nobits.sh run-prelink-addr-test.sh \
-run-dwarf-getstring.sh run-rerequest_tag.sh
+run-dwarf-getstring.sh run-rerequest_tag.sh run-debugtypes.sh
 # run-show-ciefde.sh
 
 if !STANDALONE
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -161,7 +161,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
      testfile55-32.bz2 testfile55-32.debug.bz2 \
      testfile55-32.prelink.bz2 testfile55-64.bz2 \
      testfile55-64.debug.bz2 testfile55-64.prelink.bz2 \
-     testfile56.bz2 testfile57.bz2 testfile58.bz2
+     testfile56.bz2 testfile57.bz2 testfile58.bz2 \
+     run-debugtypes.sh testfile59.bz2
 
 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
       bindir=$(DESTDIR)$(bindir) \
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -258,6 +259,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; test_flag_nobits_LDADD = $(libelf) $(libmudflap)
 rerequest_tag_LDADD = $(libdw) $(libmudflap)
 alldts_LDADD = $(libebl) $(libelf) $(libmudflap)
 md5_sha1_test_LDADD = $(libeu)
+debugtypes_LDADD = $(libdw) $(libelf) $(libmudflap)
 
 if GCOV
 check: check-am coverage
diff --git a/tests/debugtypes.c b/tests/debugtypes.c
new file mode 100644
index 0000000..3022a9a
--- /dev/null
+++ b/tests/debugtypes.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,72 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+/* Copyright (C) 2012 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   &amp;lt;http://www.openinventionnetwork.com&amp;gt;.  */
+
+#ifdef HAVE_CONFIG_H
+# include &amp;lt;config.h&amp;gt;
+#endif
+
+#include &amp;lt;fcntl.h&amp;gt;
+#include ELFUTILS_HEADER(dw)
+#include &amp;lt;stdio.h&amp;gt;
+#include &amp;lt;unistd.h&amp;gt;
+
+int
+main (int argc, char *argv[])
+{
+  for (int i = 1; i &amp;lt; argc; ++i)
+    {
+      int fd = open (argv[i], O_RDONLY);
+
+      Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ);
+      if (dbg != NULL)
+{
+  Dwarf_Off off = 0;
+  Dwarf_Off real_off;
+  size_t cuhl;
+  Dwarf_Off noff;
+  size_t section = 0;
+  uint64_t signature;
+  Dwarf_Off type_off;
+
+  while (dwarf_next_unit_or_section (dbg, off, &amp;amp;real_off, &amp;amp;noff, &amp;amp;cuhl,
+     NULL, NULL, NULL, NULL,
+     &amp;amp;signature, &amp;amp;type_off, &amp;amp;section)
+ == 0)
+    {
+      Dwarf_Die die_mem;
+      Dwarf_Die *die = dwarf_offdie (dbg, real_off + cuhl, &amp;amp;die_mem);
+
+      printf ("section %d, off %ld, type off %ld, ok = %d\n",
+      (int) section, (long) real_off, (long) type_off,
+      die != NULL);
+
+      off = noff;
+    }
+
+  dwarf_end (dbg);
+}
+
+      close (fd);
+    }
+}
diff --git a/tests/run-debugtypes.sh b/tests/run-debugtypes.sh
new file mode 100755
index 0000000..7c98515
--- /dev/null
+++ b/tests/run-debugtypes.sh
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,35 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+#! /bin/sh
+# Copyright (C) 2012 Red Hat, Inc.
+# This file is part of Red Hat elfutils.
+#
+# Red Hat elfutils is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# Red Hat elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Red Hat elfutils; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+#
+# Red Hat elfutils is an included package of the Open Invention Network.
+# An included package of the Open Invention Network is a package for which
+# Open Invention Network licensees cross-license their patents.  No patent
+# license is granted, either expressly or impliedly, by designation as an
+# included package.  Should you wish to participate in the Open Invention
+# Network licensing program, please visit www.openinventionnetwork.com
+# &amp;lt;http://www.openinventionnetwork.com&amp;gt;.
+
+. $srcdir/test-subr.sh
+
+testfiles testfile59
+
+testrun_compare ./debugtypes testfile59 &amp;lt;&amp;lt;\EOF
+section 10, off 0, type off 29, ok = 1
+section 11, off 0, type off 29, ok = 1
+EOF
+
+exit 0
diff --git a/tests/testfile59.bz2 b/tests/testfile59.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..aa1616d24d1e10bb3f82f97d2d8f9fc47247bf9a
GIT binary patch
literal 1424
zcmV;B1#kL7T4*^jL0KkKSz-fU7XSsPfB*mg|L=b1|Nr~#+GfB1|MI&amp;lt;W)$eb~6I=)Z
zKmZCMa0$=^lxgh^n60kq-G&amp;amp;Vinom)xHc7B)BRwQE$&amp;gt;}_!Ks3;3dWVz%$a*26lTTAj
zfMfvlo}sixCdxD#0BI8&amp;lt; at &amp;gt;L84^SO&amp;amp;Ug%$`4RzXlMr1dWL`iWB&amp;gt;pF0000001SXKCX-2u
zpQ=4Zng^+)L6bqD&amp;gt;H{DHKzcxWfChoJ00w{qKmY(54^u=K6GoaEX{IJ7hMH(#BLIvb
zGGHc}Fc1a+6C(hcWCI`uA*Mi)MNbtp&amp;lt; at &amp;gt;}85$GgBs-00Tg113{nw4FCXWG&amp;amp;BG`KmalT
z&amp;amp;;SK3pfI;ilcebwjN3jAxfPZylWgGQ4aLe85zeYdSTk=a4JBz4EZKc)f#1q{-T=lH
z6ZR4S+E)wPN!a&amp;lt;j9Gwn~u6#`Sy{dLte$CbdxcM2wX2Vc2F9XtLn^|aWKHOwdwQl4o
zX2#o=8(NhE6KmevKYoV&amp;lt; at &amp;gt;12VALU0fJpZ!XOM_wS=9X7Ve0s^{3!!or6Wr&amp;gt;Jx&amp;amp;8NP=Y
zIMGJMEH4yi1R8&amp;lt; at &amp;gt;mLZTo{8j8(IDY4f&amp;amp;&amp;gt;X&amp;gt;XMK1(rSII&amp;lt;o?zZEg)&amp;amp;h;-xk9`uIMf8E+
znE`_c3lxL_+_^|133b_uA|e8X1P}v5GPMgz?&amp;lt;vx&amp;amp;3JeNo&amp;lt; at &amp;gt;_Xl2$)PCg84yDTB0xzP
z11oKdvy%yy=GNeKmGdd=k)R-Ah9sgi#*l0;w}tmv;GV)wcBN&amp;gt;0?;5Sr{3BSx3lyS2
z2uX4fOo&amp;amp;MVV!%P6X(%+Y?J1fCBMYX0N&amp;lt; at &amp;gt;j!7(2R3NorghzX=MWQBYkaqA$rS!TvdtX
zX%rYGu3-isq1=EZh_I^AL6&amp;amp;SssW6KW4T5YCRV`qEh{V_lum;m%(r|W7bs1c7OtU0F
zqreEAAg?Ee8%PnJ^dzuxV5By;HF8=f&amp;amp;)ZBUkU+k&amp;gt;ose*p{OxY7#US-3D6jxIfK^bn
z5U4}M-YJU7RVyK;h2;t0A(aLcB-|xEwpYU1P}8Pa9FhI-eOsr3B8^H&amp;lt;(d&amp;amp;i&amp;lt; at &amp;gt;G_6&amp;gt;^
zEJxojIEbm3HVOg?`VashR&amp;gt;1*i&amp;amp;=T0oqp+h1rI`T*7$!%*5}7*;MJXDjwrT&amp;lt;=)~U)c
zWcGlbqzlR9YXoQHnjv&amp;amp;FD77&amp;lt; at &amp;gt;fNp$K1kW39HvmjX&amp;lt; at &amp;gt;ihv^)n%&amp;lt; at &amp;gt;0|{1n6jAS7u6rvh|p
zUDhOB&amp;gt;I#u5u!BV_(1Zr%P(&amp;gt;CM=VynN_EB-5(Md8#?i!c=l;uSREJrXw1^~;`z13+v
zvWq0xEGBtG3yq-QOVFW0pDGR!GY5SF0UIq&amp;lt;aDowR3?LZ;4Isj&amp;lt;68w1D(F$9N7S`Hf
znIZDVxv{0r7o5qU_47p2VFwWm_MsQ~ifMc&amp;amp;Hd1Q&amp;lt; at &amp;gt;2y9(OF!$~d*)BZNK$r&amp;lt;N&amp;gt;{&amp;lt; at &amp;gt;GL
zn=2p+z&amp;lt; at &amp;gt;bIOR}&amp;lt; at &amp;gt;N;Qofw~q&amp;lt; at &amp;gt;k&amp;lt; at &amp;gt;Z?qrqRg+fyPP8+u$rm!w!p?bm?0_w7iKd~r$(_c``
z;~aUFFK-2$6ab}qA4TDXL)yQzlSX8N;yiV_8TL*my^f9qkbv;LpaWDM`LK?je1X|n
zku&amp;gt;A-Ri&amp;amp;$_kiR&amp;lt; at &amp;gt;EPzrW;q$$8p(7h06bn9J&amp;gt;9mMx1cQG5B&amp;lt;w&amp;gt;^$4mpfk_^eY)GYzI$
zf&amp;gt;&amp;lt; at &amp;gt;qwj(XnAM_q6#7$I+zAh!%;Abrj|Mgb4PcQhIoV|7*AYGNb)no&amp;lt;hu2lypDAoMed
zpwkubkx!glu&amp;gt;6H~s7P0SX3}c&amp;amp;MOzyVDr^KAqz7qrS|k`g%5k9i3f5&amp;lt;0t1WISIEYPw
z6pA&amp;gt;EgvX;|l7-x&amp;lt;5f}{cnyc-;iP2QmO4*8mPm%{cGea8Z&amp;gt;x&amp;lt; at &amp;gt;*AnFOU9u&amp;gt;umFjV!%r
z42`4bphL~XR5tdHM^fUbey)1d-y%q2+6fj`FLt%=z-Xgb8C?cTR*k{T&amp;lt;W2HIydAF*
e`50Fcb?c8Pe5Q5(V2kQM&amp;lt; at &amp;gt;pmLsg$V{AHSuuonq&amp;lt; at &amp;gt;2i

literal 0
HcmV?d00001

&lt;/pre&gt;</description>
    <dc:creator>Tom Tromey</dc:creator>
    <dc:date>2012-03-20T19:45:06</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2112">
    <title>[PATCH 4/5] remove section-group code from check_section</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2112</link>
    <description>&lt;pre&gt; libdw/ChangeLog         |    5 +++++
 libdw/dwarf_begin_elf.c |   16 +++-------------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index c3dbda9..60f9ae0 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
+* dwarf_begin_elf.c (check_section): Remove 'inscngrp' argument.
+(global_read, scngrp_read): Update.
+
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
 * libdwP.h (struct Dwarf) [n_sections]: New field.
 [sectiondata]: Change type.
 * dwarf_end.c (__libdw_free_zdata): Use n_sections.
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index def8ed6..4a726ce 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -88,7 +88,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static const char dwarf_scnnames[IDX_last][17] =
 
 
 static Dwarf *
-check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
+check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn)
 {
   GElf_Shdr shdr_mem;
   GElf_Shdr *shdr;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -106,16 +106,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
   if (unlikely (shdr-&amp;gt;sh_type == SHT_NOBITS))
     return result;
 
-  /* Make sure the section is part of a section group only iff we
-     really need it.  If we are looking for the global (= non-section
-     group debug info) we have to ignore all the info in section
-     groups.  If we are looking into a section group we cannot look at
-     a section which isn't part of the section group.  */
-  if (! inscngrp &amp;amp;&amp;amp; (shdr-&amp;gt;sh_flags &amp;amp; SHF_GROUP) != 0)
-    /* Ignore the section.  */
-    return result;
-
-
   /* We recognize the DWARF section by their names.  This is not very
      safe and stable but the best we can do.  */
   const char *scnname = elf_strptr (result-&amp;gt;elf, ehdr-&amp;gt;e_shstrndx,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -255,7 +245,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; global_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr)
   Elf_Scn *scn = NULL;
 
   while (result != NULL &amp;amp;&amp;amp; (scn = elf_nextscn (elf, scn)) != NULL)
-    result = check_section (result, ehdr, scn, false);
+    result = check_section (result, ehdr, scn);
 
   return valid_p (result);
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -294,7 +284,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp)
   return NULL;
 }
 
-      result = check_section (result, ehdr, scn, true);
+      result = check_section (result, ehdr, scn);
       if (result == NULL)
 break;
     }
&lt;/pre&gt;</description>
    <dc:creator>Tom Tromey</dc:creator>
    <dc:date>2012-03-20T19:28:40</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2111">
    <title>[PATCH 3/5] Change sectiondata to be dynamically allocated. Thisallows us to later add multiple .debug_types sectionsto the section data vector.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2111</link>
    <description>&lt;pre&gt; libdw/ChangeLog         |   10 ++++++++++
 libdw/dwarf_begin_elf.c |   13 +++++++++++++
 libdw/dwarf_end.c       |    4 +++-
 libdw/libdwP.h          |    5 ++++-
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 6fb5d8d..c3dbda9 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
+* libdwP.h (struct Dwarf) [n_sections]: New field.
+[sectiondata]: Change type.
+* dwarf_end.c (__libdw_free_zdata): Use n_sections.
+(dwarf_end): Free the section data.
+* dwarf_begin_elf.c (check_section, valid_p, scngrp_read): Free
+the section data.
+(dwarf_begin_elf): Allocate the section data.
+
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
 * libdwP.h (IDX_debug_types): Move just before IDX_last.
 * dwarf_begin_elf.c (dwarf_scnnames): Move .debug_types to the
 end.
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index e62ef07..def8ed6 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -126,6 +126,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
  invalid.  */
       __libdw_free_zdata (result);
       __libdw_seterrno (DWARF_E_INVALID_ELF);
+      free (result-&amp;gt;sectiondata);
       free (result);
       return NULL;
     }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -239,6 +240,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; valid_p (Dwarf *result)
     {
       __libdw_free_zdata (result);
       __libdw_seterrno (DWARF_E_NO_DWARF);
+      free (result-&amp;gt;sectiondata);
       free (result);
       result = NULL;
     }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -269,6 +271,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp)
     {
       /* We cannot read the section content.  Fail!  */
       __libdw_free_zdata (result);
+      free (result-&amp;gt;sectiondata);
       free (result);
       return NULL;
     }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -286,6 +289,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Elf_Scn *scngrp)
      never happen.  */
   __libdw_free_zdata (result);
   __libdw_seterrno (DWARF_E_INVALID_ELF);
+  free (result-&amp;gt;sectiondata);
   free (result);
   return NULL;
 }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -351,6 +355,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_begin_elf (elf, cmd, scngrp)
   result-&amp;gt;mem_tail-&amp;gt;remaining = result-&amp;gt;mem_tail-&amp;gt;size;
   result-&amp;gt;mem_tail-&amp;gt;prev = NULL;
 
+  result-&amp;gt;n_sections = IDX_last;
+  result-&amp;gt;sectiondata = calloc (result-&amp;gt;n_sections, sizeof (Dwarf_Section));
+  if (unlikely (result-&amp;gt;sectiondata == NULL))
+    {
+      free (result);
+      __libdw_seterrno (DWARF_E_NOMEM);
+      return NULL;
+    }
+
   if (cmd == DWARF_C_READ || cmd == DWARF_C_RDWR)
     {
       /* If the caller provides a section group we get the DWARF
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 2636c69..a2ee8d6 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -85,7 +85,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_free_zdata (Dwarf *dwarf)
 {
   size_t i;
 
-  for (i = 0; i &amp;lt; IDX_last; ++i)
+  for (i = 0; i &amp;lt; dwarf-&amp;gt;n_sections; ++i)
     {
       if (dwarf-&amp;gt;sectiondata[i].gzipped)
 free (dwarf-&amp;gt;sectiondata[i].data);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -125,6 +125,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_end (dwarf)
 
       __libdw_free_zdata (dwarf);
 
+      free (dwarf-&amp;gt;sectiondata);
+
       /* Free the ELF descriptor if necessary.  */
       if (dwarf-&amp;gt;free_elf)
 elf_end (dwarf-&amp;gt;elf);
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index b24ac0b..fee0bac 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -161,8 +161,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct Dwarf
   /* The underlying ELF file.  */
   Elf *elf;
 
+  /* The number of sections in SECTIONDATA.  */
+  size_t n_sections;
+ 
   /* The section data.  */
-  struct Dwarf_Section sectiondata[IDX_last];
+  struct Dwarf_Section *sectiondata;
 
   /* True if the file has a byte order different from the host.  */
   bool other_byte_order;
&lt;/pre&gt;</description>
    <dc:creator>Tom Tromey</dc:creator>
    <dc:date>2012-03-20T19:20:36</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2110">
    <title>[PATCH 2/5] Make IDX_debug_types come last. In a subsequent patch wewill put all .debug_types sections at the end the ofthe section array. This change arranges for them toappear sequentially.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2110</link>
    <description>&lt;pre&gt; libdw/ChangeLog         |    6 ++++++
 libdw/dwarf_begin_elf.c |    6 +++---
 libdw/libdwP.h          |    2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 8a556ec..6fb5d8d 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
+* libdwP.h (IDX_debug_types): Move just before IDX_last.
+* dwarf_begin_elf.c (dwarf_scnnames): Move .debug_types to the
+end.
+
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
 * libdwP.h (struct Dwarf_Section): New.
 (Dwarf_Section): New typedef.
 (struct Dwarf) [sectiondata]: Change type.
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index f7ae8ab..e62ef07 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Create descriptor from ELF descriptor for processing file.
-   Copyright (C) 2002-2011 Red Hat, Inc.
+   Copyright (C) 2002-2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper &amp;lt;drepper&amp;lt; at &amp;gt;redhat.com&amp;gt;, 2002.
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -73,7 +73,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 static const char dwarf_scnnames[IDX_last][17] =
 {
   [IDX_debug_info] = ".debug_info",
-  [IDX_debug_types] = ".debug_types",
   [IDX_debug_abbrev] = ".debug_abbrev",
   [IDX_debug_aranges] = ".debug_aranges",
   [IDX_debug_line] = ".debug_line",
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -82,7 +81,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static const char dwarf_scnnames[IDX_last][17] =
   [IDX_debug_pubnames] = ".debug_pubnames",
   [IDX_debug_str] = ".debug_str",
   [IDX_debug_macinfo] = ".debug_macinfo",
-  [IDX_debug_ranges] = ".debug_ranges"
+  [IDX_debug_ranges] = ".debug_ranges",
+  [IDX_debug_types] = ".debug_types"
 };
 #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
 
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 1505512..b24ac0b 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -83,7 +83,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct loc_block_s
 enum
   {
     IDX_debug_info = 0,
-    IDX_debug_types,
     IDX_debug_abbrev,
     IDX_debug_aranges,
     IDX_debug_line,
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -93,6 +92,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; enum
     IDX_debug_str,
     IDX_debug_macinfo,
     IDX_debug_ranges,
+    IDX_debug_types,/* Must be just before IDX_last */
     IDX_last
   };
 
&lt;/pre&gt;</description>
    <dc:creator>Tom Tromey</dc:creator>
    <dc:date>2012-03-20T19:10:30</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2109">
    <title>[PATCH 1/5] Change representation of section data. This is justpreparation for a subsequent patch that makes thenumber of sections dynamic.</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2109</link>
    <description>&lt;pre&gt; libdw/ChangeLog           |   24 ++++++++++++++++++++++++
 libdw/dwarf_begin_elf.c   |   12 ++++++------
 libdw/dwarf_child.c       |    6 +++---
 libdw/dwarf_end.c         |   15 ++++++---------
 libdw/dwarf_formref_die.c |    2 +-
 libdw/dwarf_formstring.c  |    4 ++--
 libdw/dwarf_formudata.c   |    2 +-
 libdw/dwarf_getabbrev.c   |    6 +++---
 libdw/dwarf_getaranges.c  |   12 ++++++------
 libdw/dwarf_getattrs.c    |    4 ++--
 libdw/dwarf_getcfi.c      |    4 ++--
 libdw/dwarf_getmacros.c   |    2 +-
 libdw/dwarf_getpubnames.c |   20 ++++++++++++--------
 libdw/dwarf_getstring.c   |   12 +++++++-----
 libdw/dwarf_nextcu.c      |    8 ++++----
 libdw/dwarf_offdie.c      |    2 +-
 libdw/dwarf_ranges.c      |    2 +-
 libdw/libdwP.h            |   27 ++++++++++++++++++---------
 libdwfl/ChangeLog         |    4 ++++
 libdwfl/cu.c              |    3 ++-
 src/ChangeLog             |    6 ++++++
 src/readelf.c             |    4 ++--
 22 files changed, 114 insertions(+), 67 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 98b67f4..8a556ec 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,27 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* libdwP.h (struct Dwarf_Section): New.
+(Dwarf_Section): New typedef.
+(struct Dwarf) [sectiondata]: Change type.
+[sectiondata_gzip_mask]: Remove.
+(__libdw_checked_get_data, cu_data): Update.
+* dwarf_ranges.c (dwarf_ranges): Update.
+* dwarf_offdie.c (__libdw_offdie): Update.
+* dwarf_nextcu.c (dwarf_next_unit): Update.
+* dwarf_getstring.c (dwarf_getstring): Update.
+* dwarf_getpubnames.c (get_offsets, dwarf_getpubnames): Update.
+* dwarf_getmacros.c (dwarf_getmacros): Update.
+* dwarf_getcfi.c (dwarf_getcfi): Update
+* dwarf_getattrs.c (dwarf_getattrs): Update.
+* dwarf_getaranges.c (dwarf_getaranges): Update.
+* dwarf_getabbrev.c (__libdw_getabbrev): Update.
+* dwarf_formudata.c (__libdw_formptr): Update.
+* dwarf_formstring.c (dwarf_formstring): Update.
+* dwarf_formref_die.c (dwarf_formref_die): Update.
+* dwarf_end.c (__libdw_free_zdata): Rewrite.
+* dwarf_child.c (__libdw_find_attr): Update.
+* dwarf_begin_elf.c (check_section, valid_p): Update.
+
 2012-01-31  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
 * dwarf_formudata.c (dwarf_formudata): Handle DW_FORM_sec_offset.
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 9ec7d51..f7ae8ab 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -137,7 +137,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
     if (strcmp (scnname, dwarf_scnnames[cnt]) == 0)
       {
 /* Found it.  Remember where the data is.  */
-if (unlikely (result-&amp;gt;sectiondata[cnt] != NULL))
+if (unlikely (result-&amp;gt;sectiondata[cnt].data != NULL))
   /* A section appears twice.  That's bad.  We ignore the section.  */
   break;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -145,7 +145,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
 Elf_Data *data = elf_getdata (scn, NULL);
 if (data != NULL &amp;amp;&amp;amp; data-&amp;gt;d_size != 0)
   /* Yep, there is actually data available.  */
-  result-&amp;gt;sectiondata[cnt] = data;
+  result-&amp;gt;sectiondata[cnt].data = data;
 
 break;
       }
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -155,7 +155,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
       {
 /* A compressed section.  */
 
-if (unlikely (result-&amp;gt;sectiondata[cnt] != NULL))
+if (unlikely (result-&amp;gt;sectiondata[cnt].data != NULL))
   /* A section appears twice.  That's bad.  We ignore the section.  */
   break;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -211,8 +211,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
       free (zdata);
     else
       {
-result-&amp;gt;sectiondata[cnt] = zdata;
-result-&amp;gt;sectiondata_gzip_mask |= 1U &amp;lt;&amp;lt; cnt;
+result-&amp;gt;sectiondata[cnt].data = zdata;
+result-&amp;gt;sectiondata[cnt].gzipped = 1;
       }
   }
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -235,7 +235,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; valid_p (Dwarf *result)
      necessary.  For now we require only .debug_info.  Hopefully this
      is correct.  */
   if (likely (result != NULL)
-      &amp;amp;&amp;amp; unlikely (result-&amp;gt;sectiondata[IDX_debug_info] == NULL))
+      &amp;amp;&amp;amp; unlikely (result-&amp;gt;sectiondata[IDX_debug_info].data == NULL))
     {
       __libdw_free_zdata (result);
       __libdw_seterrno (DWARF_E_NO_DWARF);
diff --git a/libdw/dwarf_child.c b/libdw/dwarf_child.c
index 0c2df00..2a4cf12 100644
--- a/libdw/dwarf_child.c
+++ b/libdw/dwarf_child.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Return child of current DIE.
-   Copyright (C) 2003-2011 Red Hat, Inc.
+   Copyright (C) 2003-2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper &amp;lt;drepper&amp;lt; at &amp;gt;redhat.com&amp;gt;, 2003.
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -88,8 +88,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_find_attr (Dwarf_Die *die, unsigned int search_name,
 
   /* Search the name attribute.  */
   unsigned char *const endp
-    = ((unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_abbrev]-&amp;gt;d_buf
-       + dbg-&amp;gt;sectiondata[IDX_debug_abbrev]-&amp;gt;d_size);
+    = ((unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data-&amp;gt;d_buf
+       + dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data-&amp;gt;d_size);
 
   const unsigned char *attrp = die-&amp;gt;abbrev-&amp;gt;attrp;
   while (1)
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index 1e733ca..2636c69 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Release debugging handling context.
-   Copyright (C) 2002-2011 Red Hat, Inc.
+   Copyright (C) 2002-2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper &amp;lt;drepper&amp;lt; at &amp;gt;redhat.com&amp;gt;, 2002.
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -83,15 +83,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void
 internal_function
 __libdw_free_zdata (Dwarf *dwarf)
 {
-  unsigned int gzip_mask = dwarf-&amp;gt;sectiondata_gzip_mask;
-  while (gzip_mask != 0)
+  size_t i;
+
+  for (i = 0; i &amp;lt; IDX_last; ++i)
     {
-      int i = ffs (gzip_mask);
-      assert (i &amp;gt; 0);
-      --i;
-      assert (i &amp;lt; IDX_last);
-      free (dwarf-&amp;gt;sectiondata[i]);
-      gzip_mask &amp;amp;= ~(1U &amp;lt;&amp;lt; i);
+      if (dwarf-&amp;gt;sectiondata[i].gzipped)
+free (dwarf-&amp;gt;sectiondata[i].data);
     }
 }
 #endif
diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c
index 3ec770d..88dc065 100644
--- a/libdw/dwarf_formref_die.c
+++ b/libdw/dwarf_formref_die.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -105,7 +105,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_formref_die (attr, result)
   }
 while (cu-&amp;gt;type_sig8 != sig);
 
-      data = cu-&amp;gt;dbg-&amp;gt;sectiondata[IDX_debug_types];
+      data = cu-&amp;gt;dbg-&amp;gt;sectiondata[IDX_debug_types].data;
       offset = cu-&amp;gt;type_offset;
     }
   else
diff --git a/libdw/dwarf_formstring.c b/libdw/dwarf_formstring.c
index 1dee9b2..85dbae4 100644
--- a/libdw/dwarf_formstring.c
+++ b/libdw/dwarf_formstring.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -72,7 +72,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_formstring (attrp)
   Dwarf *dbg = attrp-&amp;gt;cu-&amp;gt;dbg;
 
   if (unlikely (attrp-&amp;gt;form != DW_FORM_strp)
-      || dbg-&amp;gt;sectiondata[IDX_debug_str] == NULL)
+      || dbg-&amp;gt;sectiondata[IDX_debug_str].data == NULL)
     {
       __libdw_seterrno (DWARF_E_NO_STRING);
       return NULL;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -83,6 +83,6 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_formstring (attrp)
    attrp-&amp;gt;cu-&amp;gt;offset_size, &amp;amp;off, IDX_debug_str, 1))
     return NULL;
 
-  return (const char *) dbg-&amp;gt;sectiondata[IDX_debug_str]-&amp;gt;d_buf + off;
+  return (const char *) dbg-&amp;gt;sectiondata[IDX_debug_str].data-&amp;gt;d_buf + off;
 }
 INTDEF(dwarf_formstring)
diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c
index 07efbe0..b3a7520 100644
--- a/libdw/dwarf_formudata.c
+++ b/libdw/dwarf_formudata.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -63,7 +63,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
   if (attr == NULL)
     return NULL;
 
-  const Elf_Data *d = attr-&amp;gt;cu-&amp;gt;dbg-&amp;gt;sectiondata[sec_index];
+  const Elf_Data *d = attr-&amp;gt;cu-&amp;gt;dbg-&amp;gt;sectiondata[sec_index].data;
   if (unlikely (d == NULL))
     {
       __libdw_seterrno (err_nodata);
diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
index 07bf6df..7b632c0 100644
--- a/libdw/dwarf_getabbrev.c
+++ b/libdw/dwarf_getabbrev.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -67,17 +67,17 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_getabbrev (dbg, cu, offset, lengthp, result)
      Dwarf_Abbrev *result;
 {
   /* Don't fail if there is not .debug_abbrev section.  */
-  if (dbg-&amp;gt;sectiondata[IDX_debug_abbrev] == NULL)
+  if (dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data == NULL)
     return NULL;
 
-  if (offset &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_abbrev]-&amp;gt;d_size)
+  if (offset &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data-&amp;gt;d_size)
     {
       __libdw_seterrno (DWARF_E_INVALID_OFFSET);
       return NULL;
     }
 
   const unsigned char *abbrevp
-    = (unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_abbrev]-&amp;gt;d_buf + offset;
+    = (unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data-&amp;gt;d_buf + offset;
 
   if (*abbrevp == '\0')
     /* We are past the last entry.  */
diff --git a/libdw/dwarf_getaranges.c b/libdw/dwarf_getaranges.c
index f18d63d..e8f377e 100644
--- a/libdw/dwarf_getaranges.c
+++ b/libdw/dwarf_getaranges.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -89,7 +89,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getaranges (dbg, aranges, naranges)
       return 0;
     }
 
-  if (dbg-&amp;gt;sectiondata[IDX_debug_aranges] == NULL)
+  if (dbg-&amp;gt;sectiondata[IDX_debug_aranges].data == NULL)
     {
       /* No such section.  */
       *aranges = NULL;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -98,15 +98,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getaranges (dbg, aranges, naranges)
       return 0;
     }
 
-  if (dbg-&amp;gt;sectiondata[IDX_debug_aranges]-&amp;gt;d_buf == NULL)
+  if (dbg-&amp;gt;sectiondata[IDX_debug_aranges].data-&amp;gt;d_buf == NULL)
     return -1;
 
   struct arangelist *arangelist = NULL;
   unsigned int narangelist = 0;
 
-  const unsigned char *readp = dbg-&amp;gt;sectiondata[IDX_debug_aranges]-&amp;gt;d_buf;
+  const unsigned char *readp = dbg-&amp;gt;sectiondata[IDX_debug_aranges].data-&amp;gt;d_buf;
   const unsigned char *readendp
-    = readp + dbg-&amp;gt;sectiondata[IDX_debug_aranges]-&amp;gt;d_size;
+    = readp + dbg-&amp;gt;sectiondata[IDX_debug_aranges].data-&amp;gt;d_size;
 
   while (readp &amp;lt; readendp)
     {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -204,7 +204,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getaranges (dbg, aranges, naranges)
   new_arange-&amp;gt;arange.length = range_length;
 
   /* We store the actual CU DIE offset, not the CU header offset.  */
-  const char *cu_header = (dbg-&amp;gt;sectiondata[IDX_debug_info]-&amp;gt;d_buf
+  const char *cu_header = (dbg-&amp;gt;sectiondata[IDX_debug_info].data-&amp;gt;d_buf
    + offset);
   unsigned int offset_size;
   if (read_4ubyte_unaligned_noncvt (cu_header) == DWARF3_LENGTH_64_BIT)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -221,7 +221,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getaranges (dbg, aranges, naranges)
 
   /* Sanity-check the data.  */
   if (unlikely (new_arange-&amp;gt;arange.offset
-&amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_info]-&amp;gt;d_size))
+&amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_info].data-&amp;gt;d_size))
     goto invalid;
 }
     }
diff --git a/libdw/dwarf_getattrs.c b/libdw/dwarf_getattrs.c
index 051dc25..f7b913e 100644
--- a/libdw/dwarf_getattrs.c
+++ b/libdw/dwarf_getattrs.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -92,8 +92,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *),
     {
       /* Are we still in bounds?  */
       if (unlikely (attrp
-    &amp;gt;= ((unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_abbrev]-&amp;gt;d_buf
-+ dbg-&amp;gt;sectiondata[IDX_debug_abbrev]-&amp;gt;d_size)))
+    &amp;gt;= ((unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data-&amp;gt;d_buf
++ dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data-&amp;gt;d_size)))
 goto invalid_dwarf;
 
       /* Get attribute name and form.  */
diff --git a/libdw/dwarf_getcfi.c b/libdw/dwarf_getcfi.c
index c935631..f161b20 100644
--- a/libdw/dwarf_getcfi.c
+++ b/libdw/dwarf_getcfi.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -62,12 +62,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getcfi (dbg)
   if (dbg == NULL)
     return NULL;
 
-  if (dbg-&amp;gt;cfi == NULL &amp;amp;&amp;amp; dbg-&amp;gt;sectiondata[IDX_debug_frame] != NULL)
+  if (dbg-&amp;gt;cfi == NULL &amp;amp;&amp;amp; dbg-&amp;gt;sectiondata[IDX_debug_frame].data != NULL)
     {
       Dwarf_CFI *cfi = libdw_typed_alloc (dbg, Dwarf_CFI);
 
       cfi-&amp;gt;dbg = dbg;
-      cfi-&amp;gt;data = (Elf_Data_Scn *) dbg-&amp;gt;sectiondata[IDX_debug_frame];
+      cfi-&amp;gt;data = (Elf_Data_Scn *) dbg-&amp;gt;sectiondata[IDX_debug_frame].data;
 
       cfi-&amp;gt;search_table = NULL;
       cfi-&amp;gt;search_table_vaddr = 0;
diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c
index b9ec34b..21750ef 100644
--- a/libdw/dwarf_getmacros.c
+++ b/libdw/dwarf_getmacros.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -68,7 +68,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getmacros (die, callback, arg, offset)
   if (die == NULL)
     return -1;
 
-  Elf_Data *d = die-&amp;gt;cu-&amp;gt;dbg-&amp;gt;sectiondata[IDX_debug_macinfo];
+  Elf_Data *d = die-&amp;gt;cu-&amp;gt;dbg-&amp;gt;sectiondata[IDX_debug_macinfo].data;
   if (unlikely (d == NULL) || unlikely (d-&amp;gt;d_buf == NULL))
     {
       __libdw_seterrno (DWARF_E_NO_ENTRY);
diff --git a/libdw/dwarf_getpubnames.c b/libdw/dwarf_getpubnames.c
index 5560a75..c5fdfef 100644
--- a/libdw/dwarf_getpubnames.c
+++ b/libdw/dwarf_getpubnames.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -68,9 +68,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; get_offsets (Dwarf *dbg)
   size_t cnt = 0;
   struct pubnames_s *mem = NULL;
   const size_t entsize = sizeof (struct pubnames_s);
-  unsigned char *const startp = dbg-&amp;gt;sectiondata[IDX_debug_pubnames]-&amp;gt;d_buf;
+  unsigned char *const startp
+    = dbg-&amp;gt;sectiondata[IDX_debug_pubnames].data-&amp;gt;d_buf;
   unsigned char *readp = startp;
-  unsigned char *endp = readp + dbg-&amp;gt;sectiondata[IDX_debug_pubnames]-&amp;gt;d_size;
+  unsigned char *endp
+    = readp + dbg-&amp;gt;sectiondata[IDX_debug_pubnames].data-&amp;gt;d_size;
 
   while (readp + 14 &amp;lt; endp)
     {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -109,7 +111,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; get_offsets (Dwarf *dbg)
       /* Now we know the offset of the first offset/name pair.  */
       mem[cnt].set_start = readp + 2 + 2 * len_bytes - startp;
       mem[cnt].address_len = len_bytes;
-      if (mem[cnt].set_start &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_pubnames]-&amp;gt;d_size)
+      if (mem[cnt].set_start
+  &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_pubnames].data-&amp;gt;d_size)
 /* Something wrong, the first entry is beyond the end of
    the section.  */
 break;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -130,7 +133,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; get_offsets (Dwarf *dbg)
 
       /* Determine the size of the CU header.  */
       unsigned char *infop
-= ((unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_info]-&amp;gt;d_buf
+= ((unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_info].data-&amp;gt;d_buf
    + mem[cnt].cu_offset);
       if (read_4ubyte_unaligned_noncvt (infop) == DWARF3_LENGTH_64_BIT)
 mem[cnt].cu_header_size = 23;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -173,9 +176,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getpubnames (dbg, callback, arg, offset)
     }
 
   /* Make sure it is a valid offset.  */
-  if (unlikely (dbg-&amp;gt;sectiondata[IDX_debug_pubnames] == NULL
+  if (unlikely (dbg-&amp;gt;sectiondata[IDX_debug_pubnames].data == NULL
 || ((size_t) offset
-    &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_pubnames]-&amp;gt;d_size)))
+    &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_pubnames].data-&amp;gt;d_size)))
     /* No (more) entry.  */
     return 0;
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -203,7 +206,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getpubnames (dbg, callback, arg, offset)
     }
 
   unsigned char *startp
-    = (unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_pubnames]-&amp;gt;d_buf;
+    = (unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_pubnames].data-&amp;gt;d_buf;
   unsigned char *readp = startp + offset;
   while (1)
     {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -243,7 +246,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getpubnames (dbg, callback, arg, offset)
 /* This was the last set.  */
 break;
 
-      startp = (unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_pubnames]-&amp;gt;d_buf;
+      startp
+= (unsigned char *) dbg-&amp;gt;sectiondata[IDX_debug_pubnames].data-&amp;gt;d_buf;
       readp = startp + dbg-&amp;gt;pubnames_sets[cnt].set_start;
     }
 
diff --git a/libdw/dwarf_getstring.c b/libdw/dwarf_getstring.c
index d5e7abf..04e6295 100644
--- a/libdw/dwarf_getstring.c
+++ b/libdw/dwarf_getstring.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -65,18 +65,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_getstring (dbg, offset, lenp)
   if (dbg == NULL)
     return NULL;
 
-  if (dbg-&amp;gt;sectiondata[IDX_debug_str] == NULL
-      || offset &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_str]-&amp;gt;d_size)
+  if (dbg-&amp;gt;sectiondata[IDX_debug_str].data == NULL
+      || offset &amp;gt;= dbg-&amp;gt;sectiondata[IDX_debug_str].data-&amp;gt;d_size)
     {
     no_string:
       __libdw_seterrno (DWARF_E_NO_STRING);
       return NULL;
     }
 
-  const char *result = ((const char *) dbg-&amp;gt;sectiondata[IDX_debug_str]-&amp;gt;d_buf
-+ offset);
+  const char *result
+    = ((const char *) dbg-&amp;gt;sectiondata[IDX_debug_str].data-&amp;gt;d_buf
+       + offset);
   const char *endp = memchr (result, '\0',
-     dbg-&amp;gt;sectiondata[IDX_debug_str]-&amp;gt;d_size - offset);
+     dbg-&amp;gt;sectiondata[IDX_debug_str].data-&amp;gt;d_size
+     - offset);
   if (endp == NULL)
     goto no_string;
 
diff --git a/libdw/dwarf_nextcu.c b/libdw/dwarf_nextcu.c
index 2e8f4d7..66dd191 100644
--- a/libdw/dwarf_nextcu.c
+++ b/libdw/dwarf_nextcu.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -79,11 +79,11 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
 
   /* If we reached the end before don't do anything.  */
   if (off == (Dwarf_Off) -1l
-      || unlikely (dwarf-&amp;gt;sectiondata[sec_idx] == NULL)
+      || unlikely (dwarf-&amp;gt;sectiondata[sec_idx].data == NULL)
       /* Make sure there is enough space in the .debug_info section
  for at least the initial word.  We cannot test the rest since
  we don't know yet whether this is a 64-bit object or not.  */
-      || unlikely (off + 4 &amp;gt;= dwarf-&amp;gt;sectiondata[sec_idx]-&amp;gt;d_size))
+      || unlikely (off + 4 &amp;gt;= dwarf-&amp;gt;sectiondata[sec_idx].data-&amp;gt;d_size))
     {
       *next_off = (Dwarf_Off) -1l;
       return 1;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -91,7 +91,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
 
   /* This points into the .debug_info section to the beginning of the
      CU entry.  */
-  const unsigned char *data = dwarf-&amp;gt;sectiondata[sec_idx]-&amp;gt;d_buf;
+  const unsigned char *data = dwarf-&amp;gt;sectiondata[sec_idx].data-&amp;gt;d_buf;
   const unsigned char *bytes = data + off;
 
   /* The format of the CU header is described in dwarf2p1 7.5.1:
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -136,7 +136,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_next_unit (dwarf, off, next_off, header_sizep, versionp, abbrev_offsetp,
 
   /* Now we know how large the header is.  */
   if (unlikely (DIE_OFFSET_FROM_CU_OFFSET (off, offset_size, debug_types)
-&amp;gt;= dwarf-&amp;gt;sectiondata[sec_idx]-&amp;gt;d_size))
+&amp;gt;= dwarf-&amp;gt;sectiondata[sec_idx].data-&amp;gt;d_size))
     {
       *next_off = -1;
       return 1;
diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c
index 4c650cf..90ada60 100644
--- a/libdw/dwarf_offdie.c
+++ b/libdw/dwarf_offdie.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -65,7 +65,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result,
     return NULL;
 
   Elf_Data *const data = dbg-&amp;gt;sectiondata[debug_types ? IDX_debug_types
-  : IDX_debug_info];
+  : IDX_debug_info].data;
   if (offset &amp;gt;= data-&amp;gt;d_size)
     {
       __libdw_seterrno (DWARF_E_INVALID_DWARF);
diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c
index 50fb6ba..035f4c4 100644
--- a/libdw/dwarf_ranges.c
+++ b/libdw/dwarf_ranges.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -123,7 +123,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
 
   /* We have to look for a noncontiguous range.  */
 
-  const Elf_Data *d = die-&amp;gt;cu-&amp;gt;dbg-&amp;gt;sectiondata[IDX_debug_ranges];
+  const Elf_Data *d = die-&amp;gt;cu-&amp;gt;dbg-&amp;gt;sectiondata[IDX_debug_ranges].data;
   if (d == NULL &amp;amp;&amp;amp; offset != 0)
     {
       __libdw_seterrno (DWARF_E_NO_DEBUG_RANGES);
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index b84bf02..1505512 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,5 +1,5 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 /* Internal definitions for libdwarf.
-   Copyright (C) 2002-2011 Red Hat, Inc.
+   Copyright (C) 2002-2012 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper &amp;lt;drepper&amp;lt; at &amp;gt;redhat.com&amp;gt;, 2002.
 
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -141,6 +141,20 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; enum
 
 #include "dwarf_sig8_hash.h"
 
+/* This represents a single DWARF section.  */
+struct Dwarf_Section
+{
+  /* The section data.  */
+  Elf_Data *data;
+
+#if USE_ZLIB
+  /* True if the section data is malloc'd decompressed data.  */
+  unsigned int gzipped : 1;
+#endif
+};
+
+typedef struct Dwarf_Section Dwarf_Section;
+
 /* This is the structure representing the debugging state.  */
 struct Dwarf
 {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -148,12 +162,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct Dwarf
   Elf *elf;
 
   /* The section data.  */
-  Elf_Data *sectiondata[IDX_last];
-
-#if USE_ZLIB
-  /* The 1 &amp;lt;&amp;lt; N bit is set if sectiondata[N] is malloc'd decompressed data.  */
-  unsigned int sectiondata_gzip_mask:IDX_last;
-#endif
+  struct Dwarf_Section sectiondata[IDX_last];
 
   /* True if the file has a byte order different from the host.  */
   bool other_byte_order;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -506,7 +515,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_relocate_offset (Dwarf *dbg __attribute__ ((unused)),
 static inline Elf_Data *
 __libdw_checked_get_data (Dwarf *dbg, int sec_index)
 {
-  Elf_Data *data = dbg-&amp;gt;sectiondata[sec_index];
+  Elf_Data *data = dbg-&amp;gt;sectiondata[sec_index].data;
   if (unlikely (data == NULL)
       || unlikely (data-&amp;gt;d_buf == NULL))
     {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -618,7 +627,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; cu_sec_idx (struct Dwarf_CU *cu)
 static inline Elf_Data *
 cu_data (struct Dwarf_CU *cu)
 {
-  return cu-&amp;gt;dbg-&amp;gt;sectiondata[cu_sec_idx (cu)];
+  return cu-&amp;gt;dbg-&amp;gt;sectiondata[cu_sec_idx (cu)].data;
 }
 
 /* Read up begin/end pair and increment read pointer.
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 87a0555..b25d87d 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* cu.c (intern_cu): Update for change to sectiondata.
+
 2011-12-02  Roland McGrath  &amp;lt;roland&amp;lt; at &amp;gt;hack.frob.com&amp;gt;
 
 * elf-from-memory.c (elf_from_remote_memory): Fix ELFCLASS64 case
diff --git a/libdwfl/cu.c b/libdwfl/cu.c
index 515aff3..353b915 100644
--- a/libdwfl/cu.c
+++ b/libdwfl/cu.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -197,7 +197,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; intern_cu (Dwfl_Module *mod, Dwarf_Off cuoff, struct dwfl_cu **result)
 
   if (*found == &amp;amp;key || *found == NULL)
     {
-      if (unlikely (cuoff + 4 &amp;gt;= mod-&amp;gt;dw-&amp;gt;sectiondata[IDX_debug_info]-&amp;gt;d_size))
+      if (unlikely (cuoff + 4
+    &amp;gt;= mod-&amp;gt;dw-&amp;gt;sectiondata[IDX_debug_info].data-&amp;gt;d_size))
 {
   /* This is the EOF marker.  Now we have interned all the CUs.
      One increment in MOD-&amp;gt;lazycu counts not having hit EOF yet.  */
diff --git a/src/ChangeLog b/src/ChangeLog
index ff19b48..7f9a9d3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-03-20  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* readelf.c (print_debug_abbrev_section): Update for change to
+sectiondata.
+(print_debug_str_section): Likewise.
+
 2012-01-31  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
 * readelf.c (attr_callback): Don't special case DW_FORM_sec_offset.
diff --git a/src/readelf.c b/src/readelf.c
index 8876688..bea90b7 100644
--- a/src/readelf.c
+++ b/src/readelf.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -4572,7 +4572,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; print_debug_abbrev_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
   (uint64_t) shdr-&amp;gt;sh_offset);
 
   Dwarf_Off offset = 0;
-  while (offset &amp;lt; dbg-&amp;gt;sectiondata[IDX_debug_abbrev]-&amp;gt;d_size)
+  while (offset &amp;lt; dbg-&amp;gt;sectiondata[IDX_debug_abbrev].data-&amp;gt;d_size)
     {
       printf (gettext ("\nAbbreviation section at offset %" PRIu64 ":\n"),
       offset);
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -6781,7 +6781,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; print_debug_str_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
  Ebl *ebl, GElf_Ehdr *ehdr,
  Elf_Scn *scn, GElf_Shdr *shdr, Dwarf *dbg)
 {
-  const size_t sh_size = dbg-&amp;gt;sectiondata[IDX_debug_str]-&amp;gt;d_size;
+  const size_t sh_size = dbg-&amp;gt;sectiondata[IDX_debug_str].data-&amp;gt;d_size;
 
   /* Compute floor(log16(shdr-&amp;gt;sh_size)).  */
   GElf_Addr tmp = sh_size;
&lt;/pre&gt;</description>
    <dc:creator>Tom Tromey</dc:creator>
    <dc:date>2012-03-20T19:06:06</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2108">
    <title>[0/5] handle multiple .debug_types sections</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2108</link>
    <description>&lt;pre&gt;I added support for multiple .debug_types sections to libdw.

I consider this a WIP patch.  There is one definitely bad patch (#4) and
of course the usual stylistic things; in particular the new CU-iterating
function (in patch #5) is pretty ugly.

I'd appreciate feedback on this.

Tom
_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Tom Tromey</dc:creator>
    <dc:date>2012-03-20T19:57:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2105">
    <title>libdw patch for .debug_types iteration</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2105</link>
    <description>&lt;pre&gt;
Tom

From 1b85426f7a1fa39cfb9ff83b864e825072115847 Mon Sep 17 00:00:00 2001
From: Tom Tromey &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
Date: Mon, 19 Mar 2012 11:46:45 -0600
Subject: [PATCH] Fix bug using dwarf_next_unit to iterate over .debug_types

* libdw_findcu.c (findcu_cb): Move earlier.
(__libdw_intern_next_unit): Add new CU to search tree here...
(__libdw_findcu): ... not here.

If you call dwarf_next_unit to iterate over .debug_types, then call
dwarf_offdie_types, you can see a failure if some earlier call
happened to call __libdw_intern_next_unit via dwarf_formref_die.

What happens is that __libdw_intern_next_unit updates the Dwarf's
next_tu_offset, but does not add the TU to the TU search tree.  So,
the call to dwarf_offdie_types does not find the TU in the tree, and
will not search any more, causing a failure.

This fix changes __libdw_intern_next_unit to add the TU to the search
tree, rather than relying on __libdw_findcu to do it.
---
 libdw/ChangeLog      |    6 ++++
 libdw/libdw_findcu.c |   68 ++++++++++++++++++++++++-------------------------
 2 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 98b67f4..f96c0d1 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1,3 +1,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+2012-03-19  Tom Tromey  &amp;lt;tromey&amp;lt; at &amp;gt;redhat.com&amp;gt;
+
+* libdw_findcu.c (findcu_cb): Move earlier.
+(__libdw_intern_next_unit): Add new CU to search tree here...
+(__libdw_findcu): ... not here.
+
 2012-01-31  Mark Wielaard  &amp;lt;mjw&amp;lt; at &amp;gt;redhat.com&amp;gt;
 
 * dwarf_formudata.c (dwarf_formudata): Handle DW_FORM_sec_offset.
diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c
index 8e5f9e9..83c96ba 100644
--- a/libdw/libdw_findcu.c
+++ b/libdw/libdw_findcu.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -56,6 +56,31 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include &amp;lt;search.h&amp;gt;
 #include "libdwP.h"
 
+static int
+findcu_cb (const void *arg1, const void *arg2)
+{
+  struct Dwarf_CU *cu1 = (struct Dwarf_CU *) arg1;
+  struct Dwarf_CU *cu2 = (struct Dwarf_CU *) arg2;
+
+  /* Find out which of the two arguments is the search value.  It has
+     end offset 0.  */
+  if (cu1-&amp;gt;end == 0)
+    {
+      if (cu1-&amp;gt;start &amp;lt; cu2-&amp;gt;start)
+return -1;
+      if (cu1-&amp;gt;start &amp;gt;= cu2-&amp;gt;end)
+return 1;
+    }
+  else
+    {
+      if (cu2-&amp;gt;start &amp;lt; cu1-&amp;gt;start)
+return 1;
+      if (cu2-&amp;gt;start &amp;gt;= cu1-&amp;gt;end)
+return -1;
+    }
+
+  return 0;
+}
 
 struct Dwarf_CU *
 internal_function
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -65,6 +90,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_intern_next_unit (dbg, debug_types)
 {
   Dwarf_Off *const offsetp
     = debug_types ? &amp;amp;dbg-&amp;gt;next_tu_offset : &amp;amp;dbg-&amp;gt;next_cu_offset;
+  void **tree = debug_types ? &amp;amp;dbg-&amp;gt;tu_tree : &amp;amp;dbg-&amp;gt;cu_tree;
 
   Dwarf_Off oldoff = *offsetp;
   uint16_t version;
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -105,34 +131,16 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_intern_next_unit (dbg, debug_types)
   newp-&amp;gt;lines = NULL;
   newp-&amp;gt;locs = NULL;
 
-  return newp;
-}
-
-
-static int
-findcu_cb (const void *arg1, const void *arg2)
-{
-  struct Dwarf_CU *cu1 = (struct Dwarf_CU *) arg1;
-  struct Dwarf_CU *cu2 = (struct Dwarf_CU *) arg2;
-
-  /* Find out which of the two arguments is the search value.  It has
-     end offset 0.  */
-  if (cu1-&amp;gt;end == 0)
+  /* Add the new entry to the search tree.  */
+  if (tsearch (newp, tree, findcu_cb) == NULL)
     {
-      if (cu1-&amp;gt;start &amp;lt; cu2-&amp;gt;start)
-return -1;
-      if (cu1-&amp;gt;start &amp;gt;= cu2-&amp;gt;end)
-return 1;
-    }
-  else
-    {
-      if (cu2-&amp;gt;start &amp;lt; cu1-&amp;gt;start)
-return 1;
-      if (cu2-&amp;gt;start &amp;gt;= cu1-&amp;gt;end)
-return -1;
+      /* Something went wrong.  Undo the operation.  */
+      *offsetp = oldoff;
+      __libdw_seterrno (DWARF_E_NOMEM);
+      return NULL;
     }
 
-  return 0;
+  return newp;
 }
 
 struct Dwarf_CU *
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -160,20 +168,10 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; __libdw_findcu (dbg, start, debug_types)
   /* No.  Then read more CUs.  */
   while (1)
     {
-      Dwarf_Off oldoff = *next_offset;
       struct Dwarf_CU *newp = __libdw_intern_next_unit (dbg, debug_types);
       if (newp == NULL)
 return NULL;
 
-      /* Add the new entry to the search tree.  */
-      if (tsearch (newp, tree, findcu_cb) == NULL)
-{
-  /* Something went wrong.  Undo the operation.  */
-  *next_offset = oldoff;
-  __libdw_seterrno (DWARF_E_NOMEM);
-  return NULL;
-}
-
       /* Is this the one we are looking for?  */
       if (start &amp;lt; *next_offset)
 // XXX Match exact offset.
&lt;/pre&gt;</description>
    <dc:creator>Tom Tromey</dc:creator>
    <dc:date>2012-03-19T17:54:12</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2103">
    <title>elf_end(): rwlock_fini() with a locked object</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2103</link>
    <description>&lt;pre&gt;Hi,

In libelf/elf_end.c:244 you have:
  rwlock_fini (elf-&amp;gt;lock);

But this lock is always still held when you get there.

I see this:
[...]
 
And I get this on Debian's kfreebsd port, resulting in an
assertion failure.  I wonder why I'm not getting it on other
ports.

Adding a "rwlock_unlock (elf-&amp;gt;lock);" just in front of that
line fixes the problem.


Kurt

_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Kurt Roeckx</dc:creator>
    <dc:date>2012-02-25T23:11:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2097">
    <title>addr2line format specifiers</title>
    <link>http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2097</link>
    <description>&lt;pre&gt;Hi,

addr2line.c:457 has:
      char *name = NULL;
      if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &amp;amp;name, &amp;amp;addr, &amp;amp;i) == 2
          &amp;amp;&amp;amp; string[i] == '\0')
        parsed = adjust_to_section (name, &amp;amp;addr, dwfl);
      switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &amp;amp;name, &amp;amp;i, &amp;amp;addr, &amp;amp;j))

And in the portability branch that got changed to:
      char *name = NULL;
      if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &amp;amp;name, &amp;amp;addr, &amp;amp;i) == 2
          &amp;amp;&amp;amp; string[i] == '\0')
        parsed = adjust_to_section (name, &amp;amp;addr, dwfl);
      switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &amp;amp;name, &amp;amp;i, &amp;amp;addr, &amp;amp;j))

But I think that that doesn't make sense.  Isn't %m the gnu extention,
and that %a now follows the C99 standard and expects a float *?


Kurt

_______________________________________________
elfutils-devel mailing list
elfutils-devel&amp;lt; at &amp;gt;lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/elfutils-devel
&lt;/pre&gt;</description>
    <dc:creator>Kurt Roeckx</dc:creator>
    <dc:date>2012-02-24T21:36:32</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.sysutils.elfutils.devel">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.sysutils.elfutils.devel</link>
  </textinput>
</rdf:RDF>

