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