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

Debugger: Add Saved Addresses tab widget for bookmarking memory addresses #10518

Merged
merged 3 commits into from
Jan 6, 2024

Conversation

Daniel-McCarthy
Copy link
Contributor

@Daniel-McCarthy Daniel-McCarthy commented Dec 31, 2023

Description of Changes

Adds the ability to save memory addresses to a newly added Saved Addresses tab widget in the debugger.
Works as a way to bookmark memory addresses and allow jumping back to saved addresses.
PCSX2-SavedAddresses

Adds the ability to add memory addresses as a Saved Addresses from the Memory Search results list context menu and Memory View context menu. Also allows exporting and importing the Saved Addresses in CSV format so that users can save/restore their addresses.

Additional changes

  • Updates double clicking Memory Search results to change the current tab to the Memory View. Previously it would change the address but stay on the same widget (thus not showing the address to the user).
  • Replaces uses of the number 256 as a literal in place of Qt::UserRole to make it more clear what it's purpose is/where the number stems from.
  • Const changes to address warnings in otherwise unrelated code in CpuWidget.cpp.

Rationale behind Changes

Helps making keeping track of memory addresses/search results easier by allowing the user to give labels/descriptions and immediately jump back to that address in the Memory View or Disassembly View.

This makes it easier to juggle between different memory addresses and remembering details about each, and being able to quickly compare different areas of memory.

Suggested Testing Steps

  • Verify adding a new Saved Address from: The Saved Addresses context menu; memory search result context menu; and Memory View context menu.
  • Exporting/Importing CSV of saved addresses adds the expected addresses.
  • Going to disassembly and memory views is working as expected.
  • Double clicking a memory search result while on a non-Memory View tab takes you to the Memory View tab.

@stenzek
Copy link
Contributor

stenzek commented Dec 31, 2023

RTTI is disabled in our builds, but qobject_cast should still work.

@Daniel-McCarthy Daniel-McCarthy force-pushed the Saved-Memory-Addresses branch 3 times, most recently from 2b50c16 to 79beee6 Compare December 31, 2023 05:10
Copy link
Contributor

@Mrlinkwii Mrlinkwii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
works well

Copy link
Contributor

@kamfretoz kamfretoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Screenshot_20240101_180756

pcsx2-qt/CMakeLists.txt Outdated Show resolved Hide resolved
pcsx2-qt/CMakeLists.txt Outdated Show resolved Hide resolved
pcsx2-qt/Debugger/CpuWidget.cpp Outdated Show resolved Hide resolved
pcsx2-qt/Debugger/Models/SavedAddressesModel.cpp Outdated Show resolved Hide resolved
pcsx2-qt/Debugger/Models/SavedAddressesModel.h Outdated Show resolved Hide resolved
Copy link
Contributor

@stenzek stenzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good otherwise.

I know we were discussing whether to serialize this information in a JSON file, I'm guessing that is out of scope for this PR? Just wanted to check before merging.

pcsx2-qt/Debugger/Models/SavedAddressesModel.cpp Outdated Show resolved Hide resolved
pcsx2-qt/Debugger/Models/SavedAddressesModel.cpp Outdated Show resolved Hide resolved
pcsx2-qt/Debugger/Models/SavedAddressesModel.h Outdated Show resolved Hide resolved
pcsx2-qt/Debugger/Models/SavedAddressesModel.h Outdated Show resolved Hide resolved
Adds a tab widget to the debugger that allows saving/bookmarking memory addresses and giving them labels/descriptions for convenience. Includes the ability to jump back to memory addresses from the Saved Addresses tab, and adding Saved Addresses from memory search search results context menu and the memory view context menu.

Also supports importing and exporting the saved addresses as CSV format.
…w tab

Previously when double clicking a memory search result it would go to the address but not switch to the memory view tab if the user wasn't already on it.
Now it ensures the user moves to the memory view widget, as this is almost always going to be the user's intention.
Adds const to variables that could use them but currently don't and replaces 256 literal uses with Qt::UserRole to be clear what it is for and how this number is used as currently it's a bit confusing.
@Daniel-McCarthy
Copy link
Contributor Author

I know we were discussing whether to serialize this information in a JSON file, I'm guessing that is out of scope for this PR? Just wanted to check before merging.

Yeah, I was thinking to merge this in and then will add the serialization/debugger settings as a followup. Thanks for checking 👍

@stenzek
Copy link
Contributor

stenzek commented Jan 6, 2024

All good! Thanks for the PR :)

@stenzek stenzek merged commit 00137c3 into PCSX2:master Jan 6, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants