|
|
@ -183,6 +183,9 @@ void gdbstub_thread_gdb() |
|
|
|
// g : read all registers -> send back all registers
|
|
|
|
// g : read all registers -> send back all registers
|
|
|
|
char resp[32 * 8 + 8 + 1] = {0}; |
|
|
|
char resp[32 * 8 + 8 + 1] = {0}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Obtain CPU0 mutex
|
|
|
|
|
|
|
|
pthread_mutex_lock(cpu0_mutex); |
|
|
|
|
|
|
|
|
|
|
|
// All general purpose registers in host byte order as chars
|
|
|
|
// All general purpose registers in host byte order as chars
|
|
|
|
for(size_t i = 0; i < 32; i++) |
|
|
|
for(size_t i = 0; i < 32; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -194,6 +197,9 @@ void gdbstub_thread_gdb() |
|
|
|
uint32_t pc = htonl(cpu0->pc); |
|
|
|
uint32_t pc = htonl(cpu0->pc); |
|
|
|
snprintf(resp + 32 * 8, 9, "%08x", pc); |
|
|
|
snprintf(resp + 32 * 8, 9, "%08x", pc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Let go of CPU0 mutex
|
|
|
|
|
|
|
|
pthread_mutex_unlock(cpu0_mutex); |
|
|
|
|
|
|
|
|
|
|
|
// Final packet size, send packet
|
|
|
|
// Final packet size, send packet
|
|
|
|
size_t size = 32 * 8 + 8; |
|
|
|
size_t size = 32 * 8 + 8; |
|
|
|
gdbstub_send_packet(resp, size); |
|
|
|
gdbstub_send_packet(resp, size); |
|
|
@ -202,6 +208,9 @@ void gdbstub_thread_gdb() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// G : write all registers -> read and set all registers
|
|
|
|
// G : write all registers -> read and set all registers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Obtain CPU0 mutex
|
|
|
|
|
|
|
|
pthread_mutex_lock(cpu0_mutex); |
|
|
|
|
|
|
|
|
|
|
|
// All general purpose registers in host byte order as chars
|
|
|
|
// All general purpose registers in host byte order as chars
|
|
|
|
for(size_t i = 1; i < 32; i++) |
|
|
|
for(size_t i = 1; i < 32; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -218,6 +227,9 @@ void gdbstub_thread_gdb() |
|
|
|
pc = ntohl(pc); |
|
|
|
pc = ntohl(pc); |
|
|
|
cpu0->pc = pc; |
|
|
|
cpu0->pc = pc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Let go of CPU0 Mutex
|
|
|
|
|
|
|
|
pthread_mutex_unlock(cpu0_mutex); |
|
|
|
|
|
|
|
|
|
|
|
gdbstub_send_packet("OK", 2); |
|
|
|
gdbstub_send_packet("OK", 2); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(packet[0] == 'm') |
|
|
|
else if(packet[0] == 'm') |
|
|
|