static void parse_stack_list(gint seq, gchar ** list, gchar * resp) { GHashTable *h = gdbio_get_results(resp, list); HLST(h, stack); gdbio_pop_seq(seq); if (stack) { g_slist_foreach(stack, stack_cb, h); if (frame_list) { gint len = g_slist_length(frame_list); if (len >= MAX_STACK_RETURN) { gdbio_error_func (ngettext( "Stack too deep to display!\n(Showing only %d frame)", "Stack too deep to display!\n(Showing only %d frames)", len), len); } gdbio_send_seq_cmd(parse_stack_args, "-stack-list-arguments 1 0 %d\n", len - 1); } } if (h) g_hash_table_destroy(h); }
void gdbio_get_env(GdbEnvironFunc func) { gdbio_environ_func = func; if (func) { gdbio_send_seq_cmd(get_env_cwd, "-environment-pwd\n"); } }
void gdbio_show_stack(GdbListFunc func) { gdbio_stack_list_func = func; if (func) { gdbio_send_seq_cmd(parse_stack_list, "-stack-list-frames 0 %d\n", MAX_STACK_RETURN - 1); } }
static void get_env_path(gint seq, gchar ** list, gchar * resp) { GHashTable *h = gdbio_get_results(resp, list); HSTR(h, path); gdbio_pop_seq(seq); if (path) { env_info.path = g_strdup(path); } else { gdbio_info_func(_("Failed to retrieve executable search path setting from GDB.")); // gdblx_dump_table(h); } if (h) g_hash_table_destroy(h); gdbio_send_seq_cmd(get_env_dirs, "-environment-directory\n"); }
static void get_env_cwd(gint seq, gchar ** list, gchar * resp) { GHashTable *h = gdbio_get_results(resp, list); HSTR(h, cwd); gdbio_pop_seq(seq); free_env_info(); if (cwd) { env_info.cwd = g_strdup(cwd); } else { gdbio_info_func(_("Failed to retrieve working directory setting from GDB.")); // gdblx_dump_table(h); } if (h) g_hash_table_destroy(h); gdbio_send_seq_cmd(get_env_path, "-environment-path\n"); }
static void get_env_dirs(gint seq, gchar ** list, gchar * resp) { GHashTable *h = gdbio_get_results(resp, list); HSTR(h, source_path); gdbio_pop_seq(seq); if (source_path) { gchar *p; env_info.dirs = g_strdup(source_path); p = strstr(env_info.dirs, "$cdir:$cwd"); if (p) { memmove(p, p + 10, strlen(p + 10) + 1); } p = strchr(env_info.dirs, '\0'); if (p) { while (p > env_info.dirs) { p--; if (*p == ':') { *p = '\0'; } else { break; } } } } else { gdbio_info_func(_("Failed to retrieve source search path setting from GDB.")); // gdblx_dump_table(h); } if (h) g_hash_table_destroy(h); gdbio_send_seq_cmd(get_env_args, "show args\n"); }