[Lldb-commits] [lldb] [lldb] Fix flaky TestConcurrentTwoWatchpointsOneSignal (PR #221697)

via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 7 03:41:49 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

`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.

---
Full diff: https://github.com/llvm/llvm-project/pull/221697.diff


1 Files Affected:

- (modified) lldb/test/API/functionalities/thread/concurrent_events/main.cpp (+3-1) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/221697


More information about the lldb-commits mailing list