[Lldb-commits] [lldb] [LLDB][Windows] Fix watchpoints for Windows (PR #95446)

Aleksandr Korepanov via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 13 10:56:54 PDT 2024


https://github.com/AlexK0 created https://github.com/llvm/llvm-project/pull/95446

Hello!

Currently, watchpoints don't work on Windows (this can be reproduced with the existing tests). This patch fixes the related issues so that the tests and watchpoints start working.

Here is the list of tests that are fixed by this patch (on Windows, checked in **release/18.x** branch):
- commands/watchpoints/hello_watchpoint/TestMyFirstWatchpoint.py
- commands/watchpoints/multiple_hits/TestMultipleHits.py
- commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
- commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py
- commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py
- commands/watchpoints/watchpoint_commands/TestWatchpointCommands.py
- commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandLLDB.py
- commands/watchpoints/watchpoint_commands/command/TestWatchpointCommandPython.py
- commands/watchpoints/watchpoint_commands/condition/TestWatchpointConditionCmd.py
- commands/watchpoints/watchpoint_count/TestWatchpointCount.py
- commands/watchpoints/watchpoint_disable/TestWatchpointDisable.py
- commands/watchpoints/watchpoint_size/TestWatchpointSizes.py
- python_api/watchpoint/TestSetWatchpoint.py
- python_api/watchpoint/TestWatchpointIgnoreCount.py
- python_api/watchpoint/TestWatchpointIter.py
- python_api/watchpoint/condition/TestWatchpointConditionAPI.py
- python_api/watchpoint/watchlocation/TestTargetWatchAddress.py


>From 0053a9cfdd4637be0d52901b5d871ed1c43e06a1 Mon Sep 17 00:00:00 2001
From: Aleksandr Korepanov <korepanov.sasha at gmail.com>
Date: Thu, 13 Jun 2024 15:56:08 +0200
Subject: [PATCH] [LLDB][Windows] Fix watchpoints for Windows

The patch fixes not working watchpoints on windows.
---
 lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index eb0834b1159f6..780147fc607e9 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -406,7 +406,7 @@ void ProcessWindows::RefreshStateAfterStop() {
                m_session_data->m_debugger->GetProcess().GetProcessId(), pc, id);
 
       stop_info = StopInfo::CreateStopReasonWithWatchpointID(
-          *stop_thread, id, m_watchpoints[id].address);
+          *stop_thread, id);
       stop_thread->SetStopInfo(stop_info);
 
       return;
@@ -857,7 +857,7 @@ Status ProcessWindows::EnableWatchpoint(WatchpointSP wp_sp, bool notify) {
   info.address = wp_sp->GetLoadAddress();
   info.size = wp_sp->GetByteSize();
   info.read = wp_sp->WatchpointRead();
-  info.write = wp_sp->WatchpointWrite();
+  info.write = wp_sp->WatchpointWrite() || wp_sp->WatchpointModify();
 
   for (unsigned i = 0U; i < m_thread_list.GetSize(); i++) {
     Thread *thread = m_thread_list.GetThreadAtIndex(i).get();



More information about the lldb-commits mailing list