Large diffs are not rendered by default.

@@ -6,38 +6,23 @@
#pragma once

#include "Common/CommonTypes.h"
#include "Core/CoreTiming.h"

#ifndef MSG_WAITALL
#define MSG_WAITALL (8)
#endif

typedef enum
namespace GDBStub
{
GDB_SIGTRAP = 5,
GDB_SIGTERM = 15,
} gdb_signals;

typedef enum
enum class Signal
{
GDB_BP_TYPE_NONE = 0,
GDB_BP_TYPE_X,
GDB_BP_TYPE_R,
GDB_BP_TYPE_W,
GDB_BP_TYPE_A
} gdb_bp_type;

void gdb_init(u32 port);
void gdb_init_local(const char* socket);
void gdb_deinit();
bool gdb_active();
void gdb_break();

void gdb_handle_exception();
int gdb_signal(u32 signal);

int gdb_bp_x(u32 addr);
int gdb_bp_r(u32 addr);
int gdb_bp_w(u32 addr);
int gdb_bp_a(u32 addr);

bool gdb_add_bp(u32 type, u32 addr, u32 len);
Sigtrap = 5,
Sigterm = 15,
};

void Init(u32 port);
void InitLocal(const char* socket);
void Deinit();
bool IsActive();
bool HasControl();
void TakeControl();

void ProcessCommands(bool loop_until_continue);
void SendSignal(Signal signal);
} // namespace GDBStub
@@ -20,15 +20,12 @@
#include "Core/HLE/HLE.h"
#include "Core/HW/CPU.h"
#include "Core/Host.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/Interpreter/ExceptionUtils.h"
#include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/PowerPC.h"

#ifdef USE_GDBSTUB
#include "Core/PowerPC/GDBStub.h"
#endif

namespace
{
u32 last_pc;
@@ -152,16 +149,6 @@ int Interpreter::SingleStepInner()
return PPCTables::GetOpInfo(m_prev_inst)->numCycles;
}

#ifdef USE_GDBSTUB
if (gdb_active() && gdb_bp_x(PC))
{
Host_UpdateDisasmDialog();

gdb_signal(GDB_SIGTRAP);
gdb_handle_exception();
}
#endif

NPC = PC + sizeof(UGeckoInstruction);
m_prev_inst.hex = PowerPC::Read_Opcode(PC);

@@ -306,6 +293,8 @@ void Interpreter::Run()
#endif
INFO_LOG_FMT(POWERPC, "Hit Breakpoint - {:08x}", PC);
CPU::Break();
if (GDBStub::IsActive())
GDBStub::TakeControl();
if (PowerPC::breakpoints.IsTempBreakPoint(PC))
PowerPC::breakpoints.Remove(PC);

@@ -18,15 +18,12 @@
#include "Core/HW/MMIO.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/ProcessorInterface.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"

#include "VideoCommon/VideoBackendBase.h"

#ifdef USE_GDBSTUB
#include "Core/PowerPC/GDBStub.h"
#endif

namespace PowerPC
{
// EFB RE
@@ -522,6 +519,9 @@ static void Memcheck(u32 address, u64 var, bool write, size_t size)

CPU::Break();

if (GDBStub::IsActive())
GDBStub::TakeControl();

// Fake a DSI so that all the code that tests for it in order to skip
// the rest of the instruction will apply. (This means that
// watchpoints will stop the emulator before the offending load/store,
@@ -25,6 +25,7 @@
#include "Core/HW/SystemTimers.h"
#include "Core/Host.h"
#include "Core/PowerPC/CPUCoreBase.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/Interpreter/Interpreter.h"
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/MMU.h"
@@ -611,7 +612,11 @@ void CheckBreakPoints()
return;

if (PowerPC::breakpoints.IsBreakPointBreakOnHit(PC))
{
CPU::Break();
if (GDBStub::IsActive())
GDBStub::TakeControl();
}
if (PowerPC::breakpoints.IsBreakPointLogOnHit(PC))
{
NOTICE_LOG_FMT(MEMMAP,