60 lines · plain
1# Check the dumping of a section as strings.2# RUN: yaml2obj %s -o %t3 4# RUN: llvm-readobj --string-dump=.strings \5# RUN: --string-dump=.not_null_terminated %t > %t.readobj.out6# RUN: FileCheck %s --input-file=%t.readobj.out --check-prefixes=HEADER,CHECK7 8# Also test the different ways --string-dump can be specified, i.e. as a short9# flag (-p), with different prefix modes (-p .foo, -p=.foo, -p.foo), and with10# the value being a index section number instead of a section name.11# RUN: llvm-readobj -p.strings -p.strings -p.not_null_terminated %t | cmp %t.readobj.out -12# RUN: llvm-readobj --string-dump=1 --string-dump=2 %t | cmp %t.readobj.out -13# RUN: llvm-readobj -p1 -p1 -p2 %t | cmp %t.readobj.out -14 15# Run readelf flag tests with an additional flag, --file-header, so we can test16# -p grouped with something.17# RUN: llvm-readelf --file-header --string-dump=.strings \18# RUN: --string-dump=.not_null_terminated %t > %t.readelf.out19# RUN: FileCheck %s --input-file=%t.readelf.out20 21# RUN: llvm-readelf -h -p .strings -p .not_null_terminated %t | cmp %t.readelf.out -22# RUN: llvm-readelf -p.strings -hp.not_null_terminated %t | cmp %t.readelf.out -23# RUN: llvm-readelf -hp1 -p2 %t | cmp %t.readelf.out -24# RUN: llvm-readelf -hp 1 -p.not_null_terminated %t | cmp %t.readelf.out -25 26# HEADER: LoadName:27# CHECK: {{^$}}28# CHECK-NEXT: String dump of section '.strings':29# CHECK-NEXT: [ 0] here30# CHECK-NEXT: [ 5] are31# CHECK-NEXT: [ 9] some32# CHECK-NEXT: [ e] strings33# CHECK-EMPTY:34# CHECK-NEXT: String dump of section '.not_null_terminated':35# CHECK-NEXT: [ 0] no36# CHECK-NEXT: [ 3] null{{$}}37# CHECK-NOT: {{.}}38 39# RUN: llvm-readobj --string-dump=does_not_exist %t 2>&1 | FileCheck -DFILE=%t %s --check-prefix=WARN140# RUN: llvm-readobj --string-dump=42 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=WARN241 42# RUN: llvm-readelf --string-dump=does_not_exist %t 2>&1 | FileCheck -DFILE=%t %s --check-prefix=WARN143# RUN: llvm-readelf --string-dump=42 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=WARN244 45# WARN1: warning: '[[FILE]]': could not find section 'does_not_exist'46# WARN2: warning: '[[FILE]]': could not find section 4247 48--- !ELF49FileHeader:50 Class: ELFCLASS6451 Data: ELFDATA2LSB52 Type: ET_REL53Sections:54 - Name: .strings55 Type: SHT_PROGBITS56 Content: 686572650061726500736f6d6500737472696e67730057 - Name: .not_null_terminated58 Type: SHT_PROGBITS59 Content: 6e6f006e756c6c60