summaryrefslogtreecommitdiff
path: root/tests/run-readelf-zx.sh
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-10-21 01:30:44 +0200
committerMark Wielaard <mjw@redhat.com>2016-01-06 14:27:10 +0100
commitf5013e83d5c8fcd9309c8976c3f1167d28cd07aa (patch)
tree144480f1ea545a6721db2e05b77f2f8f92ca9ee1 /tests/run-readelf-zx.sh
parentd22cb04967a2396514abf28cc43e70c037ee9cf2 (diff)
downloadelfutils-f5013e83d5c8fcd9309c8976c3f1167d28cd07aa.tar.gz
readelf: Handle compressed sections and extend -z to cover -x and -p.
When printing a (non-string, non-data) section use uncompressed data when possible. For dumping hex and string sections (-x and -p) -z will dump the uncompressed data (otherwise the compressed data is dumped). -z, --decompress Show compression information for compressed sections (when used with -S); decompress section before dumping data (when used with -p or -x) Includes test cases for ET_REL files using compressed relocation (target) debug sections to test libdwfl transparent uncompression of sections. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'tests/run-readelf-zx.sh')
-rwxr-xr-xtests/run-readelf-zx.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/run-readelf-zx.sh b/tests/run-readelf-zx.sh
new file mode 100755
index 00000000..994528c0
--- /dev/null
+++ b/tests/run-readelf-zx.sh
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 2015 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file 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; either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# See run-elfgetchdr.sh for testfiles.
+
+testfiles testfile-zgnu64
+testrun_compare ${abs_top_builddir}/src/readelf -z -x.zdebug_aranges testfile-zgnu64 <<\EOF
+
+Hex dump of section [2] '.zdebug_aranges', 50 bytes (96 uncompressed) at offset 0x260:
+ 0x00000000 2c000000 02000000 00000800 00000000 ,...............
+ 0x00000010 78004000 00000000 14000000 00000000 x.@.............
+ 0x00000020 00000000 00000000 00000000 00000000 ................
+ 0x00000030 2c000000 02005500 00000800 00000000 ,.....U.........
+ 0x00000040 8c004000 00000000 16000000 00000000 ..@.............
+ 0x00000050 00000000 00000000 00000000 00000000 ................
+EOF
+
+testfiles testfile-zgabi64
+testrun_compare ${abs_top_builddir}/src/readelf -z -x.debug_aranges testfile-zgabi64 <<\EOF
+
+Hex dump of section [2] '.debug_aranges', 62 bytes (96 uncompressed) at offset 0x260:
+ 0x00000000 2c000000 02000000 00000800 00000000 ,...............
+ 0x00000010 78004000 00000000 14000000 00000000 x.@.............
+ 0x00000020 00000000 00000000 00000000 00000000 ................
+ 0x00000030 2c000000 02005500 00000800 00000000 ,.....U.........
+ 0x00000040 8c004000 00000000 16000000 00000000 ..@.............
+ 0x00000050 00000000 00000000 00000000 00000000 ................
+EOF
+
+testfiles testfile-zgnu32
+testrun_compare ${abs_top_builddir}/src/readelf -z -x.zdebug_aranges testfile-zgnu32 <<\EOF
+
+Hex dump of section [2] '.zdebug_aranges', 49 bytes (64 uncompressed) at offset 0x1c0:
+ 0x00000000 1c000000 02000000 00000400 00000000 ................
+ 0x00000010 54800408 14000000 00000000 00000000 T...............
+ 0x00000020 1c000000 02004d00 00000400 00000000 ......M.........
+ 0x00000030 68800408 16000000 00000000 00000000 h...............
+EOF
+
+testfiles testfile-zgabi32
+testrun_compare ${abs_top_builddir}/src/readelf -z -x.debug_aranges testfile-zgabi32 <<\EOF
+
+Hex dump of section [2] '.debug_aranges', 49 bytes (64 uncompressed) at offset 0x1c0:
+ 0x00000000 1c000000 02000000 00000400 00000000 ................
+ 0x00000010 54800408 14000000 00000000 00000000 T...............
+ 0x00000020 1c000000 02004d00 00000400 00000000 ......M.........
+ 0x00000030 68800408 16000000 00000000 00000000 h...............
+EOF
+
+exit 0