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:{{^$}} 50# SPACES1-NEXT:Hex dump of section '.sec': 51# SPACES1-NEXT:0x00000000 00000000 00000000 00000000 00000000 ................ 52# SPACES1-NEXT:0x00000010 0000 .. 53 54## b) When the hex data doesn't fill the last column. 55# RUN: yaml2obj --docnum=2 -DSIZE=30 %s -o %t2.out2 56# RUN: llvm-readelf --hex-dump=.sec %t2.out2 | \ 57# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES2 58 59# SPACES2:{{^$}} 60# SPACES2-NEXT:Hex dump of section '.sec': 61# SPACES2-NEXT:0x00000000 00000000 00000000 00000000 00000000 ................ 62# SPACES2-NEXT:0x00000010 00000000 00000000 00000000 0000 .............. 63 64## c) When the hex data fills a column. 65# RUN: yaml2obj --docnum=2 -DSIZE=28 %s -o %t2.out3 66# RUN: llvm-readelf --hex-dump=.sec %t2.out3 | \ 67# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES3 68 69# SPACES3:{{^$}} 70# SPACES3-NEXT:Hex dump of section '.sec': 71# SPACES3-NEXT:0x00000000 00000000 00000000 00000000 00000000 ................ 72# SPACES3-NEXT:0x00000010 00000000 00000000 00000000 ............ 73 74--- !ELF 75FileHeader: 76 Class: ELFCLASS32 77 Data: ELFDATA2LSB 78 Type: ET_DYN 79Sections: 80 - Name: .sec 81 Type: SHT_PROGBITS 82 Size: [[SIZE]] 83