1# RUN: %clangxx_host -std=c++11 %p/Inputs/stop-hook-threads.cpp -g -o %t
2# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \
3# RUN:     | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s
4# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \
5# RUN:     | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FILTER %s
6# XFAIL: system-netbsd
7# UNSUPPORTED: system-windows
8# This test is flakey and hangs on windows periodically: llvm.org/pr38373
9# UNSUPPORTED: system-linux, system-darwin
10
11thread list
12break set -f stop-hook-threads.cpp -p "Set break point at this line"
13target stop-hook list
14
15# CHECK: Hook: 1
16# CHECK-NEXT:  State: enabled
17# CHECK-NO-FILTER-NEXT: AutoContinue on
18# CHECK-FILTER-NEXT:  Thread
19# CHECK-FILTER-NEXT:  index: 2
20# CHECK-NEXT:  Commands:
21# CHECK-NEXT:    expr lldb_val += 1
22# CHECK-NEXT:    thread list
23
24# CHECK-FILTER: Hook: 2
25# CHECK-FILTER-NEXT:  State: enabled
26# CHECK-FILTER-NEXT:  AutoContinue on
27# CHECK-FILTER-NEXT:  Commands:
28# CHECK-FILTER-NEXT:    script print('Hit stop hook')
29
30# Get the threads going
31continue
32
33# Now make sure we hit the command the right number of times:
34# CHECK-NO-FILTER: lldb_val was set to: 15.
35# CHECK-FILTER: lldb_val was set to: 5.
36