gdbstub: implemented G command
This commit is contained in:
parent
43629abbd4
commit
cb98752b67
@ -158,6 +158,7 @@ void gdbstub_thread_gdb()
|
||||
}
|
||||
else if(packet[0] == 'g')
|
||||
{
|
||||
// g : read all registers -> send back all registers
|
||||
char resp[32 * 8 + 8 + 1] = {0};
|
||||
|
||||
// All general purpose registers in host byte order as chars
|
||||
@ -175,6 +176,28 @@ void gdbstub_thread_gdb()
|
||||
size_t size = 32 * 8 + 8;
|
||||
gdbstub_send_packet(resp, size);
|
||||
}
|
||||
else if(packet[0] == 'G')
|
||||
{
|
||||
// G : write all registers -> read and set all registers
|
||||
|
||||
// All general purpose registers in host byte order as chars
|
||||
for(size_t i = 1; i < 32; i++)
|
||||
{
|
||||
uint32_t value = 0;
|
||||
sscanf(packet + 1 + i * 8, "%08x", &value);
|
||||
value = ntohl(value);
|
||||
|
||||
cpu0->regs.x[i] = value;
|
||||
}
|
||||
|
||||
// PC register
|
||||
uint32_t pc = 0;
|
||||
sscanf(packet + 1 + 32 * 8, "%08x", &pc);
|
||||
pc = ntohl(pc);
|
||||
cpu0->pc = pc;
|
||||
|
||||
gdbstub_send_packet("OK", 2);
|
||||
}
|
||||
else gdbstub_send_unsupported();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user