all repos — mgba @ 93dbae1e5fc50411fc229c799ce49d3b4ea97272

mGBA Game Boy Advance Emulator

Fix GDB stub reporting of CPSR
Jeremy Herbert jeremy.006@gmail.com
Mon, 27 Mar 2017 22:07:19 +1000
commit

93dbae1e5fc50411fc229c799ce49d3b4ea97272

parent

fc67f3fbe4f805035b8d872fe0eb2fb4d7712f68

1 files changed, 18 insertions(+), 0 deletions(-)

jump to
M src/debugger/gdb-stub.csrc/debugger/gdb-stub.c

@@ -321,11 +321,29 @@ struct ARMCore* cpu = stub->d.core->cpu;

UNUSED(message); int r; int i = 0; + + // General purpose registers for (r = 0; r < ARM_PC; ++r) { _int2hex32(cpu->gprs[r], &stub->outgoing[i]); i += 8; } + + // Program counter _int2hex32(cpu->gprs[ARM_PC] - (cpu->cpsr.t ? WORD_SIZE_THUMB : WORD_SIZE_ARM), &stub->outgoing[i]); + i += 8; + + // Floating point registers, unused on the GBA (8 of them, 24 bits each) + for (r = 0; r < 8 * 3; ++r) { + _int2hex32(0, &stub->outgoing[i]); + i += 8; + } + + // Floating point status, unused on the GBA (32 bits) + _int2hex32(0, &stub->outgoing[i]); + i += 8; + + // CPU status + _int2hex32(cpu->cpsr.packed, &stub->outgoing[i]); i += 8; stub->outgoing[i] = 0;