[PR #2473] [CLOSED] Debugger: Add conditional data breakpoints, and a few minor bug fixes #1082

Closed
opened 2026-01-29 19:10:57 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/stenzek/duckstation/pull/2473
Author: @mateusfavarin
Created: 8/4/2021
Status: Closed

Base: masterHead: debugger


📝 Commits (10+)

  • 8489e1f Decrement bp counter when removing a bp from the list
  • cb06da7 Fix default bp counter when cleared
  • f98ccfd Fix bp list UI not updating when clearing all bps
  • d3d1a41 Fix bp ids not updating when a bp is removed
  • 12b29dd Add conditional bp UI
  • 5364eab Fix typo
  • e66b633 UI tweaks, add data structs that will encapsulate the new debugging logic
  • 11e06cc Change address size field to be a line
  • e8d7441 Update data structure for s_breakpoints
  • 511e55c Implement condition breakpoints

📊 Changes

19 files changed (+976 additions, -161 deletions)

View changed files

📝 dep/msvc/qt (+1 -1)
📝 src/core/cdrom.cpp (+6 -0)
📝 src/core/cpu_core.cpp (+284 -68)
📝 src/core/cpu_core.h (+7 -4)
📝 src/core/cpu_core_private.h (+24 -0)
📝 src/core/cpu_disasm.cpp (+19 -6)
📝 src/core/gdb_protocol.cpp (+10 -2)
📝 src/core/types.h (+15 -0)
📝 src/duckstation-qt/cheatmanagerdialog.cpp (+1 -1)
📝 src/duckstation-qt/debuggermodels.cpp (+137 -4)
📝 src/duckstation-qt/debuggermodels.h (+13 -0)
📝 src/duckstation-qt/debuggerwindow.cpp (+211 -57)
📝 src/duckstation-qt/debuggerwindow.h (+11 -1)
📝 src/duckstation-qt/debuggerwindow.ui (+43 -6)
📝 src/duckstation-qt/mainwindow.cpp (+2 -0)
📝 src/duckstation-qt/memoryviewwidget.cpp (+32 -9)
📝 src/duckstation-qt/memoryviewwidget.h (+2 -0)
📝 src/duckstation-qt/qtutils.cpp (+150 -1)
📝 src/duckstation-qt/qtutils.h (+8 -1)

📄 Description

I've implemented conditional data breakpoints for variable memory sizes. Duckstation was storing the address of each breakpoint as the information to check for when an execution breakpoint is valid. I expanded this idea by creating the struct DebugAddress, which encapsulates an address, a size and a debug_mode. The user can create a DebugAddress by adding a breakpoint using the UI, and select multiple conditions for the breakpoint: read, write, changed value or execution.

The execution breakpoint that was implemented on duck had to be modified by adding an extra check for the debug_mode, so only execution breakpoints can trigger that event. The data breakpoint was implemented by adding a function that looks ahead of what the next CPU instruction is going to be, and if the next instruction matches the conditions of any DebugAddress, then the emulation is paused before the CPU executes that instruction. The UI had to be changed in order for the user to create such breakpoints.

A few minor bug fixes unrelated to that:

  • Change breakpoint list ID to reset at 1, just like it's constructed.
  • When a breakpoint is removed, decrement the ID of every other breakpoint with an ID greater than the one that were removed.
  • When breakpoints are cleared, update the breakpoint list UI to give a visual feedback to the user.
  • Fix the breakpoint not disabling when you toggle the checkbox in the breakpoint list.
  • Change instruction format to always display hexadecimal values for consistency, and also change the sll zero, zero to nop.
  • Add the possibility to edit and delete breakpoints by interacting with the mouse in the breakpoint list.

This PR addresses some of the issues mentioned at #2179.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/stenzek/duckstation/pull/2473 **Author:** [@mateusfavarin](https://github.com/mateusfavarin) **Created:** 8/4/2021 **Status:** ❌ Closed **Base:** `master` ← **Head:** `debugger` --- ### 📝 Commits (10+) - [`8489e1f`](https://github.com/stenzek/duckstation/commit/8489e1fc7d1839ce8e3a261a48b38a2891b2ff1a) Decrement bp counter when removing a bp from the list - [`cb06da7`](https://github.com/stenzek/duckstation/commit/cb06da759ed0f6e797945cf12807c9372b2bad1f) Fix default bp counter when cleared - [`f98ccfd`](https://github.com/stenzek/duckstation/commit/f98ccfdc29e32d8cca487447812684e208b4afbc) Fix bp list UI not updating when clearing all bps - [`d3d1a41`](https://github.com/stenzek/duckstation/commit/d3d1a4182a71e9b107fed2801792576e7e0e7e4c) Fix bp ids not updating when a bp is removed - [`12b29dd`](https://github.com/stenzek/duckstation/commit/12b29dd6fd676593513aebe85b3a05efa81299c2) Add conditional bp UI - [`5364eab`](https://github.com/stenzek/duckstation/commit/5364eabe90c2e4a35fbae3334f86aeda479c3aa7) Fix typo - [`e66b633`](https://github.com/stenzek/duckstation/commit/e66b633ca3984cb5ac969858baa3ded78a741d1f) UI tweaks, add data structs that will encapsulate the new debugging logic - [`11e06cc`](https://github.com/stenzek/duckstation/commit/11e06ccdf44f1af1979944c6e2ff9238a7be9d01) Change address size field to be a line - [`e8d7441`](https://github.com/stenzek/duckstation/commit/e8d74418043f915dc8950fdbdc140606b5b91c3c) Update data structure for s_breakpoints - [`511e55c`](https://github.com/stenzek/duckstation/commit/511e55c2f14eaf7b75089b0b1f0931a1eed1197e) Implement condition breakpoints ### 📊 Changes **19 files changed** (+976 additions, -161 deletions) <details> <summary>View changed files</summary> 📝 `dep/msvc/qt` (+1 -1) 📝 `src/core/cdrom.cpp` (+6 -0) 📝 `src/core/cpu_core.cpp` (+284 -68) 📝 `src/core/cpu_core.h` (+7 -4) 📝 `src/core/cpu_core_private.h` (+24 -0) 📝 `src/core/cpu_disasm.cpp` (+19 -6) 📝 `src/core/gdb_protocol.cpp` (+10 -2) 📝 `src/core/types.h` (+15 -0) 📝 `src/duckstation-qt/cheatmanagerdialog.cpp` (+1 -1) 📝 `src/duckstation-qt/debuggermodels.cpp` (+137 -4) 📝 `src/duckstation-qt/debuggermodels.h` (+13 -0) 📝 `src/duckstation-qt/debuggerwindow.cpp` (+211 -57) 📝 `src/duckstation-qt/debuggerwindow.h` (+11 -1) 📝 `src/duckstation-qt/debuggerwindow.ui` (+43 -6) 📝 `src/duckstation-qt/mainwindow.cpp` (+2 -0) 📝 `src/duckstation-qt/memoryviewwidget.cpp` (+32 -9) 📝 `src/duckstation-qt/memoryviewwidget.h` (+2 -0) 📝 `src/duckstation-qt/qtutils.cpp` (+150 -1) 📝 `src/duckstation-qt/qtutils.h` (+8 -1) </details> ### 📄 Description I've implemented conditional data breakpoints for variable memory sizes. Duckstation was storing the address of each breakpoint as the information to check for when an execution breakpoint is valid. I expanded this idea by creating the struct `DebugAddress`, which encapsulates an `address`, a `size` and a `debug_mode`. The user can create a `DebugAddress` by adding a breakpoint using the UI, and select multiple conditions for the breakpoint: read, write, changed value or execution. The execution breakpoint that was implemented on duck had to be modified by adding an extra check for the `debug_mode`, so only execution breakpoints can trigger that event. The data breakpoint was implemented by adding a function that looks ahead of what the next CPU instruction is going to be, and if the next instruction matches the conditions of any `DebugAddress`, then the emulation is paused before the CPU executes that instruction. The UI had to be changed in order for the user to create such breakpoints. A few minor bug fixes unrelated to that: - Change breakpoint list ID to reset at 1, just like it's constructed. - When a breakpoint is removed, decrement the ID of every other breakpoint with an ID greater than the one that were removed. - When breakpoints are cleared, update the breakpoint list UI to give a visual feedback to the user. - Fix the breakpoint not disabling when you toggle the checkbox in the breakpoint list. - Change instruction format to always display hexadecimal values for consistency, and also change the `sll zero, zero` to `nop`. - Add the possibility to edit and delete breakpoints by interacting with the mouse in the breakpoint list. This PR addresses some of the issues mentioned at #2179. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 19:10:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/duckstation#1082