1 // RUN: yaml2obj -o %t.out %p/Inputs/simple-executable-x86_64.yaml
2 // RUN: llvm-objdump --no-print-imm-hex -d %t.out --start-address=0x18 --stop-address=0x2f | FileCheck %s
3 // RUN: llvm-objdump --no-print-imm-hex -d %t.out --start-address=0xc --stop-address=0x11 | FileCheck %s --check-prefix CROSSSECTION
4 // RUN: llvm-objdump --no-print-imm-hex -d %t.out --start-address=0x40 --stop-address=0x47 | FileCheck %s --check-prefix CROSSDATA
5 // RUN: llvm-objdump --no-print-imm-hex -d %t.out --start-address=0x40 | FileCheck %s --check-prefix START
6 // RUN: llvm-objdump --no-print-imm-hex -d %t.out --stop-address=0x11 | FileCheck %s --check-prefix STOP
7 // RUN: llvm-objdump --no-print-imm-hex -d %t.out --start-address=0xffffffff | FileCheck %s --check-prefix OUT-OF-RANGE
9 // CHECK-NOT: Disassembly
10 // CHECK: Disassembly of section .anothertext:
12 // CHECK-NEXT: <main>:
13 // CHECK-NEXT: 18: 48 8d 04 25 a8 00 00 00 leaq 168, %rax
14 // CHECK-NEXT: 20: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
15 // CHECK-NEXT: 27: 48 89 45 f0 movq %rax, -16(%rbp)
16 // CHECK-NEXT: 2b: 48 8b 45 f0 movq -16(%rbp), %rax
19 // CROSSECTION-NOT: Disassembly
20 // CROSSSECTION: Disassembly of section .text:
21 // CROSSSECTION-EMPTY:
22 // CROSSSECTION-NEXT: <foo>:
23 // CROSSSECTION-NEXT: c: c3 retq
24 // CROSSSECTION-NEXT: d: 0f 1f 00 nopl (%rax)
25 // CROSSSECTION-EMPTY:
26 // CROSSSECTION-NEXT: Disassembly of section .anothertext:
27 // CROSSSECTION-EMPTY:
28 // CROSSSECTION-NEXT: <main>:
29 // CROSSSECTION-NEXT: 10: 55 pushq %rbp
30 // CROSSSECTION-NOT: {{.}}
32 // CROSSDATA-NOT: Disassembly
33 // CROSSDATA: Disassembly of section .anothertext:
35 // CROSSDATA: 40: 48 83 c4 20 addq $32, %rsp
36 // CROSSDATA: 44: 5d popq %rbp
37 // CROSSDATA-DAG: <somedata>:
38 // CROSSDATA-NEXT: 45: 74 65 te
39 // CROSSDATA-NOT: {{.}}
41 // START-NOT: Disassembly
42 // START: Disassembly of section .anothertext:
44 // START-NEXT: 0000000000000010 <main>:
45 // START-NEXT: 40: 48 83 c4 20 addq $32, %rsp
46 // START-NEXT: 44: 5d popq %rbp
48 // START-NEXT: 0000000000000045 <somedata>:
49 // START-NEXT: 45: 74 65 73 74 20 73 74 72 test str
50 // START-NEXT: 4d: 00 c3 ..
52 // STOP: Disassembly of section .text:
54 // STOP-NEXT: 0000000000000000 <foo>:
55 // STOP-NEXT: 0: 55 pushq %rbp
56 // STOP-NEXT: 1: 48 89 e5 movq %rsp, %rbp
57 // STOP-NEXT: 4: 8b 04 25 a8 00 00 00 movl 168, %eax
58 // STOP-NEXT: b: 5d popq %rbp
59 // STOP-NEXT: c: c3 retq
60 // STOP-NEXT: d: 0f 1f 00 nopl (%rax)
62 // STOP-NEXT: Disassembly of section .anothertext:
64 // STOP-NEXT: 0000000000000010 <main>:
65 // STOP-NEXT: 10: 55 pushq %rbp
68 // OUT-OF-RANGE-NOT: Disassembly
70 // RUN: not llvm-objdump %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG
71 // RUN: not llvm-objdump %t.out --start-address=0x40 --stop-address=0x40 2>&1 | FileCheck %s --check-prefix ERRMSG
72 // ERRMSG: start address should be less than stop address