forked from OSchip/llvm-project
[llvm-readelf] Allow prefix flags for -p and -x
Summary: This allows syntax like `llvm-readelf -p.data1 -x.data2`. Reviewers: jhenderson Reviewed By: jhenderson Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59965 llvm-svn: 357270
This commit is contained in:
parent
8048fe2b8c
commit
342aaa14b1
|
@ -3,3 +3,30 @@ RUN: llvm-readobj -x .text %p/../../Object/Inputs/hello-world.elf-x86-64 | FileC
|
|||
|
||||
CHECK: Hex dump of section '.text':
|
||||
CHECK-NEXT: {{^}}0x00400460
|
||||
|
||||
// Test that the -x alias can be used flexibly. Create a baseline and ensure
|
||||
// all other combinations are identical.
|
||||
RUN: llvm-readelf --file-header --hex-dump=.text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.out
|
||||
RUN: llvm-readelf -h --hex-dump .text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.1
|
||||
RUN: llvm-readelf -h -x .text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.2
|
||||
RUN: llvm-readelf -h -x=.text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.3
|
||||
RUN: llvm-readelf -h -x.text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.4
|
||||
RUN: llvm-readelf -hx .text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.5
|
||||
RUN: llvm-readelf -hx=.text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.6
|
||||
RUN: llvm-readelf -hx.text \
|
||||
RUN: %p/../../Object/Inputs/hello-world.elf-x86-64 > %t.hexdump.7
|
||||
|
||||
RUN: cmp %t.hexdump.out %t.hexdump.1
|
||||
RUN: cmp %t.hexdump.out %t.hexdump.2
|
||||
RUN: cmp %t.hexdump.out %t.hexdump.3
|
||||
RUN: cmp %t.hexdump.out %t.hexdump.4
|
||||
RUN: cmp %t.hexdump.out %t.hexdump.5
|
||||
RUN: cmp %t.hexdump.out %t.hexdump.6
|
||||
RUN: cmp %t.hexdump.out %t.hexdump.7
|
||||
|
|
|
@ -1,13 +1,44 @@
|
|||
# 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-readobj --string-dump=.strings \
|
||||
# RUN: --string-dump=.not_null_terminated %t > %t.readobj.out
|
||||
# RUN: FileCheck %s --input-file=%t.readobj.out
|
||||
|
||||
# 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
|
||||
# Also test the different ways --string-dump can be specified, i.e. as a short
|
||||
# flag (-p), with different prefix modes (-p .foo, -p=.foo, -p.foo), and with
|
||||
# the value being a index section number instead of a section name.
|
||||
# RUN: llvm-readobj -p=.strings -p=.not_null_terminated %t > %t.readobj.1
|
||||
# RUN: llvm-readobj -p.strings -p.not_null_terminated %t > %t.readobj.2
|
||||
# RUN: llvm-readobj --string-dump=1 --string-dump=2 %t > %t.readobj.3
|
||||
# RUN: llvm-readobj -p1 -p2 %t > %t.readobj.4
|
||||
# RUN: llvm-readobj -p=1 -p=2 %t > %t.readobj.5
|
||||
|
||||
# RUN: cmp %t.readobj.out %t.readobj.1
|
||||
# RUN: cmp %t.readobj.out %t.readobj.2
|
||||
# RUN: cmp %t.readobj.out %t.readobj.3
|
||||
# RUN: cmp %t.readobj.out %t.readobj.4
|
||||
# RUN: cmp %t.readobj.out %t.readobj.5
|
||||
|
||||
# Run readelf flag tests with an additional flag, --file-header, so we can test
|
||||
# -p grouped with something.
|
||||
# RUN: llvm-readelf --file-header --string-dump=.strings \
|
||||
# RUN: --string-dump=.not_null_terminated %t > %t.readelf.out
|
||||
# RUN: FileCheck %s --input-file=%t.readelf.out
|
||||
|
||||
# RUN: llvm-readelf -h -p=.strings -p=.not_null_terminated %t > %t.readelf.1
|
||||
# RUN: llvm-readelf -p.strings -hp.not_null_terminated %t > %t.readelf.2
|
||||
# RUN: llvm-readelf -h --string-dump=1 --string-dump=2 %t > %t.readelf.3
|
||||
# RUN: llvm-readelf -hp1 -p2 %t > %t.readelf.4
|
||||
# RUN: llvm-readelf -hp 1 -p.not_null_terminated %t > %t.readelf.5
|
||||
# RUN: llvm-readelf -p=1 -hp=2 %t > %t.readelf.6
|
||||
|
||||
# RUN: cmp %t.readelf.out %t.readelf.1
|
||||
# RUN: cmp %t.readelf.out %t.readelf.2
|
||||
# RUN: cmp %t.readelf.out %t.readelf.3
|
||||
# RUN: cmp %t.readelf.out %t.readelf.4
|
||||
# RUN: cmp %t.readelf.out %t.readelf.5
|
||||
# RUN: cmp %t.readelf.out %t.readelf.6
|
||||
|
||||
# CHECK: String dump of section '.strings':
|
||||
# CHECK-NEXT: [ 0] here
|
||||
|
|
|
@ -180,13 +180,13 @@ namespace opts {
|
|||
cl::list<std::string> StringDump("string-dump", cl::desc("<number|name>"),
|
||||
cl::ZeroOrMore);
|
||||
cl::alias StringDumpShort("p", cl::desc("Alias for --string-dump"),
|
||||
cl::aliasopt(StringDump));
|
||||
cl::aliasopt(StringDump), cl::Prefix);
|
||||
|
||||
// -hex-dump, -x
|
||||
cl::list<std::string> HexDump("hex-dump", cl::desc("<number|name>"),
|
||||
cl::ZeroOrMore);
|
||||
cl::alias HexDumpShort("x", cl::desc("Alias for --hex-dump"),
|
||||
cl::aliasopt(HexDump));
|
||||
cl::aliasopt(HexDump), cl::Prefix);
|
||||
|
||||
// -demangle, -C
|
||||
cl::opt<bool> Demangle("demangle",
|
||||
|
|
Loading…
Reference in New Issue