brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 71212de Raw
83 lines · plain
1## Test that the -x alias can be used flexibly. Create a baseline and ensure2## all other combinations are identical.3# RUN: yaml2obj --docnum=1 %s -o %t4# RUN: llvm-readelf --file-header --hex-dump=.shstrtab %t > %t.hexdump.out5# 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-SEC13# ELF-SEC: [ 2] .shstrtab14 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=ELF18## 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,ELF21 22# ELF-WARN: warning: '[[FILE]]': could not find section 'not_exist'23# ELF-WARN: warning: '[[FILE]]': could not find section 324# ELF:      Hex dump of section '.shstrtab':25# ELF-NEXT: 0x00000000 002e7368 73747274 6162002e 73747274 ..shstrtab..strt26# 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=readelf31# RUN: llvm-readobj -x 10 %t 2>&1 | FileCheck --check-prefix=WARN %s -DTOOL=readobj32 33# WARN: llvm-[[TOOL]]{{(\.exe)?}}: warning: '{{.*}}': could not find section 1034 35--- !ELF36FileHeader:37  Class: ELFCLASS3238  Data:  ELFDATA2LSB39  Type:  ET_DYN40 41## Test that llvm-readelf emits the correct number of spaces between the hex data42## 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.out146# RUN: llvm-readelf --hex-dump=.sec %t2.out1 | \47# RUN:   FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES148 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.out256# RUN: llvm-readelf --hex-dump=.sec %t2.out2 | \57# RUN:   FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES258 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.out366# RUN: llvm-readelf --hex-dump=.sec %t2.out3 | \67# RUN:   FileCheck %s --match-full-lines --strict-whitespace --check-prefix=SPACES368 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--- !ELF75FileHeader:76  Class: ELFCLASS3277  Data:  ELFDATA2LSB78  Type:  ET_DYN79Sections:80  - Name: .sec81    Type: SHT_PROGBITS82    Size: [[SIZE]]83