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 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# CHECK: String dump of section '.strings': 27# CHECK-NEXT: [ 0] here 28# CHECK-NEXT: [ 5] are 29# CHECK-NEXT: [ 9] some 30# CHECK-NEXT: [ e] strings 31# CHECK-EMPTY: 32# CHECK-NEXT: String dump of section '.not_null_terminated': 33# CHECK-NEXT: [ 0] no 34# CHECK-NEXT: [ 3] null{{$}} 35# CHECK-NOT: {{.}} 36 37# RUN: llvm-readobj --string-dump=does_not_exist %t 2>&1 | FileCheck -DFILE=%t %s --check-prefix=WARN1 38# RUN: llvm-readobj --string-dump=42 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=WARN2 39 40# RUN: llvm-readelf --string-dump=does_not_exist %t 2>&1 | FileCheck -DFILE=%t %s --check-prefix=WARN1 41# RUN: llvm-readelf --string-dump=42 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=WARN2 42 43# WARN1: warning: '[[FILE]]': could not find section 'does_not_exist' 44# WARN2: warning: '[[FILE]]': could not find section 42 45 46--- !ELF 47FileHeader: 48 Class: ELFCLASS64 49 Data: ELFDATA2LSB 50 Type: ET_REL 51Sections: 52 - Name: .strings 53 Type: SHT_PROGBITS 54 Content: 686572650061726500736f6d6500737472696e677300 55 - Name: .not_null_terminated 56 Type: SHT_PROGBITS 57 Content: 6e6f006e756c6c 58