llvm.org GIT mirror llvm / 2a774bf
[llvm-objdump] Print newlines before and after "Disassembly of section ...:" This improves readability and the behavior is consistent with GNU objdump. The new test test/tools/llvm-objdump/X86/disassemble-section-name.s checks we print newlines before and after "Disassembly of section ...:" Differential Revision: https://reviews.llvm.org/D61127 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359668 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 1 year, 5 months ago
13 changed file(s) with 50 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2929 @ ASM-NEXT: movt r0, :upper16:((foo-bar)+1234)
3030
3131 @OBJ: Disassembly of section .text:
32 @OBJ-EMPTY:
3233 @OBJ-NEXT: barf:
3334 @OBJ-NEXT: 0: f0 0f 0f e3 movw r0, #65520
3435 @OBJ-NEXT: 00000000: R_ARM_MOVW_PREL_NC GOT
4243 @OBJ-NEXT: 14: 00 00 40 e3 movt r0, #0
4344
4445 @THUMB: Disassembly of section .text:
46 @THUMB-EMPTY:
4547 @THUMB-NEXT: barf:
4648 @THUMB-NEXT: 0: 4f f6 f0 70 movw r0, #65520
4749 @THUMB-NEXT: 00000000: R_ARM_THM_MOVW_PREL_NC GOT
44
55 bar:
66 // CHECK: Disassembly of section imul:
7 // CHECK-EMPTY:
78 // CHECK-NEXT: imul:
89 // CHECK-NEXT: 0: 66 69 db 00 00 imulw $0, %bx, %bx
910 // CHECK-NEXT: 5: 66 69 1c 25 00 00 00 00 00 00 imulw $0, 0, %bx
2021 imul $foo, bar, %rbx
2122
2223 // CHECK: Disassembly of section and:
24 // CHECK-EMPTY:
2325 // CHECK-NEXT: and:
2426 // CHECK-NEXT: 0: 66 81 e3 00 00 andw $0, %bx
2527 // CHECK-NEXT: 5: 66 81 24 25 00 00 00 00 00 00 andw $0, 0
3638 andq $foo, bar
3739
3840 // CHECK: Disassembly of section or:
41 // CHECK-EMPTY:
3942 // CHECK-NEXT: or:
4043 // CHECK-NEXT: 0: 66 81 cb 00 00 orw $0, %bx
4144 // CHECK-NEXT: 5: 66 81 0c 25 00 00 00 00 00 00 orw $0, 0
5255 orq $foo, bar
5356
5457 // CHECK: Disassembly of section xor:
58 // CHECK-EMPTY:
5559 // CHECK-NEXT: xor:
5660 // CHECK-NEXT: 0: 66 81 f3 00 00 xorw $0, %bx
5761 // CHECK-NEXT: 5: 66 81 34 25 00 00 00 00 00 00 xorw $0, 0
6872 xorq $foo, bar
6973
7074 // CHECK: Disassembly of section add:
75 // CHECK-EMPTY:
7176 // CHECK-NEXT: add:
7277 // CHECK-NEXT: 0: 66 81 c3 00 00 addw $0, %bx
7378 // CHECK-NEXT: 5: 66 81 04 25 00 00 00 00 00 00 addw $0, 0
8489 addq $foo, bar
8590
8691 // CHECK: Disassembly of section sub:
92 // CHECK-EMPTY:
8793 // CHECK-NEXT: sub:
8894 // CHECK-NEXT: 0: 66 81 eb 00 00 subw $0, %bx
8995 // CHECK-NEXT: 5: 66 81 2c 25 00 00 00 00 00 00 subw $0, 0
100106 subq $foo, bar
101107
102108 // CHECK: Disassembly of section cmp:
109 // CHECK-EMPTY:
103110 // CHECK-NEXT: cmp:
104111 // CHECK-NEXT: 0: 66 81 fb 00 00 cmpw $0, %bx
105112 // CHECK-NEXT: 5: 66 81 3c 25 00 00 00 00 00 00 cmpw $0, 0
116123 cmpq $foo, bar
117124
118125 // CHECK: Disassembly of section push:
126 // CHECK-EMPTY:
119127 // CHECK-NEXT: push:
120128 // CHECK-NEXT: 0: 66 68 00 00 pushw $0
121129 // CHECK-NEXT: 4: 68 00 00 00 00 pushq $0
124132 push $foo
125133
126134 // CHECK: Disassembly of section adc:
135 // CHECK-EMPTY:
127136 // CHECK-NEXT: adc:
128137 // CHECK-NEXT: 0: 66 81 d3 00 00 adcw $0, %bx
129138 // CHECK-NEXT: 5: 66 81 14 25 00 00 00 00 00 00 adcw $0, 0
140149 adcq $foo, bar
141150
142151 // CHECK: Disassembly of section sbb:
152 // CHECK-EMPTY:
143153 // CHECK-NEXT: sbb:
144154 // CHECK-NEXT: 0: 66 81 db 00 00 sbbw $0, %bx
145155 // CHECK-NEXT: 5: 66 81 1c 25 00 00 00 00 00 00 sbbw $0, 0
44
55 bar:
66 // CHECK: Disassembly of section imul:
7 // CHECK-EMPTY:
78 // CHECK-NEXT: imul:
89 // CHECK-NEXT: 0: 66 6b db 80 imulw $-128, %bx, %bx
910 // CHECK-NEXT: 4: 66 6b 1c 25 00 00 00 00 7f imulw $127, 0, %bx
2122
2223
2324 // CHECK: Disassembly of section and:
25 // CHECK-EMPTY:
2426 // CHECK-NEXT: and:
2527 // CHECK-NEXT: 0: 66 83 e3 7f andw $127, %bx
2628 // CHECK-NEXT: 4: 66 83 24 25 00 00 00 00 00 andw $0, 0
3739 andq $-128, bar
3840
3941 // CHECK: Disassembly of section or:
42 // CHECK-EMPTY:
4043 // CHECK-NEXT: or:
4144 // CHECK-NEXT: 0: 66 83 cb 00 orw $0, %bx
4245 // CHECK-NEXT: 4: 66 83 0c 25 00 00 00 00 01 orw $1, 0
5356 orq $127, bar
5457
5558 // CHECK: Disassembly of section xor:
59 // CHECK-EMPTY:
5660 // CHECK-NEXT: xor:
5761 // CHECK-NEXT: 0: 66 83 f3 01 xorw $1, %bx
5862 // CHECK-NEXT: 4: 66 83 34 25 00 00 00 00 ff xorw $-1, 0
6973 xorq $0, bar
7074
7175 // CHECK: Disassembly of section add:
76 // CHECK-EMPTY:
7277 // CHECK-NEXT: add:
7378 // CHECK-NEXT: 0: 66 83 c3 ff addw $-1, %bx
7479 // CHECK-NEXT: 4: 66 83 04 25 00 00 00 00 2a addw $42, 0
8590 addq $1, bar
8691
8792 // CHECK: Disassembly of section sub:
93 // CHECK-EMPTY:
8894 // CHECK-NEXT: sub:
8995 // CHECK-NEXT: 0: 66 83 eb 2a subw $42, %bx
9096 // CHECK-NEXT: 4: 66 83 2c 25 00 00 00 00 80 subw $-128, 0
101107 subq $-1, bar
102108
103109 // CHECK: Disassembly of section cmp:
110 // CHECK-EMPTY:
104111 // CHECK-NEXT: cmp:
105112 // CHECK-NEXT: 0: 66 83 fb 80 cmpw $-128, %bx
106113 // CHECK-NEXT: 4: 66 83 3c 25 00 00 00 00 7f cmpw $127, 0
117124 cmpq $42, bar
118125
119126 // CHECK: Disassembly of section push:
127 // CHECK-EMPTY:
120128 // CHECK-NEXT: push:
121129 // CHECK-NEXT: 0: 66 6a 80 pushw $-128
122130 // CHECK-NEXT: 3: 66 6a 7f pushw $127
44
55 bar:
66 // CHECK: Disassembly of section imul:
7 // CHECK-EMPTY:
78 // CHECK-NEXT: imul:
89 // CHECK-NEXT: 0: 66 69 1d 00 00 00 00 00 00 imulw $0, (%rip), %bx
910 // CHECK-NEXT: 9: 69 1d 00 00 00 00 00 00 00 00 imull $0, (%rip), %ebx
1516
1617
1718 // CHECK: Disassembly of section and:
19 // CHECK-EMPTY:
1820 // CHECK-NEXT: and:
1921 // CHECK-NEXT: 0: 66 81 25 00 00 00 00 00 00 andw $0, (%rip)
2022 // CHECK-NEXT: 9: 81 25 00 00 00 00 00 00 00 00 andl $0, (%rip)
2527 andq $foo, bar(%rip)
2628
2729 // CHECK: Disassembly of section or:
30 // CHECK-EMPTY:
2831 // CHECK-NEXT: or:
2932 // CHECK-NEXT: 0: 66 81 0d 00 00 00 00 00 00 orw $0, (%rip)
3033 // CHECK-NEXT: 9: 81 0d 00 00 00 00 00 00 00 00 orl $0, (%rip)
3538 orq $foo, bar(%rip)
3639
3740 // CHECK: Disassembly of section xor:
41 // CHECK-EMPTY:
3842 // CHECK-NEXT: xor:
3943 // CHECK-NEXT: 0: 66 81 35 00 00 00 00 00 00 xorw $0, (%rip)
4044 // CHECK-NEXT: 9: 81 35 00 00 00 00 00 00 00 00 xorl $0, (%rip)
4549 xorq $foo, bar(%rip)
4650
4751 // CHECK: Disassembly of section add:
52 // CHECK-EMPTY:
4853 // CHECK-NEXT: add:
4954 // CHECK-NEXT: 0: 66 81 05 00 00 00 00 00 00 addw $0, (%rip)
5055 // CHECK-NEXT: 9: 81 05 00 00 00 00 00 00 00 00 addl $0, (%rip)
5560 addq $foo, bar(%rip)
5661
5762 // CHECK: Disassembly of section sub:
63 // CHECK-EMPTY:
5864 // CHECK-NEXT: sub:
5965 // CHECK-NEXT: 0: 66 81 2d 00 00 00 00 00 00 subw $0, (%rip)
6066 // CHECK-NEXT: 9: 81 2d 00 00 00 00 00 00 00 00 subl $0, (%rip)
6571 subq $foo, bar(%rip)
6672
6773 // CHECK: Disassembly of section cmp:
74 // CHECK-EMPTY:
6875 // CHECK-NEXT: cmp:
6976 // CHECK-NEXT: 0: 66 81 3d 00 00 00 00 00 00 cmpw $0, (%rip)
7077 // CHECK-NEXT: 9: 81 3d 00 00 00 00 00 00 00 00 cmpl $0, (%rip)
44 // relax-arith.s and relax-arith2.s.
55
66 // CHECK: Disassembly of section push8:
7 // CHECK-EMPTY:
78 // CHECK-NEXT: push8:
89 // CHECK-NEXT: 0: 66 6a 80 pushw $-128
910 // CHECK-NEXT: 3: 66 6a 7f pushw $127
1617 push $127
1718
1819 // CHECK: Disassembly of section push32:
20 // CHECK-EMPTY:
1921 // CHECK-NEXT: push32:
2022 // CHECK-NEXT: 0: 66 68 00 00 pushw $0
2123 // CHECK-NEXT: 4: 68 00 00 00 00 pushl $0
44 // This test checks that we follow these rules and can force
55 // dissasembly of zero blocks with the -z and --disassemble-zeroes options.
66
7 // NODISASM: Disassembly of section .text:
8 // NODISASM-NEXT: 0000000000000000 main:
7 // NODISASM: 0000000000000000 main:
98 // NODISASM-NEXT: 0: 00 00 addb %al, (%rax)
109 // NODISASM-NEXT: 2: 00 00 addb %al, (%rax)
1110 // NODISASM-NEXT: 4: 00 00 addb %al, (%rax)
2221 // Check that with -z we disassemble blocks of zeroes.
2322 // RUN: llvm-objdump -d -z %t | FileCheck %s --check-prefix=DISASM
2423
25 // DISASM: Disassembly of section .text:
26 // DISASM-NEXT: 0000000000000000 main:
24 // DISASM: 0000000000000000 main:
2725 // DISASM-NEXT: 0: 00 00 addb %al, (%rax)
2826 // DISASM-NEXT: 2: 00 00 addb %al, (%rax)
2927 // DISASM-NEXT: 4: 00 00 addb %al, (%rax)
22 Test that we disassemble the start of the section.
33
44 CHECK: Disassembly of section .text:
5 CHECK-EMPTY:
56 CHECK-NEXT: .text:
67 CHECK-NEXT: 0: 90 nop
78 CHECK: foo:
11 // RUN: llvm-objdump -d %t.out -disassemble-functions=main | FileCheck %s
22
33 // CHECK: Disassembly of section .anothertext:
4 // CHECK-EMPTY:
45 // CHECK-NEXT: main:
56 // CHECK-NEXT: 10: 55 pushq %rbp
67 // CHECK-NEXT: 11: 48 89 e5 movq %rsp, %rbp
1919
2020 # SKIP: 0000000000000000 .rodata:
2121 # SKIP-NEXT: ...
22 # SKIP-EMPTY:
2223 # SKIP-NEXT: Disassembly of section .rela.rodata:
2324
2425 --- !ELF
0 # RUN: yaml2obj %p/Inputs/simple-executable-x86_64.yaml -o %t
1 # RUN: llvm-objdump -d %t | FileCheck %s
2
3 # CHECK: : file format ELF64-x86-64
4 # CHECK-EMPTY:
5 # CHECK-EMPTY:
6 # CHECK-NEXT: Disassembly of section .text:
7 # CHECK-EMPTY:
8 # CHECK-NEXT: 0000000000000000 foo:
55 // RUN: FileCheck --input-file %t0 %s
66
77 CHECK: Disassembly of section .text:
8 CHECK-EMPTY:
89 CHECK-NEXT: _start:
910 CHECK-NEXT: 10: c3 retl
1011 CHECK-NEXT: SYMBOL TABLE:
33 // RUN: llvm-objdump -d %t.out --start-address=0x40 --stop-address=0x47 | FileCheck %s --check-prefix "CROSSDATA"
44
55 // CHECK: Disassembly of section .anothertext:
6 // CHECK-EMPTY:
67 // CHECK-NEXT: main:
78 // CHECK-NEXT: 18: 48 8d 04 25 a8 00 00 00 leaq 168, %rax
89 // CHECK-NEXT: 20: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
1112 // CHECK-NOT: 2f:
1213
1314 // CROSSSECTION: Disassembly of section .text:
15 // CROSSSECTION-EMPTY:
1416 // CROSSSECTION-NEXT: foo:
1517 // CROSSSECTION-NEXT: c: c3 retq
1618 // CROSSSECTION-NEXT: d: 0f 1f 00 nopl (%rax)
19 // CROSSSECTION-EMPTY:
1720 // CROSSSECTION-NEXT: Disassembly of section .anothertext:
21 // CROSSSECTION-EMPTY:
1822 // CROSSSECTION-NEXT: main:
1923 // CROSSSECTION-NEXT: 10: 55 pushq %rbp
2024 // CROSSSECTION-NOT: 11:
11631163
11641164 if (!PrintedSection) {
11651165 PrintedSection = true;
1166 outs() << "Disassembly of section ";
1166 outs() << "\nDisassembly of section ";
11671167 if (!SegmentName.empty())
11681168 outs() << SegmentName << ",";
1169 outs() << SectionName << ':';
1169 outs() << SectionName << ":\n";
11701170 }
11711171
11721172 if (Obj->isELF() && Obj->getArch() == Triple::amdgcn) {