Romhacking => Newcomer's Board => Topic started by: irecinius on July 20, 2011, 01:32:23 pm

Title: pSX Debugger question
Post by: irecinius on July 20, 2011, 01:32:23 pm
Well this might not be the most appropriate place to ask a question.. but here is the thing

So I started doing breakpoints using memory write/read

I'll go off on a tangent to explain what I'm doing, maybe its something wrong somewhere...

I was trying find how the game find a pointer, so I set a break on the memory (0x1cd4fe) on READ only, place in the memory where the pointer is..
it kindly broke execution where I expected just before the text appeared, and took me
0004ee48: 00000000 nop
since I remember that mips has a one instruction delay on loading writing from the memory, I took a look on the instruction before:
0004ee44: 94420000 lhu r2,0x0000(r2)
r2 at the time when it broke was the pointer value..

So I wanted to find what r2 was(and the other registers values too)

I set a new break this time on
0x4ee44, on EXECUTION

Ran again... NADA!
ok, set the break on 0x4ee48..

Why isn't breaking, even though it does if I set on memory/read write? am I doing anything wrong?
Title: Re: pSX Debugger question
Post by: KC on July 22, 2011, 05:56:59 am
Did you load a savestate or reset after setting the breakpoint? pSX manages execute breakpoints by overwriting instructions with a dummy opcode, which will of course be reverted if you load a save state or reset.

Also, pSX doesn't emulate any load delays. It just adjusts the PC before the breakpoint is triggered. It therefore also won't fail if the load delay is not respected.
Probably not related to this, but maybe for the future: As pSX adjusts the PC before any breakpoint is triggered, it's possible that a delay slot of a branch instruction triggers it. You'd only find out at the branch destination though. So keep that in mind if execution breakpoints still don't work.
Title: Re: pSX Debugger question
Post by: irecinius on July 24, 2011, 03:02:51 pm
Yes, I was loading from a savestate, I'll going to the next dialog, and try then.