• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › General Discussion v
« Previous 1 ... 331 332 333 334 335 ... 368 Next »

Generate list of PPC instructions executed - how?
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Generate list of PPC instructions executed - how?
01-20-2010, 04:41 AM
#1
DRWS
Unregistered
 
What I want to do is find the assembly instructions responsible for an in-game event, by comparing the list of instructions executed during that event with instructions executed when the event isn't activated, and finding instructions unique to the former.

To that end, I need to be able to print out every instruction executed since the start of the game. But I haven't found such a feature in Dolphin's debug mode. If such a feature doesn't exist, I'd like to code it myself. Only I'm not sure where to start; the Dolphin code is pretty intimidating. JIT.cpp? Core.cpp? Or elsewhere?

I'll keep looking, but if anyone with more experience with the Dolphin code knows the best place to start looking, I would really appreciate it.
Reply
01-20-2010, 05:52 AM
#2
ector Offline
PPSSPP author, Dolphin co-founder
*
Project Owner  Developers (Administrators)
Posts: 189
Threads: 2
Joined: Mar 2009
It's possible, should be easy to hack in a couple of lines into the interpreter (cpu execution speed isn't going to matter when you're disassembling, it's gonna be slow no matter what) but you're looking at 486Minstr/sec. This is no SNES. So expanded into readable instructions, one second of such printing will create 4GB+ of data. Have fun.
Website Find
Reply
01-20-2010, 08:37 AM
#3
DRWS
Unregistered
 
(01-20-2010, 05:52 AM)ector Wrote: It's possible, should be easy to hack in a couple of lines into the interpreter (cpu execution speed isn't going to matter when you're disassembling, it's gonna be slow no matter what) but you're looking at 486Minstr/sec. This is no SNES. So expanded into readable instructions, one second of such printing will create 4GB+ of data. Have fun.

One second is all I need. While there might be 4GB of readable instructions, I know the instructions I'm looking for are only called once, and they won't appear under the second set of circumstances (i.e. when the event doesn't occur). That narrows down my search.

Which .cpp should I start looking at? There are so many to choose from, and there are a lot that look like they might refer to the interpreter.

Also the equivalent x86 instructions from the JIT recompiler should work for my purposes as well; I'm not restricted to PPC instructions.
Reply
01-20-2010, 09:12 AM
#4
skid Offline
skidau / skid_au
**********
Developers (Some Administrators and Super Moderators)
Posts: 2,006
Threads: 8
Joined: Aug 2009
What you are after will only work in the interpreter because the JIT works with blocks of PPC instructions.

I have this code already so I thought I'd share. In Interpreter.cpp add this code to "void SingleStepInner(void)"

Code:
        char regs[500]="";
        for (int i=0; i<32; i++) {
                sprintf(regs, "%sr%02d: %08x ", regs, i, PowerPC::ppcState.gpr[i]);
        }

        char fregs[500]="";
#ifdef JIT_LOG_FPU
        for (int i=0; i<32; i++) {
            sprintf(fregs, "%sf%02d: %08x %08x ", fregs, i, PowerPC::ppcState.ps[i][0], PowerPC::ppcState.ps[i][1]);
        }
#endif
        char ppcInst[256];
        DisassembleGekko(instCode.hex, PC, ppcInst, 256);

        NOTICE_LOG(POWERPC, "Compiling PC: %08x Cycles: %04d CR: %08x CRfast: %02x%02x%02x%02x%02x%02x%02x%02x FPSCR: %08x MSR: %08x LR: %08x %s %s %s", PC, 1, PowerPC::ppcState.cr, PowerPC::ppcState.cr_fast[0], PowerPC::ppcState.cr_fast[1], PowerPC::ppcState.cr_fast[2], PowerPC::ppcState.cr_fast[3], PowerPC::ppcState.cr_fast[4], PowerPC::ppcState.cr_fast[5], PowerPC::ppcState.cr_fast[6], PowerPC::ppcState.cr_fast[7], PowerPC::ppcState.fpscr, PowerPC::ppcState.msr, PowerPC::ppcState.spr[8], regs, fregs, ppcInst);

You'll have to increase the buffer size of the log, otherwise the log line gets cut off or corrupted or somesuch. Alternatively, you could remove the register log to shorten the line.

Hope that helps.
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode