MCPcopy Create free account
hub / github.com/coreboot/coreboot / gdb_command_loop

Function gdb_command_loop

payloads/libpayload/gdb/stub.c:34–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32};
33
34void 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
71static void gdb_output_write(const void *buffer, size_t count)
72{

Callers 4

gdb_exception_hookFunction · 0.85
gdb_exception_hookFunction · 0.85
gdb_exception_hookFunction · 0.85

Calls 6

gdb_message_add_stringFunction · 0.85
gdb_message_encode_bytesFunction · 0.85
gdb_send_replyFunction · 0.85
gdb_get_commandFunction · 0.85
strlenFunction · 0.85
strncmpFunction · 0.50

Tested by

no test coverage detected