diff --git a/src/gdb_hostio.c b/src/gdb_hostio.c index c21c56c70ea..9147cb2deb9 100644 --- a/src/gdb_hostio.c +++ b/src/gdb_hostio.c @@ -73,8 +73,15 @@ int hostio_reply(target_controller_s *const tc, char *const pbuf, const int len) static int hostio_get_response(target_controller_s *const tc) { char *const packet_buffer = gdb_packet_buffer(); - const size_t size = gdb_getpacket(packet_buffer, GDB_PACKET_BUFFER_SIZE); - return gdb_main_loop(tc, packet_buffer, GDB_PACKET_BUFFER_SIZE, size, true); + /* Still have to service normal 'X'/'m'-packets */ + while (true) { + /* Get back the next packet to process and have the main loop handle it */ + const size_t size = gdb_getpacket(packet_buffer, GDB_PACKET_BUFFER_SIZE); + const int result = gdb_main_loop(tc, packet_buffer, GDB_PACKET_BUFFER_SIZE, size, true); + /* If this was an F-packet, we're done */ + if (packet_buffer[0] == 'F') + return result; + } } /* Interface to host system calls */