1# Check the dumping of a section as strings. 2# RUN: yaml2obj %s -o %t 3 4# RUN: llvm-readobj --string-dump=.strings \ 5# RUN: --string-dump=.not_null_terminated %t > %t.readobj.out 6# RUN: FileCheck %s --input-file=%t.readobj.out --check-prefixes=HEADER,CHECK 7 8# Also test the different ways --string-dump can be specified, i.e. as a short 9# flag (-p), with different prefix modes (-p .foo, -p=.foo, -p.foo), and with 10# 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 test 16# -p grouped with something. 17# RUN: llvm-readelf --file-header --string-dump=.strings \ 18# RUN: --string-dump=.not_null_terminated %t > %t.readelf.out 19# RUN: FileCheck %s --input-file=%t.readelf.out 20 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] here 30# CHECK-NEXT: [ 5] are 31# CHECK-NEXT: [ 9] some 32# CHECK-NEXT: [ e] strings 33# CHECK-EMPTY: 34# CHECK-NEXT: String dump of section '.not_null_terminated': 35# CHECK-NEXT: [ 0] no 36# 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=WARN1 40# RUN: llvm-readobj --string-dump=42 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=WARN2 41 42# RUN: llvm-readelf --string-dump=does_not_exist %t 2>&1 | FileCheck -DFILE=%t %s --check-prefix=WARN1 43# RUN: llvm-readelf --string-dump=42 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=WARN2 44 45# WARN1: warning: '[[FILE]]': could not find section 'does_not_exist' 46# WARN2: warning: '[[FILE]]': could not find section 42 47 48--- !ELF 49FileHeader: 50 Class: ELFCLASS64 51 Data: ELFDATA2LSB 52 Type: ET_REL 53Sections: 54 - Name: .strings 55 Type: SHT_PROGBITS 56 Content: 686572650061726500736f6d6500737472696e677300 57 - Name: .not_null_terminated 58 Type: SHT_PROGBITS 59 Content: 6e6f006e756c6c 60