mirror of https://github.com/mgba-emu/mgba.git
Debugger: Fix GDB writing to PC
This commit is contained in:
parent
a967f9aac4
commit
73f4fad5c3
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue