Debugger: Fix GDB writing to PC

This commit is contained in:
Jeffrey Pfau 2016-08-07 11:07:54 -07:00
parent a967f9aac4
commit 73f4fad5c3
1 changed files with 17 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gdb-stub.h"
#include "arm/isa-inlines.h"
#include "core/core.h"
#include "gba/memory.h"
@ -295,10 +296,16 @@ static void _writeGPRs(struct GDBStub* stub, const char* message) {
const char* readAddress = message;
int r;
for (r = 0; r < ARM_PC; ++r) {
for (r = 0; r <= ARM_PC; ++r) {
cpu->gprs[r] = _hex2int(readAddress, 8);
readAddress += 8;
}
int32_t currentCycles = 0;
if (cpu->executionMode == MODE_ARM) {
ARM_WRITE_PC;
} else {
THUMB_WRITE_PC;
}
strncpy(stub->outgoing, "OK", GDB_STUB_MAX_LINE - 4);
_sendMessage(stub);
@ -336,8 +343,16 @@ static void _writeRegister(struct GDBStub* stub, const char* message) {
value = __builtin_bswap32(value);
#endif
if (reg < 0x10) {
if (reg <= ARM_PC) {
cpu->gprs[reg] = value;
if (reg == ARM_PC) {
int32_t currentCycles = 0;
if (cpu->executionMode == MODE_ARM) {
ARM_WRITE_PC;
} else {
THUMB_WRITE_PC;
}
}
} else if (reg == 0x19) {
cpu->cpsr.packed = value;
} else {