From d970d4d4aa7345ebf8b7169b09f2775a93f86c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 9 Nov 2019 11:56:08 +0100 Subject: [lldb] [Process/NetBSD] Copy watchpoints to newly-created threads NetBSD ptrace interface does not populate watchpoints to newly-created threads. Solve this via copying the watchpoints from the current thread when new thread is reported via TRAP_LWP. Add a test that verifies that when the user does not have permissions to set watchpoints on NetBSD, the 'watchpoint set' errors out gracefully and thread monitoring does not crash on being unable to copy watchpoints to new threads. Differential Revision: https://reviews.llvm.org/D70023 --- lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c (limited to 'lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c') diff --git a/lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c b/lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c new file mode 100644 index 000000000000..14f3474789af --- /dev/null +++ b/lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c @@ -0,0 +1,23 @@ +#include + +int g_watchme = 0; + +void *thread_func(void *arg) { + /* watchpoint trigger from subthread */ + g_watchme = 2; + return 0; +} + +int main() { + pthread_t thread; + if (pthread_create(&thread, 0, thread_func, 0)) + return 1; + + /* watchpoint trigger from main thread */ + g_watchme = 1; + + if (pthread_join(thread, 0)) + return 2; + + return 0; +} -- cgit v1.2.3