Skip to content
Prev Previous commit
Next Next commit
32X GDB stub commit
  • Loading branch information
Genos3 committed May 15, 2025
commit 0b8500f868415c8bb18f318ef81735a4e7b6efa2
7 changes: 2 additions & 5 deletions ares/component/processor/arm7tdmi/instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ auto ARM7TDMI::armInitialize() -> void {
opcode.bit( 0, 3), /* m */ \
opcode.bit(12,15), /* d */ \
opcode.bit(16,19) /* field */
for(n4 m : range(16))
for(n2 _ : range(4))
for(n4 d : range(16))
for(n4 field : range(16)) {
auto opcode = pattern(".... 0001 0010 ???? ???? ---- 0??1 ????") | m << 0 | _ << 5 | d << 12 | field << 16;
for(n2 _ : range(4)) {
auto opcode = pattern(".... 0001 0010 ???? ???? ---- 0??1 ????") | _ << 5;
bind(opcode, BranchExchangeRegister);
}
#undef arguments
Expand Down
26 changes: 18 additions & 8 deletions ares/md/m32x/sh7604.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ auto M32X::SH7604::unload() -> void {
}

auto M32X::SH7604::main() -> void {
if (m32x.shm.active()) {
if (m32x.vdp.vblank) {
GDB::server.updateLoop();
}

if (!GDB::server.reportPC(regs.PC)) return;
}

if(!m32x.io.adapterReset) return step(1000);

if(!regs.ID) {
Expand All @@ -42,14 +50,6 @@ auto M32X::SH7604::main() -> void {
#undef raise
}

if (m32x.shm.active()) {
if (m32x.vdp.vblank) {
GDB::server.updateLoop();
}

GDB::server.reportPC(regs.PC);
}

SH2::instruction();
SH2::intc.run();
SH2::dmac.run();
Expand Down Expand Up @@ -210,6 +210,10 @@ auto M32X::SH7604::initDebugHooks() -> void {
"</target>";
};

GDB::server.hooks.normalizeAddress = [](u64 address) -> u64 {
return (u32)address & 0x00FFFFFF;
};

GDB::server.hooks.read = [](u64 address, u32 byteCount) -> string {
address = (s32)address;

Expand Down Expand Up @@ -260,4 +264,10 @@ auto M32X::SH7604::initDebugHooks() -> void {
}
return res;
};

if constexpr(Accuracy::Recompiler) {
GDB::server.hooks.emuCacheInvalidate = [](u64 address) {
m32x.shm.recompiler.invalidate(address, 4);
};
}
}
2 changes: 1 addition & 1 deletion nall/nall/gdb/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using string = ::nall::string;
using string_view = ::nall::string_view;

namespace {
constexpr bool GDB_LOG_MESSAGES = false;
constexpr bool GDB_LOG_MESSAGES = true;

constexpr u32 MAX_REQUESTS_PER_UPDATE = 10;
constexpr u32 MAX_PACKET_SIZE = 0x4096;
Expand Down