|
|
|
@ -24,6 +24,7 @@ typedef struct sockaddr sockaddr_t; |
|
|
|
|
|
|
|
|
|
socket_t gdbstub_server_socket; |
|
|
|
|
socket_t gdb_socket; |
|
|
|
|
pthread_t gdbstub_thread; |
|
|
|
|
|
|
|
|
|
void gdbstub_thread_gdb(); |
|
|
|
|
static void gdbstub_handle_ctrlc(); |
|
|
|
@ -159,7 +160,7 @@ void gdbstub_wait_for_connection() |
|
|
|
|
|
|
|
|
|
gdb_socket = c_socket; |
|
|
|
|
|
|
|
|
|
gdbstub_thread_gdb(); |
|
|
|
|
pthread_create(&gdbstub_thread, 0, (void*) gdbstub_thread_gdb, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void gdbstub_thread_gdb() |
|
|
|
@ -285,6 +286,8 @@ void gdbstub_thread_gdb() |
|
|
|
|
{ |
|
|
|
|
// s : single-step
|
|
|
|
|
|
|
|
|
|
// TODO : Implement that correctly
|
|
|
|
|
|
|
|
|
|
// Send back halt reason
|
|
|
|
|
// Halt Reason : Signal 05 (SIGTRAP)
|
|
|
|
|
char* resp = "S05"; |
|
|
|
@ -298,6 +301,10 @@ void gdbstub_thread_gdb() |
|
|
|
|
send(gdb_socket, "+", 1, 0); |
|
|
|
|
|
|
|
|
|
// Continue simulation
|
|
|
|
|
pthread_mutex_lock(&cpu0_mutex); |
|
|
|
|
cpu0->sim_ticks_left = -1; |
|
|
|
|
pthread_mutex_unlock(&cpu0_mutex); |
|
|
|
|
pthread_cond_signal(&cpu0->sim_condition); |
|
|
|
|
} |
|
|
|
|
else gdbstub_send_unsupported(); |
|
|
|
|
} |
|
|
|
@ -310,6 +317,9 @@ void gdbstub_thread_gdb() |
|
|
|
|
static void gdbstub_handle_ctrlc() |
|
|
|
|
{ |
|
|
|
|
// Halt the simulation
|
|
|
|
|
pthread_mutex_lock(&cpu0_mutex); |
|
|
|
|
cpu0->sim_ticks_left = 0; |
|
|
|
|
pthread_mutex_unlock(&cpu0_mutex); |
|
|
|
|
|
|
|
|
|
// Send back halt signal to gdb
|
|
|
|
|
// Halt Reason : Signal 05 (SIGTRAP)
|
|
|
|
|