From: Jan Kratochvil Date: Sun, 27 Feb 2011 20:01:25 +0000 (-0800) Subject: Fix readelf --debug-dump=loc crash on multiple input files. X-Git-Tag: elfutils-0.153~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fec3999dc82e340bdcb41aefca2793f0b10cb825;p=thirdparty%2Felfutils.git Fix readelf --debug-dump=loc crash on multiple input files. --- diff --git a/src/ChangeLog b/src/ChangeLog index 5ef2aec28..35d5f0979 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-02-27 Jan Kratochvil + + * readelf.c (reset_listptr): Clear TABLE->TABLE. + 2011-02-25 Mark Wielaard * readelf.c (dwarf_attr_string): Add DW_AT_GNU_* handling. diff --git a/src/readelf.c b/src/readelf.c index b798b5ac8..956d8bd46 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -4363,6 +4363,7 @@ static void reset_listptr (struct listptr_table *table) { free (table->table); + table->table = NULL; table->n = table->alloc = 0; } diff --git a/tests/ChangeLog b/tests/ChangeLog index bc7884316..16eb7d5f1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2011-02-27 Jan Kratochvil + + * Makefile.am (TESTS): Add run-readelf-twofiles.sh. + * run-readelf-twofiles.sh: New file. + 2011-02-02 Josh Stone * run-prelink-addr-test.sh: Add testfile55, 32 and 64-bit. diff --git a/tests/Makefile.am b/tests/Makefile.am index b317553d7..dcdc0d8e4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -76,7 +76,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ run-find-prologues.sh run-allregs.sh \ run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \ - run-readelf-test4.sh \ + run-readelf-test4.sh run-readelf-twofiles.sh \ run-native-test.sh run-bug1-test.sh \ dwfl-bug-addr-overflow run-addrname-test.sh \ dwfl-bug-fd-leak dwfl-bug-report \ diff --git a/tests/run-readelf-twofiles.sh b/tests/run-readelf-twofiles.sh new file mode 100755 index 000000000..4255587c2 --- /dev/null +++ b/tests/run-readelf-twofiles.sh @@ -0,0 +1,32 @@ +#! /bin/sh +# Copyright (C) 2011 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 +# . + +. $srcdir/test-subr.sh + +testfiles testfile14 + +testrun >/dev/null ../src/readelf -w testfile14 testfile14 + +exit 0