[Lldb-commits] [lldb] [lldb] Fix flaky TestConcurrentTwoWatchpointsOneSignal (PR #221697)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 7 03:41:14 PDT 2026
https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/221697
`g_watchme` was declared right next to `g_sigusr1_count`. Hardware watchpoints round the watched address to an alignment boundary, so a watchpoint on `g_watchme` could also end up covering `g_sigusr1_count`. When the signal thread's handler touches `g_sigusr1_count` while the watchpoint threads write `g_watchme`, that overlap causes a spurious hit and lldb can attribute the stop to the wrong thread.
See llvm.org/PR35228.
Fix: align `g_watchme` and pad after it so it can't share a watchpoint's range with another global.
Assisted by Claude.
>From 347f84e86e0b63da16669cfcf7d9a49df367b55f Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Mon, 7 Sep 2026 12:36:49 +0200
Subject: [PATCH] [lldb] Isolate g_watchme in memory to fix flaky
TestConcurrentTwoWatchpointsOneSignal
---
.../API/functionalities/thread/concurrent_events/main.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lldb/test/API/functionalities/thread/concurrent_events/main.cpp b/lldb/test/API/functionalities/thread/concurrent_events/main.cpp
index 84d8c7015a796..ba4ab62d3fca9 100644
--- a/lldb/test/API/functionalities/thread/concurrent_events/main.cpp
+++ b/lldb/test/API/functionalities/thread/concurrent_events/main.cpp
@@ -19,7 +19,9 @@ typedef std::vector<pthread_t> thread_vector;
pseudo_barrier_t g_barrier;
int g_breakpoint = 0;
int g_sigusr1_count = 0;
-uint32_t g_watchme;
+
+alignas(16) uint32_t g_watchme;
+uint32_t g_watchme_padding[4];
struct action_args {
int delay;
More information about the lldb-commits
mailing list