From a9293c8923905e8b9f15edca05cb228fe3afca2b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 18 Jan 2013 10:19:43 -0800 Subject: [PATCH] Add breakpoints to x86 jit for easier debugging. They should be really fast so leaving them on in release. --- Core/MIPS/x86/Jit.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index f5149f1264..9e9963bef1 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -25,9 +25,21 @@ #include "RegCache.h" #include "Jit.h" +#include "../../Host.h" +#include "../../Debugger/Breakpoints.h" + namespace MIPSComp { +static void JitBreakpoint() +{ + Core_EnableStepping(true); + host->SetDebugMode(true); + + if (CBreakPoints::IsTempBreakPoint(currentMIPS->pc)) + CBreakPoints::RemoveBreakPoint(currentMIPS->pc); +} + Jit::Jit(MIPSState *mips) : blocks(mips), mips_(mips) { blocks.Init(); @@ -107,6 +119,15 @@ const u8 *Jit::DoJit(u32 em_address, JitBlock *b) MIPSCompileOp(inst); + // Jit breakpoints are quite fast, so let's do them in release too. + if (CBreakPoints::IsAddressBreakPoint(js.compilerPC)) + { + FlushAll(); + MOV(32, M(&mips_->pc), Imm32(js.compilerPC)); + CALL(&JitBreakpoint); + WriteSyscallExit(); + } + js.compilerPC += 4; numInstructions++; }