aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-11-14 10:57:58 +0000
committerNick Clifton <nickc@redhat.com>2023-11-14 10:57:58 +0000
commitfab62191f84583780c2c6d024d0e583400881770 (patch)
tree8d3f4bec0f333cfab0808a08f8e435cdc2bc9171 /binutils/testsuite
parent319b460545dc79280e2904dcc280057cf71fb753 (diff)
downloadgdb-fab62191f84583780c2c6d024d0e583400881770.zip
gdb-fab62191f84583780c2c6d024d0e583400881770.tar.gz
gdb-fab62191f84583780c2c6d024d0e583400881770.tar.bz2
Improve objdump's handling of compressed sections.
PR 31062 * objdump.c (decompressed_dumps): New local variable. (usage): Mention the -z/--decompress option. (long_options): Add --decompress. (dump_section_header): Add "COMPRESSED" to the Flags field of any compressed section. (dump_section): Warn users when dumping a compressed section. (display_any_bfd): Decompress the section if decompressed_dumps is true. (main): Handle the -z/--decompress option. * NEWS: Mention the new feature. * doc/binutils.texi: Document the new feature. * testsuite/binutils-all/objdump.s: Update expected output. * testsuite/binutils-all/objdump.exp: Add test of -Z -s. * testsuite/binutils-all/objdump.Zs: New file. * readelf.c (maybe_expand_or_relocate_section): New function. Contains common code found in dump functions. Adds a note message if a compressed section is not being decompressed. (dump_section_as_strings): Use new function. (dump_section_as_bytes): Likewise.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/binutils-all/objdump.Zs9
-rw-r--r--binutils/testsuite/binutils-all/objdump.exp16
-rw-r--r--binutils/testsuite/binutils-all/objdump.s1
3 files changed, 26 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/objdump.Zs b/binutils/testsuite/binutils-all/objdump.Zs
new file mode 100644
index 0000000..32905b5
--- /dev/null
+++ b/binutils/testsuite/binutils-all/objdump.Zs
@@ -0,0 +1,9 @@
+
+.*dw2-compressed.o: file format .*
+
+Contents of section .zdebug_abbrev:
+ 0000 01110110 06120111 01030825 08130b00 ...........%....
+ 0010 00022e00 3f0c3a0b 3b0b0308 49131101 ....\?.:.;...I...
+ 0020 1201400a 00000324 0003080b 0b3e0b00 ..@....\$.....>..
+ 0030 000000 ...
+#pass
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp
index 4fe9e499..7071e96 100644
--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -466,6 +466,22 @@ if { ![is_elf_format] } then {
} else {
pass "objdump -W"
}
+
+ # Test objdump -Z -s on a file that contains some compressed .debug sections
+
+ set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Z -s -j .zdebug_abbrev $compressed_testfile" "" "/dev/null" "objdump.out"]
+
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "objdump -Z -s (reason: unexpected output)"
+ send_log $got
+ send_log "\n"
+ }
+
+ if { [regexp_diff objdump.out $srcdir/$subdir/objdump.Zs] } then {
+ fail "objdump -Z -s"
+ } else {
+ pass "objdump -Z -s"
+ }
}
# Test objdump -WL on a file that contains line information for multiple files and search directories.
diff --git a/binutils/testsuite/binutils-all/objdump.s b/binutils/testsuite/binutils-all/objdump.s
index aea35df..f80f8c5 100644
--- a/binutils/testsuite/binutils-all/objdump.s
+++ b/binutils/testsuite/binutils-all/objdump.s
@@ -2,6 +2,7 @@
.*dw2-compressed.o: file format .*
Contents of section .zdebug_abbrev:
+ NOTE: This section is compressed, but its contents have NOT been expanded for this dump.
0000 5a4c4942 00000000 00000033 785e6314 ZLIB.......3x\^c.
0010 64146013 62146464 e650e510 e6666060 d.`.b.dd.P...f``
0020 d263b0e7 b1e2b6e6 66e6f014 16641462 .c......f....d.b