stop-hook.test
2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# RUN: %clang_host %p/Inputs/stop-hook.c -g -o %t
# Test setting stop-hook per-function
# RUN: %lldb -b -s %p/Inputs/stop-hook-1.lldbinit -s %s -f %t \
# RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FUNC %s
# Test setting stop-hook per-line range
# RUN: %lldb -b -s %p/Inputs/stop-hook-2.lldbinit -s %s -f %t | FileCheck %s
# Test setting stop-hook with multi-line expression
# RUN: %lldb -b -s %p/Inputs/stop-hook-3.lldbinit -s %s -f %t | FileCheck %s
# This test is not "unsupported" on Windows, but it fails because "expr ptr"
# does not evaluate correctly. However, the error message contains the expected
# string, so the test "passes" despite the fact that the commands failed
# llvm.org/pr40119
# UNSUPPORTED: system-windows
break set -f stop-hook.c -p "// Set breakpoint here to test target stop-hook"
break set -f stop-hook.c -p "// Another breakpoint which is outside of the stop-hook range"
target stop-hook list
# CHECK: Hook: 1
# CHECK-NEXT: State: enabled
# CHECK-NEXT: Specifier:
# CHECK-FUNC-NEXT: Function: b.
# CHECK-NEXT: Commands:
# CHECK-NEXT: expr ptr
target stop-hook disable
target stop-hook list
# CHECK: Hook: 1
# CHECK-NEXT: State: disabled
# CHECK-NEXT: Specifier:
# CHECK-FUNC-NEXT: Function: b.
# CHECK-NEXT: Commands:
# CHECK-NEXT: expr ptr
target stop-hook enable
target stop-hook list
# CHECK: Hook: 1
# CHECK-NEXT: State: enabled
# CHECK-NEXT: Specifier:
# CHECK-FUNC-NEXT: Function: b.
# CHECK-NEXT: Commands:
# CHECK-NEXT: expr ptr
run
# Stopping inside of the stop hook range
# CHECK: (lldb) run
# CHECK-NEXT: (void *) $0 = 0x
thread step-over
# Stepping inside of the stop hook range
# CHECK: (lldb) thread step-over
# CHECK-NEXT: (void *) $1 = 0x
# CHECK: ->{{.*}} // We should stop here after stepping.
process continue
# Stopping outside of the stop hook range
# CHECK: (lldb) process continue
# CHECK-NOT: (void *)
# CHECK: ->{{.*}} // Another breakpoint which is outside of the stop-hook range.
thread step-over
# Stepping inside of the stop hook range
# CHECK: (lldb) thread step-over
# CHECK-NOT: (void *)
settings set auto-confirm true
target stop-hook delete
target stop-hook list
# CHECK: (lldb) target stop-hook list
# CHECK-NOT: Hook: 1
# CHECK: No stop hooks
# CHECK-NOT: Hook: 1