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

Qt/CodeViewWidget: Implement branch arrows. #8642

Merged
merged 3 commits into from
Mar 15, 2020

Conversation

AdmiralCurtiss
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss commented Feb 23, 2020

Back in WX, the debugger would draw arrows to indicate branches, like this:
https://user-images.githubusercontent.com/4522237/75113262-83629280-564c-11ea-857e-b86459b47c08.png
https://user-images.githubusercontent.com/4522237/75113263-83629280-564c-11ea-865e-e672b01c57a6.png

I found this pretty useful at quickly determining conditionals and loops, but during the transition to Qt this feature was lost. This PR is a implementation of this feature for Qt.

Screenshots:
https://user-images.githubusercontent.com/4522237/75113260-82316580-564c-11ea-9057-bf7dc6cc169a.png
https://user-images.githubusercontent.com/4522237/75202872-eb0fff00-576c-11ea-869c-0a9ca0b208ef.png

One thing I'm not sure here is if I have to make sure BranchDisplayDelegate::paint() and CodeViewWidget::Update() don't run at the same time in different threads, or if those two are both only already allowed on the GUI thread anyway. Does anyone know?

@AdmiralCurtiss AdmiralCurtiss force-pushed the debugger_branch_arrows branch 4 times, most recently from 8e8f2fe to ea3d8c5 Compare February 23, 2020 14:47
@AdmiralCurtiss AdmiralCurtiss force-pushed the debugger_branch_arrows branch 4 times, most recently from a7a84cc to 74f876e Compare February 25, 2020 00:14
@AdmiralCurtiss
Copy link
Contributor Author

I've added a special case for branch instructions that set the link register to reduce visual noise, which turns this: https://user-images.githubusercontent.com/4522237/75113261-82c9fc00-564c-11ea-804d-61dca888cf76.png
into something much more readable-at-a-glance: https://user-images.githubusercontent.com/4522237/75202872-eb0fff00-576c-11ea-869c-0a9ca0b208ef.png

Since instructions that set the link register usually jump to another function, and thus very rarely actually have the target visible, this seems like a good idea to me.

I'll see if I can do something about using the horizontal space better, too.

@AdmiralCurtiss
Copy link
Contributor Author

Alright, I tried to use the horizontal space better, looks pretty good now if you ask me: https://user-images.githubusercontent.com/4522237/75385411-ff283d80-58df-11ea-9155-3db9a41efe2f.png

I'm not entirely sure I like how the indentation calculation code is written (in particular the lambda-in-lambda there...), but I suppose it does the job.

@AdmiralCurtiss AdmiralCurtiss force-pushed the debugger_branch_arrows branch from e286c38 to 9c98b65 Compare March 15, 2020 15:14
@leoetlino
Copy link
Member

One thing I'm not sure here is if I have to make sure BranchDisplayDelegate::paint() and CodeViewWidget::Update() don't run at the same time in different threads, or if those two are both only already allowed on the GUI thread anyway. Does anyone know?

Looks like CodeViewWidget::Update is only called from the UI thread, so there shouldn't be any issues

@leoetlino leoetlino merged commit 24a0164 into dolphin-emu:master Mar 15, 2020
@AdmiralCurtiss AdmiralCurtiss deleted the debugger_branch_arrows branch March 15, 2020 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants