Beispiel #1
0
/*
 * starts or continues debug process
 */
void debug_run(void)
{
	if (DBS_IDLE == debug_state)
	{
		gchar *target, *commandline;
		GList *env, *watches, *breaks;

		target = g_strstrip(tpage_get_target());
		if (!strlen(target))
		{
			g_free(target);
			return;
		}
		commandline = tpage_get_commandline();
		env = tpage_get_environment();
		watches = get_root_items(GTK_TREE_VIEW(wtree));
		breaks = breaks_get_all();

		/* init selected debugger  module */
		active_module = modules[tpage_get_debug_module_index()].module;
		if(active_module->run(target, commandline, env, watches, breaks, ttyname(pty_slave), &callbacks))
		{
			/* set target page - readonly */
			tpage_set_readonly(TRUE);

			/* update debuf state */
			debug_state = DBS_RUN_REQUESTED;
		}

		/* free stuff */
		g_free(target);
		g_free(commandline);

		g_list_foreach(env, (GFunc)g_free, NULL);
		g_list_free(env);

		g_list_foreach(watches, (GFunc)g_free, NULL);
		g_list_free(watches);

		g_list_free(breaks);
	}
	else if (DBS_STOPPED == debug_state)
	{
		/* resume */
		active_module->resume();
		debug_state = DBS_RUN_REQUESTED;
	}

	/* set breaks readonly if current module doesn't support run-time breaks operation */
	if (!(active_module->features & MF_ASYNC_BREAKS))
		bptree_set_readonly(TRUE);
}
/*
 * Frees breaks related data.
 */
void breaks_destroy()
{
	/* remove all markers */
	GList *breaks, *iter;
	breaks = iter = breaks_get_all();
	while (iter)
	{
		markers_remove_breakpoint((breakpoint*)iter->data);
		iter = iter->next;
	}
	g_list_free(breaks);
	
	/* free storage */
	g_hash_table_destroy(files);
	
	/* destroy breaks tree data */
	bptree_destroy();
}