diff options
Diffstat (limited to 'lit/ExecControl/StopHook')
9 files changed, 0 insertions, 255 deletions
diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit deleted file mode 100644 index 4ab5d56f0364..000000000000 --- a/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit +++ /dev/null @@ -1 +0,0 @@ -target stop-hook add -n b -o "expr ptr" diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit deleted file mode 100644 index 906c18b004df..000000000000 --- a/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit +++ /dev/null @@ -1 +0,0 @@ -target stop-hook add -f stop-hook.c -l 30 -e 34 -o "expr ptr"
\ No newline at end of file diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit deleted file mode 100644 index 98ed59ca46b2..000000000000 --- a/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit +++ /dev/null @@ -1,3 +0,0 @@ -target stop-hook add -f stop-hook.c -l 30 -e 34 -expr ptr -DONE
\ No newline at end of file diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit deleted file mode 100644 index f192d9952e97..000000000000 --- a/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit +++ /dev/null @@ -1,7 +0,0 @@ -break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook" -run -target stop-hook add -frame variable --show-globals g_val -thread list -continue -DONE diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit b/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit deleted file mode 100644 index 467f60b1e1e0..000000000000 --- a/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit +++ /dev/null @@ -1,4 +0,0 @@ -break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook" -run -target stop-hook add -x 2 -o "frame variable thread_index" -target stop-hook add -o continue diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp b/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp deleted file mode 100644 index dab133d9d952..000000000000 --- a/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <chrono> -#include <cstdio> -#include <mutex> -#include <random> -#include <thread> - -std::default_random_engine g_random_engine{std::random_device{}()}; -std::uniform_int_distribution<> g_distribution{0, 3000}; - -uint32_t g_val = 0; - -uint32_t -access_pool (bool flag = false) -{ - static std::mutex g_access_mutex; - if (!flag) - g_access_mutex.lock(); - - uint32_t old_val = g_val; - if (flag) - g_val = old_val + 1; - - if (!flag) - g_access_mutex.unlock(); - return g_val; -} - -void -thread_func (uint32_t thread_index) -{ - // Break here to test that the stop-hook mechanism works for multiple threads. - printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index); - - uint32_t count = 0; - uint32_t val; - while (count++ < 4) - { - // random micro second sleep from zero to .3 seconds - int usec = g_distribution(g_random_engine); - printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec); - std::this_thread::sleep_for(std::chrono::microseconds{usec}); // Set break point at this line - - if (count < 2) - val = access_pool (); - else - val = access_pool (true); - - printf ("%s (thread = %u) after usleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count); - } - printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index); -} - - -int main (int argc, char const *argv[]) -{ - std::thread threads[3]; - - // Create 3 threads - for (auto &thread : threads) - thread = std::thread{thread_func, std::distance(threads, &thread)}; - - // Join all of our threads - for (auto &thread : threads) - thread.join(); - - return 0; -} diff --git a/lit/ExecControl/StopHook/Inputs/stop-hook.c b/lit/ExecControl/StopHook/Inputs/stop-hook.c deleted file mode 100644 index c10c1e5ef0d2..000000000000 --- a/lit/ExecControl/StopHook/Inputs/stop-hook.c +++ /dev/null @@ -1,54 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#include <stdio.h> -#include <stdlib.h> - -int a(int); -int b(int); -int c(int); - -int a(int val) -{ - if (val <= 1) - return b(val); - else if (val >= 3) - return c(val); - - return val; -} - -int b(int val) -{ - int rc = c(val); - void *ptr = malloc(1024); - if (!ptr) // Set breakpoint here to test target stop-hook. - return -1; - else - printf("ptr=%p\n", ptr); // We should stop here after stepping. - return rc; // End of the line range for which stop-hook is to be run. -} - -int c(int val) -{ - return val + 3; -} - -int main (int argc, char const *argv[]) -{ - int A1 = a(1); - printf("a(1) returns %d\n", A1); - - int C2 = c(2); // Another breakpoint which is outside of the stop-hook range. - printf("c(2) returns %d\n", C2); - - int A3 = a(3); - printf("a(3) returns %d\n", A3); - - return 0; -} diff --git a/lit/ExecControl/StopHook/stop-hook-threads.test b/lit/ExecControl/StopHook/stop-hook-threads.test deleted file mode 100644 index aa6b668340c7..000000000000 --- a/lit/ExecControl/StopHook/stop-hook-threads.test +++ /dev/null @@ -1,33 +0,0 @@ -# RUN: %clangxx %p/Inputs/stop-hook-threads.cpp -g -o %t -# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \ -# RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s -# RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \ -# RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FILTER %s -# XFAIL: system-windows - -thread list -break set -f stop-hook-threads.cpp -p "Set break point at this line" -target stop-hook list - -# CHECK: Hook: 1 -# CHECK-NEXT: State: enabled -# CHECK-FILTER-NEXT: Thread -# CHECK-FILTER-NEXT: index: 2 -# CHECK-NEXT: Commands: -# CHECK-NEXT: frame variable - -# CHECK-FILTER: Hook: 2 -# CHECK-FILTER-NEXT: State: enabled -# CHECK-FILTER-NEXT: Commands: -# CHECK-FILTER-NEXT: continue - -# Get the threads going -continue - -# When we filter per thread, we expect exactly 4 identical "frame var" results -# CHECK-FILTER: (uint32_t) thread_index = [[THREAD_INDEX:[0-9]*]] -# CHECK-FILTER-COUNT-3: (uint32_t) thread_index = [[THREAD_INDEX]] -# CHECK-FILTER-NOT: thread_index - -# When we don't filter, we expect to count 12 stopped threads in the thread list output -# CHECK-NO-FILTER-COUNT-12: at stop-hook-threads.cpp{{.*}} stop reason = breakpoint
\ No newline at end of file diff --git a/lit/ExecControl/StopHook/stop-hook.test b/lit/ExecControl/StopHook/stop-hook.test deleted file mode 100644 index ca6495ef14ad..000000000000 --- a/lit/ExecControl/StopHook/stop-hook.test +++ /dev/null @@ -1,76 +0,0 @@ -# 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 - |