summaryrefslogtreecommitdiffstats
path: root/lldb/lit/ExecControl/StopHook/stop-hook.test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/lit/ExecControl/StopHook/stop-hook.test')
-rw-r--r--lldb/lit/ExecControl/StopHook/stop-hook.test76
1 files changed, 76 insertions, 0 deletions
diff --git a/lldb/lit/ExecControl/StopHook/stop-hook.test b/lldb/lit/ExecControl/StopHook/stop-hook.test
new file mode 100644
index 00000000000..ca6495ef14a
--- /dev/null
+++ b/lldb/lit/ExecControl/StopHook/stop-hook.test
@@ -0,0 +1,76 @@
+# 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
+
OpenPOWER on IntegriCloud