File: stop-hook.test

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (76 lines) | stat: -rw-r--r-- 2,303 bytes parent folder | download | duplicates (22)
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 *) ${{.*}} = 0x

thread step-over
# Stepping inside of the stop hook range
# CHECK: (lldb) thread step-over
# CHECK-NEXT: (void *) ${{.*}} = 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