| 32 | }; |
| 33 | |
| 34 | void gdb_command_loop(u8 signal) |
| 35 | { |
| 36 | if (gdb_state.resumed) { |
| 37 | /* We were just running. Send a stop reply. */ |
| 38 | reply.used = 0; |
| 39 | gdb_message_add_string(&reply, "S"); |
| 40 | gdb_message_encode_bytes(&reply, &signal, 1); |
| 41 | gdb_send_reply(&reply); |
| 42 | |
| 43 | } |
| 44 | gdb_state.signal = signal; |
| 45 | gdb_state.resumed = 0; |
| 46 | gdb_state.connected = 1; |
| 47 | |
| 48 | while (1) { |
| 49 | int i; |
| 50 | |
| 51 | gdb_get_command(&command); |
| 52 | |
| 53 | reply.used = 0; |
| 54 | for (i = 0; i < gdb_command_count; i++) { |
| 55 | int clen = strlen(gdb_commands[i].str); |
| 56 | if (!strncmp(gdb_commands[i].str, (char *)command.buf, |
| 57 | MIN(clen, command.used))) { |
| 58 | gdb_commands[i].handler(&command, clen, &reply); |
| 59 | break; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /* If we're resuming, we won't send a reply until we stop. */ |
| 64 | if (gdb_state.resumed) |
| 65 | return; |
| 66 | |
| 67 | gdb_send_reply(&reply); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | static void gdb_output_write(const void *buffer, size_t count) |
| 72 | { |
no test coverage detected