PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.57k stars 1.6k forks source link

[Feature Request]: Register Breakpoints #10846

Closed ghost closed 7 months ago

ghost commented 7 months ago

I want to know what Daniel McCarthy thinks about it

Description

A register breakpoint is a breakpoint that is set on a register, like a0, a1, a2, a3, v0, v1, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9 and so on, and there are two kinds of register breakpoints: Read and Write.

The write register breakpoint is used to pause PCSX2 whenever the value of the register, that the breakpoint is set on, has been changed in instructions like li, lui, ori, andi, xori, addiu, move, or, and, xor, addu, subu, lb, lbu, lh, lhu, lw and so on.

The read register breakpoint is used to pause PCSX2 whenever the value of the register, that the breakpoint is set on, has been used for some purpose in instructions like move, or, and, xor, addu, subu, sb, sh, sw, beq, bne, beql, bnel and so on.

Reason

Some games read the value of some variable from the memory and store it in a register and use it much later.

I can use a memory read breakpoint to find out the lb, lbu, lh, lhu or lw instruction that reads this value and see the name of the register that the value is stored at but then I have to repeatedly do a lot of either "Step In" or "Step Over" in the debugger until I find when the value of the variable is actually used through the register.

Examples

I recall playing Castlevania Symphony of the Night with PCSX-Redux and with the Memory Observer Delta-over-time search I found the address of some variable and then I added a memory read breakpoint.

When the value of that variable was read I found the lbu instruction that stored it in the at register.

But I saw the next 100 instructions and I didn't see that the at register was used at all in these 100 instructions.

I remember that I was clicking on the "Step In" or "Step Over" button like a hundred times but didn't see that the at register was used.

But knowing the behavior of the game I know that somewhere it must be used in a conditional branch instruction.

Maybe if I had clicking "Step In" or "Step Over" thousands times instead of hundreds then I would find it eventually.

Even if this is true then I don't like to do "Step In" or "Step Over" even hundred of times.

In that case I would like to add a "read register breakpoint" on the at register and then click "Resume" and wait until the value of the at register is used and find the conditional branch instruction that I was looking for.

Of course that Castlevania Symphony of the Night is a PS1 game though maybe it will be playable on PCSX2 someday but I afraid that there maybe PS2 games that also behave like this and if this is true then I want the "register breakpoints" feature for these games.

If I am wrong then close this as not planned.

I want to know what Daniel McCarthy thinks about it

F0bes commented 7 months ago

I'm sorry but the answer is going to be the same thing as your other FR.

7815

You were told why this isn't a reasonable feature request as it would be

  1. Very slow
  2. A non-trivial amount of work.

Of course if someone wants to implement it they can.

I'll just add the low priority label instead of closing like last time.

Daniel-McCarthy commented 7 months ago

I'm not currently aware of a good solution for this, but I will keep this in mind in case I find one. I would also appreciate if these weren't created with my name on them,

ghost commented 7 months ago

I'm not currently aware of a good solution for this, but I will keep this in mind in case I find one. I would also appreciate if these weren't created with my name on them,

I am sorry. I won't do this again.

stenzek commented 7 months ago

Duplicate of #7815.