aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-05-15 17:16:31 +0100
committerNick Clifton <nickc@redhat.com>2015-05-15 17:16:31 +0100
commit0e602686df5677fee06cbd1718b4a7aa5379cd2a (patch)
tree728d4833b4bb267e64d627bd7982fcddee260ab5 /binutils/testsuite
parent4e63d0ac896b6036edd8e2c09a4dac7aa16a46d1 (diff)
downloadgdb-0e602686df5677fee06cbd1718b4a7aa5379cd2a.zip
gdb-0e602686df5677fee06cbd1718b4a7aa5379cd2a.tar.gz
gdb-0e602686df5677fee06cbd1718b4a7aa5379cd2a.tar.bz2
Add --decompress option to readelf to decompress sections before they are dumped.
bin * readelf.c (options): Add "decompress". (usage): Mention -z/--decompress. (parse_args): Handle -z. (uncompress_section_contents): Move to earlier in the file. (dump_section_as_strings): If requested, decompress the section before dumping. (dump_section_as_bytes): Likewise. * doc/binutils.texi: Document the new option. tests * binutils-all/z.s: New test. Checks the --decompress option to readelf. * binutils-all/readelf.exp: Run the test. * binutils-all/readelf.z: Expected output from readelf.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/readelf.exp46
-rw-r--r--binutils/testsuite/binutils-all/readelf.z8
-rw-r--r--binutils/testsuite/binutils-all/z.s70
4 files changed, 118 insertions, 13 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index ad8d8ad..99801e2 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-15 Nick Clifton <nickc@redhat.com>
+
+ * binutils-all/z.s: New test. Checks the --decompress option to
+ readelf.
+ * binutils-all/readelf.exp: Run the test.
+ * binutils-all/readelf.z: Expected output from readelf.
+
2015-05-14 H.J. Lu <hongjiu.lu@intel.com>
* binutils-all/compress.exp: Replace "$OBJDUMP -s -j .debug_info"
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index 58e140c..59fd556 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -346,29 +346,49 @@ readelf_dump_test
if {![binutils_assemble $srcdir/$subdir/version.s tmpdir/version.o]} then {
perror "could not assemble version note test file"
unresolved "readelf - failed to assemble"
- return
-}
-
-if ![is_remote host] {
- set tempfile tmpdir/version.o
+ fail "readelf -n"
} else {
- set tempfile [remote_download host tmpdir/version.o]
+
+ if ![is_remote host] {
+ set tempfile tmpdir/version.o
+ } else {
+ set tempfile [remote_download host tmpdir/version.o]
+ }
+
+ readelf_test -n $tempfile readelf.n {}
}
-readelf_test -n $tempfile readelf.n {}
# PR 18374 - Check that relocations against the .debug_loc section
# do not prevent readelf from displaying all the location lists.
if {![binutils_assemble $srcdir/$subdir/pr18374.s tmpdir/pr18374.o]} then {
perror "could not assemble PR18374 test file"
unresolved "readelf - failed to assemble"
- return
+ fail "readelf --debug-loc"
+} else {
+
+ if ![is_remote host] {
+ set tempfile tmpdir/pr18374.o
+ } else {
+ set tempfile [remote_download host tmpdir/pr18374.o]
+ }
+
+ readelf_test --debug-dump=loc $tempfile readelf.pr18374 {}
}
-if ![is_remote host] {
- set tempfile tmpdir/pr18374.o
+
+# Check that decompressed dumps work.
+if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then {
+ perror "could not assemble decompress dump test file"
+ unresolved "readelf - failed to assemble"
+ fail "readelf -z"
} else {
- set tempfile [remote_download host tmpdir/pr18374.o]
-}
-readelf_test --debug-dump=loc $tempfile readelf.pr18374 {}
+ if ![is_remote host] {
+ set tempfile tmpdir/z.o
+ } else {
+ set tempfile [remote_download host tmpdir/z.o]
+ }
+
+ readelf_test {--decompress --hex-dump .debug_loc} $tempfile readelf.z {}
+}
diff --git a/binutils/testsuite/binutils-all/readelf.z b/binutils/testsuite/binutils-all/readelf.z
new file mode 100644
index 0000000..0843444
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf.z
@@ -0,0 +1,8 @@
+Hex dump of section '.debug_loc':
+ 0x00000000 00000000 00000000 01005000 00000000 ..........P.....
+ 0x00000010 00000004 00f30150 9f000000 00000000 .......P........
+ 0x00000020 00000000 00000000 00010051 00000000 ...........Q....
+ 0x00000030 00000000 0300717f 9f000000 00000000 ......q.........
+ 0x00000040 000b0070 0020f301 51227000 229f0000 ...p. ..Q"p."...
+ 0x00000050 00000000 00000b00 70002070 0022f301 ........p. p."..
+ 0x00000060 51229f00 00000000 000000 Q".........
diff --git a/binutils/testsuite/binutils-all/z.s b/binutils/testsuite/binutils-all/z.s
new file mode 100644
index 0000000..2d24f33
--- /dev/null
+++ b/binutils/testsuite/binutils-all/z.s
@@ -0,0 +1,70 @@
+ .section .debug_loc,"",%progbits
+
+ .byte 0x5a
+ .byte 0x4c
+ .byte 0x49
+ .byte 0x42
+ .byte 0x00
+ .byte 0x00
+ .byte 0x00
+ .byte 0x00
+ .byte 0x00
+ .byte 0x00
+ .byte 0x00
+ .byte 0x6b
+ .byte 0x78
+ .byte 0x9c
+ .byte 0x63
+ .byte 0x60
+ .byte 0x80
+ .byte 0x00
+ .byte 0x46
+ .byte 0x86
+ .byte 0x00
+ .byte 0x28
+ .byte 0x8b
+ .byte 0x81
+ .byte 0x85
+ .byte 0xe1
+ .byte 0x33
+ .byte 0x63
+ .byte 0xc0
+ .byte 0x7c
+ .byte 0x06
+ .byte 0x34
+ .byte 0xc0
+ .byte 0xc8
+ .byte 0x10
+ .byte 0x08
+ .byte 0x63
+ .byte 0x32
+ .byte 0x33
+ .byte 0x14
+ .byte 0xd6
+ .byte 0xc3
+ .byte 0xe5
+ .byte 0xb9
+ .byte 0x19
+ .byte 0x0a
+ .byte 0x18
+ .byte 0x14
+ .byte 0x3e
+ .byte 0x33
+ .byte 0x06
+ .byte 0x2a
+ .byte 0x15
+ .byte 0x30
+ .byte 0x28
+ .byte 0xa1
+ .byte 0x0a
+ .byte 0x02
+ .byte 0x05
+ .byte 0x40
+ .byte 0xe2
+ .byte 0x70
+ .byte 0x41
+ .byte 0x00
+ .byte 0xc1
+ .byte 0x6a
+ .byte 0x0a
+ .byte 0x83