diff options
author | Nick Clifton <nickc@redhat.com> | 2023-05-26 15:41:20 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2023-05-26 15:41:20 +0100 |
commit | 45b8517aae872adf7756dce6e138e487e5bc9b96 (patch) | |
tree | 8dd8e6a0c1d0a5f9e5a4ef478c3e7dd07245d57a /binutils/testsuite | |
parent | 5fd6b60d86ab6ab4bbd173524062b5d2aeac199a (diff) | |
download | gdb-45b8517aae872adf7756dce6e138e487e5bc9b96.zip gdb-45b8517aae872adf7756dce6e138e487e5bc9b96.tar.gz gdb-45b8517aae872adf7756dce6e138e487e5bc9b96.tar.bz2 |
Enhance objdump's --private option so that it can display the contents of PE format files.
* od-pe.c: New file: Dumps fields in PE format headers.
* configure.ac (od_vectors): Add objdump_private_desc_pe for PE format targets. (od_files): Add od-pe for PE format targets.
* configure: Regenerate.
* Makefile.am (CFILES): Add od-pe.c (EXTRA_objdump_SOURCE): Likewise.
* Makefile.in: Generate.
* NEWS: Mention the new feature.
* doc/binutils.texi: Document the new support.
* objdump.c (wide_output): Change from local to global.
* objdump.h (wide_output): Prototype. (objdump_private_desc_pe): Prototype.
* testsuite/binutils-all/objdump.exp: Add a test of the new feature.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index bda63d0..28a7ad6 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -923,6 +923,60 @@ proc test_objdump_S { } { test_objdump_S +# Test objdump --private +proc test_objdump_P {} { + global srcdir + global subdir + global OBJDUMP + global OBJDUMPFLAGS + global obj + + set test "objdump -P" + + if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.${obj}]} then { + unsupported "$test (build)" + return + } + + if [is_remote host] { + set testfile [remote_download host tmpdir/bintest.${obj}] + } else { + set testfile tmpdir/bintest.${obj} + } + + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -P header $testfile"] + + # FIXME: We should probably test the output further than this... + set want "Machine Num" + + if [regexp $want $got] then { + pass "$test (dump headers)" + } else { + fail "$test (dump headers)" + } + + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --private=sections $testfile"] + + # FIXME: We should probably test the output further than this... + set want "EXECUTE,READ" + + if [regexp $want $got] then { + pass "$test (dump sections)" + } else { + fail "$test (dump sections)" + } + + # remote_file host delete $testfile +} + +# Test objdump --private of a PE format file. +if { [istarget "*-*-pe*"] + || [istarget "*-*-cygwin*"] + || [istarget "*-*-mingw*"] +} then { + test_objdump_P +} + # Options which are not tested: -a -D -R -T -x -l --stabs # I don't see any generic way to test any of these other than -a. # Tests could be written for specific targets, and that should be done |