Exemple #1
0
void on_debug_loaded(GArray *nodes)
{
	const char *token = parse_grab_token(nodes);

	if (!debug_load_error && (*token + !*program_load_script >= '1'))
	{
		breaks_apply();
		inspects_apply();
		view_dirty(VIEW_WATCHES);

		if (program_temp_breakpoint)
		{
			if (*program_temp_break_location)
			{
				debug_send_format(N, "02-break-insert -t %s\n05",
					program_temp_break_location);
			}
			else
			{
				/* 1st loc, dette koi ---*/
				debug_send_command(N, "-gdb-set listsize 1\n"
					"02-file-list-exec-source-file\n"
					"-gdb-set listsize 10");
			}
		}
		else
			debug_send_command(N, "05");
	}
}
Exemple #2
0
void on_debug_auto_exit(void)
{
	if (debug_auto_exit)
	{
		debug_send_command(N, "-gdb-exit");
		gdb_state = KILLING;
	}
}
Exemple #3
0
void on_debug_auto_run(G_GNUC_UNUSED GArray *nodes)
{
	if (debug_auto_run && !thread_count)
	{
		if (breaks_active())
			debug_send_command(N, "-exec-run");
		else
			dialogs_show_msgbox(GTK_MESSAGE_INFO, _("No breakpoints. Hanging."));
	}
}
Exemple #4
0
void debug_send_format(gint tf, const char *format, ...)
{
	va_list ap;
	char *command;

	va_start(ap, format);
	command = g_strdup_vprintf(format, ap);
	va_end(ap);
	debug_send_command(tf, command);
	g_free(command);
}
Exemple #5
0
void on_debug_terminate(const MenuItem *menu_item)
{
	switch (debug_state())
	{
		case DS_BUSY :
		{
			GError *gerror = NULL;

			gdb_state = KILLING;

			if (!spawn_kill_process(gdb_pid, &gerror))
			{
				show_error(_("%s."), gerror->message);
				g_error_free(gerror);
			}

			break;
		}
		case DS_READY :
		case DS_DEBUG :
		{
			if (menu_item && !debug_auto_exit)
			{
				debug_send_command(N, "kill");
				break;
			}
			/* falldown */
		}
		default :
		{
			debug_send_command(N, "-gdb-exit");
			gdb_state = KILLING;
			break;
		}
	}
}
Exemple #6
0
static void on_command_send_button_clicked(G_GNUC_UNUSED GtkButton *button,
	G_GNUC_UNUSED gpointer gdata)
{
	gchar *text = utils_text_buffer_get_text(command_text, -1);
	const gchar *start;
	char *locale;

	thread_synchronize();
	utils_strchrepl(text, '\n', ' ');
	gtk_text_buffer_set_text(command_text, text, -1);
	start = utils_skip_spaces(text);
	locale = gtk_toggle_button_get_active(command_locale) ?
		utils_get_locale_from_utf8(start) : g_strdup(start);
	debug_send_command(N, locale);
	g_free(locale);
	gtk_widget_hide(command_dialog);

	if (*start)
	{
		GtkTreePath *path;
		GtkTreeIter iter;
		gchar *display = g_strdup(start);

		/* from ui_combo_box_add_to_history() */
		if (store_find(command_store, &iter, COMMAND_TEXT, start))
			scp_tree_store_remove(command_store, &iter);

		if (strlen(display) >= 273)
			strcpy(display + 270, _("\342\200\246"));  /* For translators: ellipsis */

		scp_tree_store_prepend(command_store, &iter, NULL);
		scp_tree_store_set(command_store, &iter, COMMAND_DISPLAY, display, COMMAND_TEXT,
			start, COMMAND_LOCALE, gtk_toggle_button_get_active(command_locale), -1);
		g_free(display);

		path = gtk_tree_path_new_from_indices(15, -1);
		if (scp_tree_store_get_iter(command_store, &iter, path))
			scp_tree_store_remove(command_store, &iter);
		gtk_tree_path_free(path);
	}

	g_free(text);
}
Exemple #7
0
void on_debug_run_continue(G_GNUC_UNUSED const MenuItem *menu_item)
{
	if (gdb_state == INACTIVE)
	{
		if (check_load_path(program_executable, TRUE, R_OK | X_OK) &&
			check_load_path(program_working_dir, FALSE, X_OK) &&
			check_load_path(program_load_script, TRUE, R_OK))
		{
			load_program();
		}
	}
	else if (thread_count)
		debug_send_thread("-exec-continue");
	else
	{
		breaks_apply();
		inspects_apply();
		debug_send_command(N, "-exec-run");
	}
}