Fix readelf --debug-dump=loc crash on multiple input files.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 27 Feb 2011 20:01:25 +0000 (12:01 -0800)
committerRoland McGrath <roland@redhat.com>
Sun, 27 Feb 2011 20:01:25 +0000 (12:01 -0800)
src/ChangeLog
src/readelf.c
tests/ChangeLog
tests/Makefile.am
tests/run-readelf-twofiles.sh [new file with mode: 0755]

index 5ef2aec..35d5f09 100644 (file)
@@ -1,3 +1,7 @@
+2011-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * readelf.c (reset_listptr): Clear TABLE->TABLE.
+
 2011-02-25  Mark Wielaard  <mjw@redhat.com>
 
        * readelf.c (dwarf_attr_string): Add DW_AT_GNU_* handling.
index b798b5a..956d8bd 100644 (file)
@@ -4363,6 +4363,7 @@ static void
 reset_listptr (struct listptr_table *table)
 {
   free (table->table);
+  table->table = NULL;
   table->n = table->alloc = 0;
 }
 
index bc78843..16eb7d5 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * Makefile.am (TESTS): Add run-readelf-twofiles.sh.
+       * run-readelf-twofiles.sh: New file.
+
 2011-02-02  Josh Stone  <jistone@redhat.com>
 
        * run-prelink-addr-test.sh: Add testfile55, 32 and 64-bit.
index b317553..dcdc0d8 100644 (file)
@@ -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 (executable)
index 0000000..4255587
--- /dev/null
@@ -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
+# <http://www.openinventionnetwork.com>.
+
+. $srcdir/test-subr.sh
+
+testfiles testfile14
+
+testrun >/dev/null ../src/readelf -w testfile14 testfile14
+
+exit 0