Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLDB Windows: Hardware Watchpoints Not Triggering on Initial Stop #125054

Open
omjavaid opened this issue Jan 30, 2025 · 1 comment
Open

LLDB Windows: Hardware Watchpoints Not Triggering on Initial Stop #125054

omjavaid opened this issue Jan 30, 2025 · 1 comment

Comments

@omjavaid
Copy link
Contributor

Hardware breakpoints and watchpoints set at the initial stop (process launch -s) do not trigger, even though they are correctly written to the Windows context. They only work if set after the program reaches main. This issue affects both AArch64 and x86_64 hardware watchpoints.

This issue was discovered while implementing hardware breakpoint and watchpoint support for AArch64 Windows #108072 . Due to the impact, hardware breakpoints were dropped, but watchpoints were retained. The same applies to x86_64 Windows, which only implements hardware breakpoints

Reproduction Steps:

  1. Launch a process using process launch -s (stops at the first instruction).
  2. Set a hardware watchpoint.
  3. Resume execution (continue).
  4. The program runs to completion without the hardware watchpoint triggering.
  5. Repeat using process launch -m (stops at main).
  6. Set the same hardware watchpoint and resume.
  7. The watchpoint now triggers correctly.

Underlying Problem:

Windows loader operations between the first instruction and main may disables hardware breakpoints and watchpoints and only enables at the start of main function. LLDB requires a running process to set watchpoints, making this issue less frequent for watchpoints but critical for breakpoints. Does not affect LLDB tests, as hardware breakpoints are not supported on windows due to this problem, and watchpoints are always set after a software breakpoint on main.

@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/issue-subscribers-lldb

Author: Omair Javaid (omjavaid)

Hardware breakpoints and watchpoints set at the initial stop (process launch -s) do not trigger, even though they are correctly written to the Windows context. They only work if set after the program reaches main. This issue affects both AArch64 and x86_64 hardware watchpoints.

This issue was discovered while implementing hardware breakpoint and watchpoint support for AArch64 Windows #108072 . Due to the impact, hardware breakpoints were dropped, but watchpoints were retained. The same applies to x86_64 Windows, which only implements hardware breakpoints

Reproduction Steps:

  1. Launch a process using process launch -s (stops at the first instruction).
  2. Set a hardware watchpoint.
  3. Resume execution (continue).
  4. The program runs to completion without the hardware watchpoint triggering.
  5. Repeat using process launch -m (stops at main).
  6. Set the same hardware watchpoint and resume.
  7. The watchpoint now triggers correctly.

Underlying Problem:

Windows loader operations between the first instruction and main may disables hardware breakpoints and watchpoints and only enables at the start of main function. LLDB requires a running process to set watchpoints, making this issue less frequent for watchpoints but critical for breakpoints. Does not affect LLDB tests, as hardware breakpoints are not supported on windows due to this problem, and watchpoints are always set after a software breakpoint on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants