[PATCH] D62054: [llvm-objdump] Make --disassemble-functions imply -d

Mike Pozulp via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 23:39:07 PDT 2019


mmpozulp created this revision.
mmpozulp added a reviewer: jhenderson.
Herald added subscribers: llvm-commits, rupprecht.
Herald added a project: LLVM.

Fixes https://bugs.llvm.org/show_bug.cgi?id=41903


Repository:
  rL LLVM

https://reviews.llvm.org/D62054

Files:
  llvm/test/tools/llvm-objdump/X86/disassemble-implied-by-disassemble-functions.test
  llvm/tools/llvm-objdump/llvm-objdump.cpp


Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2035,7 +2035,8 @@
     ArchiveHeaders = FileHeaders = PrivateHeaders = Relocations =
         SectionHeaders = SymbolTable = true;
 
-  if (DisassembleAll || PrintSource || PrintLines)
+  if (DisassembleAll || PrintSource || PrintLines ||
+      (!DisassembleFunctions.empty()))
     Disassemble = true;
 
   if (!ArchiveHeaders && !Disassemble && DwarfDumpType == DIDT_Null &&
Index: llvm/test/tools/llvm-objdump/X86/disassemble-implied-by-disassemble-functions.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/X86/disassemble-implied-by-disassemble-functions.test
@@ -0,0 +1,46 @@
+## Check that --disassemble-functions implies --disassemble
+# RUN: yaml2obj < %s | llvm-objdump - --disassemble-functions=add1,main | FileCheck %s
+
+--- !ELF
+FileHeader:      
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_REL
+  Machine:         EM_X86_64
+Sections:        
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:    0x0000000000000010
+    Content:         8D4701C3662E0F1F84000000000066908D4701C3
+Symbols:         
+  - Name:            .text
+    Type:            STT_SECTION
+    Section:         .text
+  - Name:            add1
+    Type:            STT_FUNC
+    Section:         .text
+    Binding:         STB_GLOBAL
+    Size:            0x0000000000000004
+  - Name:            main
+    Type:            STT_FUNC
+    Section:         .text
+    Binding:         STB_GLOBAL
+    Value:           0x0000000000000010
+    Size:            0x0000000000000004
+...
+
+# CHECK: <stdin>:    file format ELF64-x86-64
+
+
+# CHECK: Disassembly of section .text:
+
+# CHECK: 0000000000000000 add1:
+# CHECK:        0: 8d 47 01                      leal    1(%rdi), %eax
+# CHECK:        3: c3                            retq
+# CHECK:        4: 66 2e 0f 1f 84 00 00 00 00 00 nopw    %cs:(%rax,%rax)
+# CHECK:        e: 66 90                         nop
+
+# CHECK: 0000000000000010 main:
+# CHECK:       10: 8d 47 01                      leal    1(%rdi), %eax
+# CHECK:       13: c3


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62054.199981.patch
Type: text/x-patch
Size: 2389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/a0122d0e/attachment.bin>


More information about the llvm-commits mailing list