]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
<dwarf>: Don't swallow last attribute
authorPetr Machata <pmachata@redhat.com>
Thu, 26 Mar 2009 02:25:10 +0000 (19:25 -0700)
committerRoland McGrath <roland@redhat.com>
Thu, 26 Mar 2009 02:25:10 +0000 (19:25 -0700)
libdw/ChangeLog
libdw/c++/dwarf
tests/ChangeLog
tests/Makefile.am
tests/run-dwarf-attributes.sh [new file with mode: 0755]

index f9320db6ca23bcf71593e0795239961929c7e67a..f2a73f2b52028587ef94ff202d0c37182125983d 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-24  Petr Machata  <pmachata@redhat.com>
+
+       * c++/dwarf (dwarf::debug_info_entry::raw_attributes):
+       Fix iteration over attributes.
+
 2009-03-24  Roland McGrath  <roland@redhat.com>
 
        * Makefile.am (libdwpp_a_SOURCES): New variable.
index aba8b0a05b8469bcbcb0bc214e1a8d3dde942670..81d7d85c459d79c91f2e338b144ace1ca0683801 100644 (file)
@@ -612,7 +612,7 @@ namespace elfutils
        inline bool operator== (const const_iterator &other) const
        {
          return (_m_die._m_die.addr == other._m_die._m_die.addr
-                 && _m_offset == other._m_offset);
+                 && _m_attr.valp == other._m_attr.valp);
        }
        inline bool operator!= (const const_iterator &other) const
        {
@@ -637,7 +637,7 @@ namespace elfutils
 
        inline attribute operator* () const
        {
-         if (unlikely (_m_offset == 1))
+         if (unlikely (_m_attr.valp == NULL))
            throw std::runtime_error ("dereferencing end iterator");
          return attribute (_m_die, _m_attr);
        }
index 6bc5000eb63bb3fe4291b79620a8cd209cb023a1..e523c8cda57bc3560f1dc45848acb1a79970f467 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-25  Petr Machata  <pmachata@redhat.com>
+
+       * dwarf-attributes.cc: New file.
+       * Makefile.am (noinst_PROGRAMS): Add it.
+       (dwarf_attributes_SOURCES, dwarf_attributes_LDADD): New variables.
+
 2009-03-25  Roland McGrath  <roland@redhat.com>
 
        * dwarf-print.cc (print_die, process_file): Take LIMIT argument.
index e075fd037dfc0e36d339fda718b9b9970666319d..3efc31421719d9baf367b3873d7cde60f0656c9f 100644 (file)
@@ -88,7 +88,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
        run-dwfl-bug-offline-rel.sh run-dwfl-addr-sect.sh \
        run-disasm-x86.sh run-disasm-x86-64.sh \
        run-early-offscn.sh \
-       run-dwarfcmp-self.sh run-dwarflint-self.sh
+       run-dwarfcmp-self.sh run-dwarflint-self.sh run-dwarf-attributes.sh
 # run-show-ciefde.sh
 
 if !STANDALONE
@@ -144,7 +144,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
             testfile44.S.bz2 testfile44.expect.bz2 run-disasm-x86.sh \
             testfile45.S.bz2 testfile45.expect.bz2 run-disasm-x86-64.sh \
             testfile46.bz2 testfile47.bz2 testfile48.bz2 testfile48.debug.bz2 \
-            testfile49.bz2
+            testfile49.bz2 dwarf-attributes.sh
 
 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
                              bindir=$(DESTDIR)$(bindir) \
diff --git a/tests/run-dwarf-attributes.sh b/tests/run-dwarf-attributes.sh
new file mode 100755 (executable)
index 0000000..e39c42f
--- /dev/null
@@ -0,0 +1,38 @@
+#! /bin/sh
+# Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Red Hat, Inc.
+# This file is part of Red Hat elfutils.
+# Written by Ulrich Drepper <drepper@redhat.com>, 1999.
+#
+# 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
+# <http://www.openinventionnetwork.com>.
+
+. $srcdir/test-subr.sh
+
+testfiles testfile
+
+testrun_compare ./dwarf-print --depth=1 testfile <<\EOF
+testfile:
+ <compile_unit offset=[0xb] stmt_list=0 high_pc=0x804845a low_pc=0x804842c name="m.c" comp_dir="/home/drepper/gnu/new-bu/build/ttt" producer="GNU C 2.96 20000731 (Red Hat Linux 7.0)" language=0x1>...
+ <compile_unit offset=[0xca] stmt_list=0x4b high_pc=0x8048466 low_pc=0x804845c name="b.c" comp_dir="/home/drepper/gnu/new-bu/build/ttt" producer="GNU C 2.96 20000731 (Red Hat Linux 7.0)" language=0x1>...
+ <compile_unit offset=[0x15fc] stmt_list=0x1e0 high_pc=0x8048472 low_pc=0x8048468 name="f.c" comp_dir="/home/drepper/gnu/new-bu/build/ttt" producer="GNU C 2.96 20000731 (Red Hat Linux 7.0)" language=0x1>...
+EOF
+
+exit 0