3 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux %s -o %t
4 # RUN: %lldb %t -o "settings set interpreter.stop-command-source-on-error false" \
5 # RUN: -o "settings set stop-disassembly-max-size 8000" \
6 # RUN: -s %S/Inputs/command-disassemble.lldbinit -o exit 2>&1 | FileCheck %s
8 # CHECK: (lldb) disassemble
9 # CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame: no currently running process.
10 # CHECK-NEXT: (lldb) disassemble --line
11 # CHECK-NEXT: error: Cannot disassemble around the current line without a selected frame: no currently running process.
12 # CHECK-NEXT: (lldb) disassemble --frame
13 # CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame: no currently running process.
14 # CHECK-NEXT: (lldb) disassemble --pc
15 # CHECK-NEXT: error: Cannot disassemble around the current PC without a selected frame: no currently running process.
16 # CHECK-NEXT: (lldb) disassemble --start-address 0x0
17 # CHECK-NEXT: command-disassemble.s.tmp`foo:
18 # CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>: int $0x10
19 # CHECK-NEXT: command-disassemble.s.tmp[0x2] <+2>: int $0x11
20 # CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>: int $0x12
21 # CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>: int $0x13
22 # CHECK-NEXT: command-disassemble.s.tmp[0x8] <+8>: int $0x14
23 # CHECK-NEXT: command-disassemble.s.tmp[0xa] <+10>: int $0x15
24 # CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>: int $0x16
26 # CHECK-NEXT: command-disassemble.s.tmp`bar:
27 # CHECK-NEXT: command-disassemble.s.tmp[0xe] <+0>: int $0x17
28 # CHECK-NEXT: command-disassemble.s.tmp[0x10] <+2>: int $0x18
29 # CHECK-NEXT: command-disassemble.s.tmp[0x12] <+4>: int $0x19
30 # CHECK-NEXT: command-disassemble.s.tmp[0x14] <+6>: int $0x1a
31 # CHECK-NEXT: command-disassemble.s.tmp[0x16] <+8>: int $0x1b
32 # CHECK-NEXT: command-disassemble.s.tmp[0x18] <+10>: int $0x1c
33 # CHECK-NEXT: command-disassemble.s.tmp[0x1a] <+12>: int $0x1d
34 # CHECK-NEXT: command-disassemble.s.tmp[0x1c] <+14>: int $0x1e
35 # CHECK-NEXT: command-disassemble.s.tmp[0x1e] <+16>: int $0x1f
36 # CHECK-NEXT: (lldb) disassemble --start-address 0x4 --end-address 0x8
37 # CHECK-NEXT: command-disassemble.s.tmp`foo:
38 # CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>: int $0x12
39 # CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>: int $0x13
40 # CHECK-NEXT: (lldb) disassemble --start-address 0x8 --end-address 0x4
41 # CHECK-NEXT: error: End address before start address.
42 # CHECK-NEXT: (lldb) disassemble --address 0x0
43 # CHECK-NEXT: command-disassemble.s.tmp`foo:
44 # CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>: int $0x10
45 # CHECK-NEXT: command-disassemble.s.tmp[0x2] <+2>: int $0x11
46 # CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>: int $0x12
47 # CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>: int $0x13
48 # CHECK-NEXT: command-disassemble.s.tmp[0x8] <+8>: int $0x14
49 # CHECK-NEXT: command-disassemble.s.tmp[0xa] <+10>: int $0x15
50 # CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>: int $0x16
51 # CHECK-NEXT: (lldb) disassemble --address 0xdeadb
52 # CHECK-NEXT: error: Could not find function bounds for address 0xdeadb
53 # CHECK-NEXT: (lldb) disassemble --address 0x100
54 # CHECK-NEXT: error: Not disassembling the function because it is very large [0x0000000000000040-0x0000000000002040). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
55 # CHECK-NEXT: (lldb) disassemble --address 0x100 --count 3
56 # CHECK-NEXT: command-disassemble.s.tmp`very_long:
57 # CHECK-NEXT: command-disassemble.s.tmp[0x40] <+0>: int $0x2a
58 # CHECK-NEXT: command-disassemble.s.tmp[0x42] <+2>: int $0x2a
59 # CHECK-NEXT: command-disassemble.s.tmp[0x44] <+4>: int $0x2a
60 # CHECK-NEXT: (lldb) disassemble --address 0x100 --force
61 # CHECK-NEXT: command-disassemble.s.tmp`very_long:
62 # CHECK-NEXT: command-disassemble.s.tmp[0x40] <+0>: int $0x2a
63 # CHECK: command-disassemble.s.tmp[0x203e] <+8190>: int $0x2a
64 # CHECK-NEXT: (lldb) disassemble --start-address 0x0 --count 7
65 # CHECK-NEXT: command-disassemble.s.tmp`foo:
66 # CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>: int $0x10
67 # CHECK-NEXT: command-disassemble.s.tmp[0x2] <+2>: int $0x11
68 # CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>: int $0x12
69 # CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>: int $0x13
70 # CHECK-NEXT: command-disassemble.s.tmp[0x8] <+8>: int $0x14
71 # CHECK-NEXT: command-disassemble.s.tmp[0xa] <+10>: int $0x15
72 # CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>: int $0x16
73 # CHECK-NEXT: (lldb) disassemble --start-address 0x0 --end-address 0x20 --count 7
74 # CHECK-NEXT: error: invalid combination of options for the given command
75 # CHECK-NEXT: (lldb) disassemble --name case1
76 # CHECK-NEXT: command-disassemble.s.tmp`n1::case1:
77 # CHECK-NEXT: command-disassemble.s.tmp[0x2040] <+0>: int $0x30
79 # CHECK-NEXT: command-disassemble.s.tmp`n2::case1:
80 # CHECK-NEXT: command-disassemble.s.tmp[0x2042] <+0>: int $0x31
82 # CHECK-NEXT: (lldb) disassemble --name case2
83 # CHECK-NEXT: command-disassemble.s.tmp`n1::case2:
84 # CHECK-NEXT: command-disassemble.s.tmp[0x2044] <+0>: int $0x32
85 # CHECK-NEXT: warning: Not disassembling a range because it is very large [0x0000000000002046-0x0000000000004046). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
86 # CHECK-NEXT: (lldb) disassemble --name case3
87 # CHECK-NEXT: error: Not disassembling a range because it is very large [0x0000000000004046-0x0000000000006046). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
88 # CHECK-NEXT: Not disassembling a range because it is very large [0x0000000000006046-0x0000000000008046). To disassemble specify an instruction count limit, start/stop addresses or use the --force option.
89 # CHECK-NEXT: (lldb) disassemble --name case3 --count 3
90 # CHECK-NEXT: command-disassemble.s.tmp`n1::case3:
91 # CHECK-NEXT: command-disassemble.s.tmp[0x4046] <+0>: int $0x2a
92 # CHECK-NEXT: command-disassemble.s.tmp[0x4048] <+2>: int $0x2a
93 # CHECK-NEXT: command-disassemble.s.tmp[0x404a] <+4>: int $0x2a
95 # CHECK-NEXT: command-disassemble.s.tmp`n2::case3:
96 # CHECK-NEXT: command-disassemble.s.tmp[0x6046] <+0>: int $0x2a
97 # CHECK-NEXT: command-disassemble.s.tmp[0x6048] <+2>: int $0x2a
98 # CHECK-NEXT: command-disassemble.s.tmp[0x604a] <+4>: int $0x2a