[PATCH] D53576: [llvm-objdump] Add alias option `--full-contents` for `-s` (PR39404)

Xing via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 09:18:49 PDT 2018


Higuoxing updated this revision to Diff 170673.
Higuoxing added a comment.

add simple test


https://reviews.llvm.org/D53576

Files:
  test/tools/llvm-objdump/full-contents.test
  tools/llvm-objdump/llvm-objdump.cpp


Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp
+++ tools/llvm-objdump/llvm-objdump.cpp
@@ -116,7 +116,11 @@
              cl::aliasopt(DynamicRelocations));
 
 cl::opt<bool>
-llvm::SectionContents("s", cl::desc("Display the content of each section"));
+llvm::SectionContents("full-contents",
+  cl::desc("Display the content of each section"));
+static cl::alias
+SectionContentsShort("s", cl::desc("Alias for --full-contents"),
+             cl::aliasopt(SectionContents));
 
 cl::opt<bool>
 llvm::SymbolTable("t", cl::desc("Display the symbol table"));
Index: test/tools/llvm-objdump/full-contents.test
===================================================================
--- test/tools/llvm-objdump/full-contents.test
+++ test/tools/llvm-objdump/full-contents.test
@@ -0,0 +1,17 @@
+// This test checks that --full-contents (-s) works correctly
+// RUN: llvm-objdump --full-contents %p/Inputs/section-filter.obj
+// RUN: llvm-objdump -s %p/Inputs/section-filter.obj
+
+CHECK: Inputs/section-filter.obj:	file format ELF32-hexagon
+CHECK: 
+CHECK: Contents of section .shstrtab:
+CHECK:  0000 002e7465 7874002e 62737300 2e736873  ..text..bss..shs
+CHECK:  0010 74727461 62002e73 74727461 62002e73  trtab..strtab..s
+CHECK:  0020 796d7461 62002e64 61746100           ymtab..data.
+CHECK: Contents of section .symtab:
+CHECK:  0000 00000000 00000000 00000000 00000000  ................
+CHECK:  0010 00000000 00000000 00000000 03000100  ................
+CHECK:  0020 00000000 00000000 00000000 03000200  ................
+CHECK:  0030 00000000 00000000 00000000 03000300  ................
+CHECK: Contents of section .strtab:
+CHECK:  0000 00                                   .


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53576.170673.patch
Type: text/x-patch
Size: 1782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181023/d9444ee6/attachment.bin>


More information about the llvm-commits mailing list