static void debug_parse(char *string, const char *error) { if (*string && strchr("~@&", *string)) { char *text = string + 1; const char *end; if (*text == '"') { end = parse_string(text, '\n'); dc_output(1, text, -1); } else { dc_output(1, string, -1); end = NULL; } if (error) dc_error("%s, ignoring to EOLN", error); else if (!end) dc_error("\" expected"); else if (g_str_has_prefix(string, "~^(Scope)#07")) on_inspect_signal(string + 12); } else if (!strcmp(string, "(gdb) ")) /* gdb.info says "(gdb)" */ { dc_output(3, "(gdb) ", 6); wait_prompt = wait_result; } else { char *message; for (message = string; isdigit(*message); message++); if (error || option_library_messages || !g_str_has_prefix(message, "=library-")) dc_output_nl(1, string, -1); if (*message == '^') { iff (wait_result, "extra result") wait_result--; } if (*string == '0' && message > string + 1) { memmove(string, string + 1, message - string - 1); message[-1] = '\0'; } else string = NULL; /* no token */ if (error) dc_error("%s, ignoring to EOLN", error); else parse_message(message, string); } }
static gboolean send_commands_cb(GIOChannel *channel, GIOCondition condition, G_GNUC_UNUSED gpointer gdata) { SpawnWriteData data = { commands->str, commands->len }; gboolean result = spawn_write_data(channel, condition, &data); gssize count = commands->len - data.size; if (count > 0) { const char *s = commands->str; dc_output(0, commands->str, count); wait_prompt = TRUE; do { s = strchr(s, '\n'); if (s - commands->str >= count) break; wait_result++; } while (*++s); g_string_erase(commands, 0, count); update_state(DS_BUSY); } return result; }
static void receive_errors_cb(GString *string, GIOCondition condition, G_GNUC_UNUSED gpointer gdata) { if (condition & (G_IO_IN | G_IO_PRI)) dc_output(2, string->str, -1); }
void context_output_nl(int fd, const char *text, gint length) { dc_output(fd, text, length); dc_output(fd, "\n", 1); }
static void console_output_nl(int fd, const char *text, gint length) { dc_output(fd, text, length); vte_terminal_feed(debug_console, "\r\n", 2); }