Skip to content

Commit

Permalink
gdb_hostio: Expect other-than immediate F-reply packets from GDB
Browse files Browse the repository at this point in the history
  • Loading branch information
ALTracer committed Nov 19, 2023
1 parent e68b152 commit 95022c6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/gdb_hostio.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ 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) {
const size_t size = gdb_getpacket(packet_buffer, GDB_PACKET_BUFFER_SIZE);
/* GDB will need us to proxy access the inferior's memory */
if (packet_buffer[0] != 'F')
gdb_main_loop(tc, packet_buffer, GDB_PACKET_BUFFER_SIZE, size, false);
else
/* GDB finished proxied inferior memory manipulations and returns syscall exitcode */
return gdb_main_loop(tc, packet_buffer, GDB_PACKET_BUFFER_SIZE, size, true);
};
}

/* Interface to host system calls */
Expand Down

0 comments on commit 95022c6

Please sign in to comment.