Files
archived-llvm-mirror/test/tools/llvm-readobj/string-dump.test
James Henderson 2ee55aaff5 [llvm-readobj]Add additional testing for various ELF features
This patch adds testing of areas of the code that are not fully tested,
in particular dynamic table printing, ELF type printing, handling of
edge cases where things are missing/empty (relocations/program header
tables/section header table), and the --string-dump switch.

Reviewed by: grimar, higuoxing, rupprecht

Differential Revision: https://reviews.llvm.org/D58677

llvm-svn: 355003
2019-02-27 16:41:59 +00:00

43 lines
1.5 KiB
Plaintext

# Check the dumping of a section as strings.
# RUN: yaml2obj %s > %t
# RUN: llvm-readobj --string-dump=.strings --string-dump=.not_null_terminated %t | FileCheck %s
# RUN: llvm-readobj -p=.strings -p=.not_null_terminated %t | FileCheck %s
# RUN: llvm-readobj --string-dump=1 --string-dump=2 %t | FileCheck %s
# RUN: llvm-readelf --string-dump=.strings --string-dump=.not_null_terminated %t | FileCheck %s
# RUN: llvm-readelf -p=.strings -p=.not_null_terminated %t | FileCheck %s
# RUN: llvm-readelf --string-dump=1 --string-dump=2 %t | FileCheck %s
# CHECK: String dump of section '.strings':
# CHECK-NEXT: [ 0] here
# CHECK-NEXT: [ 5] are
# CHECK-NEXT: [ 9] some
# CHECK-NEXT: [ e] strings
# CHECK-NEXT: String dump of section '.not_null_terminated':
# CHECK-NEXT: [ 0] no
# CHECK-NEXT: [ 3] null{{$}}
# CHECK-NOT: {{.}}
# RUN: not llvm-readobj --string-dump=does_not_exist %t 2>&1 | FileCheck %s --check-prefix=ERR
# RUN: not llvm-readobj --string-dump=42 %t 2>&1 | FileCheck %s --check-prefix=ERR
# RUN: not llvm-readelf --string-dump=does_not_exist %t 2>&1 | FileCheck %s --check-prefix=ERR
# RUN: not llvm-readelf --string-dump=42 %t 2>&1 | FileCheck %s --check-prefix=ERR
# ERR: Error reading file: invalid section reference.
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .strings
Type: SHT_PROGBITS
Content: 686572650061726500736f6d6500737472696e677300
- Name: .not_null_terminated
Type: SHT_PROGBITS
Content: 6e6f006e756c6c