1# REQUIRES: x86
2
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:   -s %S/Inputs/command-disassemble.lldbinit -o exit 2>&1 | FileCheck %s
6
7# CHECK:      (lldb) disassemble
8# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame.
9# CHECK-EMPTY:
10# CHECK-NEXT: (lldb) disassemble --line
11# CHECK-NEXT: error: Cannot disassemble around the current line without a selected frame.
12# CHECK-EMPTY:
13# CHECK-NEXT: (lldb) disassemble --frame
14# CHECK-NEXT: error: Cannot disassemble around the current function without a selected frame.
15# CHECK-EMPTY:
16# CHECK-NEXT: (lldb) disassemble --pc
17# CHECK-NEXT: error: Cannot disassemble around the current PC without a selected frame.
18# CHECK-EMPTY:
19# CHECK-NEXT: (lldb) disassemble --start-address 0x0
20# CHECK-NEXT: command-disassemble.s.tmp`foo:
21# CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>:   int    $0x10
22# CHECK-NEXT: command-disassemble.s.tmp[0x2] <+2>:   int    $0x11
23# CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>:   int    $0x12
24# CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>:   int    $0x13
25# CHECK-NEXT: command-disassemble.s.tmp[0x8] <+8>:   int    $0x14
26# CHECK-NEXT: command-disassemble.s.tmp[0xa] <+10>:  int    $0x15
27# CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>:  int    $0x16
28# CHECK-EMPTY:
29# CHECK-NEXT: command-disassemble.s.tmp`bar:
30# CHECK-NEXT: command-disassemble.s.tmp[0xe] <+0>:   int    $0x17
31# CHECK-NEXT: command-disassemble.s.tmp[0x10] <+2>:  int    $0x18
32# CHECK-NEXT: command-disassemble.s.tmp[0x12] <+4>:  int    $0x19
33# CHECK-NEXT: command-disassemble.s.tmp[0x14] <+6>:  int    $0x1a
34# CHECK-NEXT: command-disassemble.s.tmp[0x16] <+8>:  int    $0x1b
35# CHECK-NEXT: command-disassemble.s.tmp[0x18] <+10>: int    $0x1c
36# CHECK-NEXT: command-disassemble.s.tmp[0x1a] <+12>: int    $0x1d
37# CHECK-NEXT: command-disassemble.s.tmp[0x1c] <+14>: int    $0x1e
38# CHECK-NEXT: command-disassemble.s.tmp[0x1e] <+16>: int    $0x1f
39# CHECK-NEXT: (lldb) disassemble --start-address 0x4 --end-address 0x8
40# CHECK-NEXT: command-disassemble.s.tmp`foo:
41# CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>: int    $0x12
42# CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>: int    $0x13
43# CHECK-NEXT: (lldb) disassemble --start-address 0x8 --end-address 0x4
44# CHECK-NEXT: error: End address before start address.
45# CHECK-NEXT: (lldb) disassemble --address 0x0
46# CHECK-NEXT: command-disassemble.s.tmp`foo:
47# CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>:  int    $0x10
48# CHECK-NEXT: command-disassemble.s.tmp[0x2] <+2>:  int    $0x11
49# CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>:  int    $0x12
50# CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>:  int    $0x13
51# CHECK-NEXT: command-disassemble.s.tmp[0x8] <+8>:  int    $0x14
52# CHECK-NEXT: command-disassemble.s.tmp[0xa] <+10>: int    $0x15
53# CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>: int    $0x16
54# CHECK-NEXT: (lldb) disassemble --address 0xdead
55# CHECK-NEXT: error: Could not find function bounds for address 0xdead
56# CHECK-NEXT: (lldb) disassemble --start-address 0x0 --count 7
57# CHECK-NEXT: command-disassemble.s.tmp`foo:
58# CHECK-NEXT: command-disassemble.s.tmp[0x0] <+0>:  int    $0x10
59# CHECK-NEXT: command-disassemble.s.tmp[0x2] <+2>:  int    $0x11
60# CHECK-NEXT: command-disassemble.s.tmp[0x4] <+4>:  int    $0x12
61# CHECK-NEXT: command-disassemble.s.tmp[0x6] <+6>:  int    $0x13
62# CHECK-NEXT: command-disassemble.s.tmp[0x8] <+8>:  int    $0x14
63# CHECK-NEXT: command-disassemble.s.tmp[0xa] <+10>: int    $0x15
64# CHECK-NEXT: command-disassemble.s.tmp[0xc] <+12>: int    $0x16
65# CHECK-NEXT: (lldb) disassemble --start-address 0x0 --end-address 0x20 --count 7
66# CHECK-NEXT: error: invalid combination of options for the given command
67# CHECK-NEXT: (lldb) disassemble --address 0x0 --count 7
68# CHECK-NEXT: error: invalid combination of options for the given command
69
70        .text
71foo:
72        int $0x10
73        int $0x11
74        int $0x12
75        int $0x13
76        int $0x14
77        int $0x15
78        int $0x16
79bar:
80        int $0x17
81        int $0x18
82        int $0x19
83        int $0x1a
84        int $0x1b
85        int $0x1c
86        int $0x1d
87        int $0x1e
88        int $0x1f
89        int $0x20
90        int $0x21
91        int $0x22
92        int $0x23
93        int $0x24
94        int $0x25
95        int $0x26
96        int $0x27
97        int $0x28
98        int $0x29
99        int $0x2a
100        int $0x2b
101        int $0x2c
102        int $0x2d
103        int $0x2e
104        int $0x2f
105