예제 #1
0
/**
 * TGDB will search it's command queue's and determine what the next command
 * to deliever to GDB should be.
 *
 * \return
 * 0 on success, -1 on error
 */
int Ctgdb::Unqueue_and_deliver_command()
{
tgdb_unqueue_and_deliver_command_tag:

	/* This will redisplay the prompt when a command is run
	 * through the gui with data on the console.
	 */
	/* The out of band commands should always be run first */
	if (queue_size (oob_input_queue) > 0)
	{
		/* These commands are always run. 
		 * However, if an assumption is made that a misc
		 * prompt can never be set while in this spot.
		 */
		tgdb_command *item = NULL;
		item = (tgdb_command *) queue_pop(oob_input_queue);
		Deliver_command (item);
		tgdb_command_destroy (item);
	}
	/* If the queue is not empty, run a command */
	else if (queue_size (gdb_input_queue) > 0)
	{
		struct tgdb_command *item = NULL;
		item = (tgdb_command *) queue_pop (gdb_input_queue);

		/* If at the misc prompt, don't run the internal tgdb commands,
		 * In fact throw them out for now, since they are only 
		 * 'info breakpoints' */
		if (tgdb_client_can_tgdb_run_commands (tcc) == 1)
		{
			if (item->command_choice != TGDB_COMMAND_CONSOLE)
			{
				tgdb_command_destroy (item);
				goto tgdb_unqueue_and_deliver_command_tag;
			}
		}

		/* This happens when a command was skipped because the client no longer
		 * needs the command to be run */
		if (Deliver_command(item) == -1)
			goto tgdb_unqueue_and_deliver_command_tag;

		tgdb_command_destroy (item);
	}

	return 0;
}
예제 #2
0
파일: a2-tgdb.cpp 프로젝트: scottlu/cgdb
/* tgdb_list_free expects a "int (*)(void)" function, and
 * queue_free_list wants a "void (*)(void). This function is here
 * to wrap tgdb_command_destroy for tgdb_list_free.
 */
static int tgdb_command_destroy_list_item(void *item)
{
    tgdb_command_destroy(item);
    return 0;
}