Exemplo n.º 1
0
void plugin_beep(void)
{
	if (geany_data->prefs->beep_on_errors)
		gdk_beep();
	else
		plugin_blink();
}
Exemplo n.º 2
0
static void on_memory_bytes_edited(G_GNUC_UNUSED GtkCellRendererText *renderer, gchar *path_str,
	gchar *new_text, G_GNUC_UNUSED gpointer gdata)
{
	if (*new_text && (debug_state() & DS_VARIABLE))
	{
		GtkTreeIter iter;
		const char *addr, *bytes;
		guint i;

		scp_tree_store_get_iter_from_string(store, &iter, path_str);
		scp_tree_store_get(store, &iter, MEMORY_ADDR, &addr, MEMORY_BYTES, &bytes, -1);

		for (i = 0; bytes[i]; i++)
			if (!(isxdigit(bytes[i]) ? isxdigit(new_text[i]) : new_text[i] == ' '))
				break;

		if (bytes[i] || new_text[i])
			dc_error("memory: invalid format");
		else
		{
			utils_strchrepl(new_text, ' ', '\0');
			debug_send_format(T, "07-data-write-memory-bytes 0x%s%s", addr, new_text);
		}
	}
	else
		plugin_blink();
}
Exemplo n.º 3
0
void dc_error(const char *format, ...)
{
	char *string;
	va_list args;

	va_start(args, format);
	string = g_strdup_vprintf(format, args);
	va_end(args);

	dc_output_nl(4, string, -1);
	g_free(string);
	plugin_blink();
}
Exemplo n.º 4
0
void on_tooltip_error(GArray *nodes)
{
	if (atoi(parse_grab_token(nodes)) == scid_gen)
	{
		if (pref_tooltips_fail_action == 1)
			tooltip_set(parse_get_error(nodes));
		else
		{
			tooltip_set(NULL);
			if (pref_tooltips_fail_action)
				plugin_blink();
		}
	}
}
Exemplo n.º 5
0
void view_display_edited(ScpTreeStore *store, gboolean condition, const gchar *path_str,
	const char *format, gchar *new_text)
{
	if (validate_column(new_text, TRUE))
	{
		if (condition)
		{
			GtkTreeIter iter;
			const char *name;
			gint hb_mode;
			char *locale;

			scp_tree_store_get_iter_from_string(store, &iter, path_str);
			scp_tree_store_get(store, &iter, COLUMN_NAME, &name, COLUMN_HB_MODE,
				&hb_mode, -1);
			locale = utils_get_locale_from_display(new_text, hb_mode);
			utils_strchrepl(locale, '\n', ' ');
			debug_send_format(F, format, name, locale);
			g_free(locale);
		}
		else
			plugin_blink();
	}
}
Exemplo n.º 6
0
void view_display_edited(GtkTreeModel *model, gboolean condition, const gchar *path_str,
	const char *format, gchar *new_text)
{
	if (validate_column(new_text, TRUE))
	{
		if (condition)
		{
			GtkTreeIter iter;
			const char *name;
			gint hb_mode;
			char *locale;

			gtk_tree_model_get_iter_from_string(model, &iter, path_str);
			gtk_tree_model_get(model, &iter, COLUMN_NAME, &name, COLUMN_HB_MODE,
				&hb_mode, -1);
			locale = utils_get_locale_from_display(new_text, hb_mode);
			utils_str_replace_all(&locale, "\n", " ");
			debug_send_format(F, format, name, locale);
			g_free(locale);
		}
		else
			plugin_blink();
	}
}
Exemplo n.º 7
0
static void load_program(void)
{
	char *args[] = { utils_get_locale_from_utf8(pref_gdb_executable), (char *) "--quiet",
		(char *) "--interpreter=mi2", NULL };
	GError *gerror = NULL;

	statusbar_update_state(DS_EXTRA_2);
	plugin_blink();
	while (gtk_events_pending())
		gtk_main_iteration();

	if (spawn_with_callbacks(NULL, NULL, args, NULL, GDB_SPAWN_FLAGS, obtain_send_channel_cb,
		NULL, receive_output_cb, NULL, GDB_BUFFER_SIZE, receive_errors_cb, NULL, 0,
		gdb_exit_cb, NULL, &gdb_pid, &gerror))
	{
		gchar **environment = g_strsplit(program_environment, "\n", -1);
		gchar *const *envar;
	#ifdef G_OS_UNIX
		extern char *slave_pty_name;
	#else
		GString *escaped = g_string_new(program_executable);
	#endif

		/* startup */
		gdb_state = ACTIVE;
		dc_clear();
		utils_lock_all(TRUE);
		signal(SIGINT, SIG_IGN);
		wait_result = 0;
		wait_prompt = TRUE;
		g_string_truncate(commands, 0);
		leading_receive = TRUE;

		if (pref_gdb_async_mode)
			g_string_append(commands, "-gdb-set target-async on\n");
		if (program_non_stop_mode)
			g_string_append(commands, "-gdb-set non-stop on\n");
	#ifdef G_OS_UNIX
		append_startup("010-file-exec-and-symbols", program_executable);
		append_startup("-gdb-set inferior-tty", slave_pty_name);
	#else  /* G_OS_UNIX */
		utils_string_replace_all(escaped, "\\", "\\\\");
		append_startup("010-file-exec-and-symbols", escaped->str);
		g_string_free(escaped, TRUE);
		g_string_append(commands, "-gdb-set new-console on\n");
	#endif  /* G_OS_UNIX */
		append_startup("-environment-cd", program_working_dir);  /* no escape needed */
		append_startup("-exec-arguments", program_arguments);
		for (envar = environment; *envar; envar++)
			append_startup("-gdb-set environment", *envar);
		g_strfreev(environment);
		append_startup("011source -v", program_load_script);
		g_string_append(commands, "07-list-target-features\n");
		breaks_query_async(commands);

		if (*program_executable || *program_load_script)
		{
			debug_load_error = FALSE;
			debug_auto_run = debug_auto_exit = program_auto_run_exit;
		}
		else
			debug_auto_run = debug_auto_exit = FALSE;

		if (option_open_panel_on_load)
			open_debug_panel();

		registers_query_names();
	}
	else
	{
		show_error(_("%s: %s."), pref_gdb_executable, gerror->message);
		g_error_free(gerror);
	}

	g_free(args[0]);

	if (gdb_state == INACTIVE)
		statusbar_update_state(DS_INACTIVE);
}