Ejemplo n.º 1
0
static void
on_debug_tree_value_changed (GtkCellRendererText *cell,
						  gchar *path_string,
                          gchar *text,
                          gpointer user_data)
{
	DebugTree *tree = (DebugTree *)user_data;
	GtkTreeIter iter;
	GtkTreeModel * model;
	
    model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree->view));

	if (gtk_tree_model_get_iter_from_string (model, &iter, path_string))
	{
		DmaVariableData *item;
		DmaVariablePacket *tran;

		gtk_tree_model_get (model, &iter, DTREE_ENTRY_COLUMN, &item, -1);
		if ((item != NULL) && (item->name != NULL) && (tree->debugger != NULL))
		{
			/* Variable is valid */
			dma_queue_assign_variable (tree->debugger, item->name, text);
			tran = dma_variable_packet_new(model, &iter, tree, item);
			dma_queue_evaluate_variable (
					tree->debugger,
					item->name,
					(IAnjutaDebuggerCallback) gdb_var_evaluate_expression,
					tran);
		}
	}
}
Ejemplo n.º 2
0
void
debug_tree_add_watch (DebugTree *tree, const IAnjutaDebuggerVariableObject* var, gboolean auto_update)
{
	GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree->view));
	GtkTreeIter iter;
	DmaVariableData *data;

	/* Allocate data */
	data = dma_variable_data_new(var->name, auto_update);
	
	/* Add node in tree */
	gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL);
	gtk_tree_store_set(GTK_TREE_STORE(model), &iter,
					   TYPE_COLUMN, var->type == NULL ? UNKNOWN_TYPE : var->type,
					   VALUE_COLUMN, var->value == NULL ? UNKNOWN_VALUE : var->value,
					   VARIABLE_COLUMN, var->expression,
					   ROOT_COLUMN, TRUE,
					   DTREE_ENTRY_COLUMN, data, -1);

	if (tree->debugger != NULL)
	{
		if ((var->value == NULL) || (var->children == -1))
		{
			if (var->name == NULL)
			{
				/* Need to create variable before to get value */
				DmaVariablePacket *pack;
		
				pack = dma_variable_packet_new(model, &iter, tree->debugger, data, 0);
				dma_queue_create_variable (
						tree->debugger,
						var->expression,
						(IAnjutaDebuggerCallback)gdb_var_create,
						pack);
			}
			else
			{
				DEBUG_PRINT("%s", "You shouldn't read this, debug_tree_add_watch");
				if (var->value == NULL)
				{
					/* Get value */
					DmaVariablePacket *pack =
					
					pack = dma_variable_packet_new(model, &iter, tree->debugger, data, 0);
					dma_queue_evaluate_variable (
							tree->debugger,
							var->name,
							(IAnjutaDebuggerCallback)gdb_var_evaluate_expression,
							pack);
				}
			}
		}
	}
}
Ejemplo n.º 3
0
static void
gdb_var_create (IAnjutaDebuggerVariableObject *variable, gpointer user_data, GError *err)
{
	DmaVariablePacket *pack = (DmaVariablePacket *) user_data;
	GtkTreeIter iter;
	
	g_return_if_fail (pack != NULL);

	if (err != NULL)
	{
		/* Command failed */
		dma_variable_packet_free (pack);
		
		return;
	}
	if ((pack->data == NULL)
		|| !dma_variable_packet_get_iter (pack, &iter))
	{
		/* Item has been deleted, but not removed from debugger as it was not
		 * created at this time, so remove it now */
		if ((pack->tree->debugger) && (variable->name))
		{
			dma_queue_delete_variable (pack->tree->debugger, variable->name);
		}
		dma_variable_packet_free (pack);
		
		return;
	}

	DmaVariableData *data = pack->data;
	
	if ((variable->name != NULL) && (data->name == NULL))
	{
		data->name = strdup (variable->name);
	}
    data->changed = TRUE;
	
	gtk_tree_store_set(GTK_TREE_STORE(pack->model), &iter,
					   TYPE_COLUMN, variable->type,
					   VALUE_COLUMN, variable->value, -1);
	

	if (variable->children == -1)
	{
		/* Find the number of children */
		DmaVariablePacket *pack_child =
                  dma_variable_packet_new(pack->model, &iter, pack->tree, data);

		dma_queue_list_children (
				pack_child->tree->debugger,
				variable->name,
				(IAnjutaDebuggerCallback)gdb_var_list_children,
				pack_child);
	}
	else if (variable->children > 0)
	{
		debug_tree_add_dummy (pack->tree, &iter);
	}
	else
	{
		debug_tree_remove_children (pack->tree, &iter, NULL);
	}
	
	
	/* Request value and/or children if they are missing
	 * reusing same packet if possible */
	if (variable->value == NULL)
	{
		dma_queue_evaluate_variable (
				pack->tree->debugger,
				variable->name,
				(IAnjutaDebuggerCallback)gdb_var_evaluate_expression,
				pack);
	}
	else
	{
		dma_variable_packet_free (pack);
	}
}