From: Petr Machata Date: Thu, 26 Mar 2009 02:25:10 +0000 (-0700) Subject: : Don't swallow last attribute X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09881df7297c1e59d0e1f4bef1531ed0e48ab2f8;p=thirdparty%2Felfutils.git : Don't swallow last attribute --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index f9320db6c..f2a73f2b5 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2009-03-24 Petr Machata + + * c++/dwarf (dwarf::debug_info_entry::raw_attributes): + Fix iteration over attributes. + 2009-03-24 Roland McGrath * Makefile.am (libdwpp_a_SOURCES): New variable. diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf index aba8b0a05..81d7d85c4 100644 --- a/libdw/c++/dwarf +++ b/libdw/c++/dwarf @@ -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); } diff --git a/tests/ChangeLog b/tests/ChangeLog index 6bc5000eb..e523c8cda 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2009-03-25 Petr Machata + + * dwarf-attributes.cc: New file. + * Makefile.am (noinst_PROGRAMS): Add it. + (dwarf_attributes_SOURCES, dwarf_attributes_LDADD): New variables. + 2009-03-25 Roland McGrath * dwarf-print.cc (print_die, process_file): Take LIMIT argument. diff --git a/tests/Makefile.am b/tests/Makefile.am index e075fd037..3efc31421 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 000000000..e39c42f7b --- /dev/null +++ b/tests/run-dwarf-attributes.sh @@ -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 , 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 +# . + +. $srcdir/test-subr.sh + +testfiles testfile + +testrun_compare ./dwarf-print --depth=1 testfile <<\EOF +testfile: + ... + ... + ... +EOF + +exit 0