blob: ca6495ef14ad0bc8fef80e7653056d7ab1467c7f [file] [log] [blame]
# RUN: %clang %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