Restore readelf's string dump to previous behaviour where newlines were caused line...
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / readelf.exp
index 6a7b5621dd0c08c6f85bb97a433d2bc14859aa44..cc78e66ea3cd9fe717bd845841d9e10ab2717e6b 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999-2017 Free Software Foundation, Inc.
+#   Copyright (C) 1999-2020 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -40,13 +40,13 @@ proc file_contents { filename } {
 # Find out the size by reading the output of the EI_CLASS field.
 # Similar to the test for readelf -h, but we're just looking for the
 # EI_CLASS line here.
-proc readelf_find_size { binary_file } {
+proc readelf_find_size { binary_file test_iteration } {
     global READELF
     global READELFFLAGS
     global readelf_size
 
     set readelf_size ""
-    set testname "finding out ELF size with readelf -h"
+    set testname "finding out ELF size with readelf -h ($test_iteration)"
     set got [remote_exec host "$READELF $READELFFLAGS -h $binary_file" "" "/dev/null" "readelf.out"]
     if [is_remote host] then {
         remote_upload host "readelf.out"
@@ -324,6 +324,8 @@ if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
     unresolved "readelf -S bintest (failed to assemble)"
     unresolved "readelf -s bintest (failed to assemble)"
     unresolved "readelf -r bintest (failed to assemble)"
+    global readelf_size
+    set readelf_size ""
 } else {
 
     if ![is_remote host] {
@@ -333,7 +335,7 @@ if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
     }
 
     # First, determine the size, so specific output matchers can be used.
-    readelf_find_size $tempfile
+    readelf_find_size $tempfile 1
 
     # Run the tests.
     readelf_test -h $tempfile readelf.h  {}
@@ -347,6 +349,7 @@ readelf_wi_test
 readelf_compressed_wa_test
 
 readelf_dump_test
+run_dump_test "pr25543"
 
 # PR 13482 - Check for off-by-one errors when dumping .note sections.
 if {![binutils_assemble $srcdir/$subdir/version.s tmpdir/version.o]} then {
@@ -379,6 +382,33 @@ if {![binutils_assemble $srcdir/$subdir/pr18374.s tmpdir/pr18374.o]} then {
 }
 
 
+# locview - Check dumping of location lists with location views.
+if {![binutils_assemble $srcdir/$subdir/locview-1.s tmpdir/locview-1.o]} then {
+    unresolved "readelf --debug-dump=loc locview-1 (failed to assemble)"
+} else {
+
+    if ![is_remote host] {
+       set tempfile tmpdir/locview-1.o
+    } else {
+       set tempfile [remote_download host tmpdir/locview-1.o]
+    }
+
+    readelf_test --debug-dump=loc $tempfile readelf.locview-1  {}
+}
+if {![binutils_assemble $srcdir/$subdir/locview-2.s tmpdir/locview-2.o]} then {
+    unresolved "readelf --debug-dump=loc locview-2 (failed to assemble)"
+} else {
+
+    if ![is_remote host] {
+       set tempfile tmpdir/locview-2.o
+    } else {
+       set tempfile [remote_download host tmpdir/locview-2.o]
+    }
+
+    readelf_test --debug-dump=loc $tempfile readelf.locview-2  {}
+}
+
+
 # Check that decompressed dumps work.
 if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then {
     unresolved "readelf --decompress --hex-dump .debug_loc z (failed to assemble)"
@@ -393,14 +423,15 @@ if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then {
     readelf_test {--decompress --hex-dump .debug_loc} $tempfile readelf.z  {}
 }
 
-# Skip the next test for the RISCV architectures because they do not
-# support .ULEB128 pseudo-ops with non-constant values.
+# Skip the next test for the RISCV architectures because they
+# do not support .ULEB128 pseudo-ops with non-constant values.
 if ![istarget "riscv*-*-*"] then {
 
     set hpux ""
     if [istarget "hppa*64*-*-hpux*"] {
        set hpux "--defsym HPUX=1"
     }
+
     # Assemble the DWARF-5 test file.
     if {![binutils_assemble_flags $srcdir/$subdir/dw5.S tmpdir/dw5.o $hpux]} then {
        unresolved "readelf -wiaoRlL dw5 (failed to assemble)"
@@ -414,9 +445,65 @@ if ![istarget "riscv*-*-*"] then {
        }
 
        # First, determine the size, so specific output matchers can be used.
-       readelf_find_size $tempfile
+       readelf_find_size $tempfile 2
 
        # Make sure that readelf can decode the contents.
-       readelf_test -wiaoRlL $tempfile dw5.W {}
+       readelf_test -wiaoRlL $tempfile dw5.W { nds32*-elf }
+    }
+}
+
+# Assemble the DWARF-5 attributes test file.
+if {![binutils_assemble_flags $srcdir/$subdir/dwarf-attributes.S tmpdir/dwarf-attributes.o ""]} then {
+    unresolved "readelf -wi dwarf-attributes (failed to assemble)"
+} else {
+    # Download it.
+    if ![is_remote host] {
+       set tempfile tmpdir/dwarf-attributes.o
+    } else {
+       set tempfile [remote_download host tmpdir/dwarf-attributes.o]
     }
+
+    # First, determine the size, so specific output matchers can be used.
+    readelf_find_size $tempfile 3
+
+    # Make sure that readelf can decode the contents.
+    readelf_test -wi $tempfile dwarf-attributes.W {}
 }
+
+# Check that debug link sections can be dumped.
+if {![binutils_assemble $srcdir/$subdir/debuglink.s tmpdir/debuglink.o]} then {
+    unresolved "readelf --debug-dump=links (failed to assemble debuglink.s)"
+} else {
+    if ![is_remote host] {
+       set tempfile tmpdir/debuglink.o
+    } else {
+       set tempfile [remote_download host tmpdir/debuglink.o]
+    }
+
+    readelf_test {--debug-dump=links} $tempfile readelf.k  {}
+
+    # Check that debug link sections can be followed.
+    if {![binutils_assemble $srcdir/$subdir/linkdebug.s tmpdir/linkdebug.debug]} then {
+       unresolved "readelf --debug-dump=follow-links (failed to assemble linkdebug.s)"
+    } else {
+       if [is_remote host] {
+           set tempfile2 [remote_download host tmpdir/linkdebug.debug]
+       }
+
+       readelf_test {-wKis} $tempfile readelf.wKis  {}
+    }
+}
+
+if {![binutils_assemble $srcdir/$subdir/dwo.s tmpdir/dwo.o]} then {
+    unresolved "readelf --debug-dump=links (failed to assemble dwo.s)"
+} else {
+    if ![is_remote host] {
+       set tempfile tmpdir/dwo.o
+    } else {
+       set tempfile [remote_download host tmpdir/dwo.o]
+    }
+
+    readelf_test {--debug-dump=links} $tempfile readelf.k2  {}
+}
+
+
This page took 0.056107 seconds and 4 git commands to generate.