1## Test that the -x alias can be used flexibly. Create a baseline and ensure 2## all other combinations are identical. 3# RUN: yaml2obj --docnum=1 %s -o %t 4# RUN: llvm-readelf --file-header --hex-dump=.shstrtab %t > %t.hexdump.out 5# RUN: llvm-readelf -h --hex-dump .shstrtab %t | cmp %t.hexdump.out - 6# RUN: llvm-readelf -h -x .shstrtab %t | cmp %t.hexdump.out - 7# RUN: llvm-readelf -h -x.shstrtab %t | cmp %t.hexdump.out - 8# RUN: llvm-readelf -hx .shstrtab %t | cmp %t.hexdump.out - 9# RUN: llvm-readelf -hx.shstrtab %t | cmp %t.hexdump.out - 10 11## A basic correctness check to verify that the .shstrtab section has index 2. 12# RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=ELF-SEC 13# ELF-SEC: [ 2] .shstrtab 14 15## Test we dump the section only once when the option is specified multiple times for the same section. 16# RUN: llvm-readobj -x 2 -x 2 -x .shstrtab -x .shstrtab %t 2>&1 \ 17# RUN: | FileCheck %s --check-prefix=ELF 18## Test warnings reported when an unknown section name and index are specified. 19# RUN: llvm-readobj -x 2 -x .shstrtab -x 3 -x not_exist %t 2>&1 \ 20# RUN: | FileCheck %s -DFILE=%t --check-prefixes=ELF-WARN,ELF 21 22# ELF-WARN: warning: '[[FILE]]': could not find section 'not_exist' 23# ELF-WARN: warning: '[[FILE]]': could not find section 3 24# ELF: Hex dump of section '.shstrtab': 25# ELF-NEXT: 0x00000000 002e7368 73747274 6162002e 73747274 ..shstrtab..strt 26# ELF-NEXT: 0x00000010 616200 ab. 27# ELF-NOT: {{.}} 28 29## This test shows that we include the tool name in an error/warning message. 30# RUN: llvm-readelf -x 10 %t 2>&1 | FileCheck --check-prefix=WARN %s -DTOOL=readelf 31# RUN: llvm-readobj -x 10 %t 2>&1 | FileCheck --check-prefix=WARN %s -DTOOL=readobj 32 33# WARN: llvm-[[TOOL]]{{(\.exe)?}}: warning: '{{.*}}': could not find section 10 34 35--- !ELF 36FileHeader: 37 Class: ELFCLASS32 38 Data: ELFDATA2LSB 39 Type: ET_DYN 40 41## Test that llvm-readelf emits the correct number of spaces between the hex data 42## and its ascii representation. 43 44## a) When the hex data doesn't fill a column other than the last one. 45# RUN: yaml2obj --docnum=2 -DSIZE=18 %s -o %t2.out1 46# RUN: llvm-readelf --hex-dump=.sec %t2.out1 | \ 47# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES1 48 49# SPACES1:Hex dump of section '.sec': 50# SPACES1-NEXT:0x00000000 00000000 00000000 00000000 00000000 ................ 51# SPACES1-NEXT:0x00000010 0000 .. 52 53## b) When the hex data doesn't fill the last column. 54# RUN: yaml2obj --docnum=2 -DSIZE=30 %s -o %t2.out2 55# RUN: llvm-readelf --hex-dump=.sec %t2.out2 | \ 56# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES2 57 58# SPACES2:Hex dump of section '.sec': 59# SPACES2-NEXT:0x00000000 00000000 00000000 00000000 00000000 ................ 60# SPACES2-NEXT:0x00000010 00000000 00000000 00000000 0000 .............. 61 62## c) When the hex data fills a column. 63# RUN: yaml2obj --docnum=2 -DSIZE=28 %s -o %t2.out3 64# RUN: llvm-readelf --hex-dump=.sec %t2.out3 | \ 65# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES3 66 67# SPACES3:Hex dump of section '.sec': 68# SPACES3-NEXT:0x00000000 00000000 00000000 00000000 00000000 ................ 69# SPACES3-NEXT:0x00000010 00000000 00000000 00000000 ............ 70 71--- !ELF 72FileHeader: 73 Class: ELFCLASS32 74 Data: ELFDATA2LSB 75 Type: ET_DYN 76Sections: 77 - Name: .sec 78 Type: SHT_PROGBITS 79 Size: [[SIZE]] 80