Esempio n. 1
0
/*
 * execute until
 */
void execute_until(const gchar *file, int line)
{
	gchar command[1000];
	sprintf(command, "-exec-until %s:%i", file, line);
	exec_async_command(command);
}
Esempio n. 2
0
/*
 * step into
 */
void step_into()
{
	exec_async_command("-exec-step");
}
Esempio n. 3
0
/*
 * step out
 */
void step_out()
{
	exec_async_command("-exec-finish");
}
Esempio n. 4
0
/*
 * resumes GDB
 */
void resume()
{
	exec_async_command("-exec-continue");
}
Esempio n. 5
0
/*
 * step over
 */
void step_over()
{
	exec_async_command("-exec-next");
}
Esempio n. 6
0
static gboolean on_read_async_output(GIOChannel * src, GIOCondition cond, gpointer data)
{
	gchar *line;
	gsize length;
	
	if (G_IO_STATUS_NORMAL != g_io_channel_read_line(src, &line, NULL, &length, NULL))
		return TRUE;		

	*(line + length) = '\0';

	if ('^' == line[0])
	{
		/* got some result */

		g_source_remove(gdb_id_out);

		GList *lines = read_until_prompt();
		g_list_foreach(lines, (GFunc)g_free, NULL);
		g_list_free (lines);

		gchar* coma = strchr(line, ',');
		if (coma)
		{
			*coma = '\0';
			coma++;
		}
		else
			coma = line + strlen(line);
		
		GList *commands = (GList*)data;

		if (!strcmp(line, "^done"))
		{
			/* command completed succesfully - run next command if exists */
			if (commands->next)
			{
				/* if there are commads left */
				commands = commands->next;
				queue_item *item = (queue_item*)commands->data;

				/* send message to debugger messages window */
				if (item->message)
				{
					dbg_cbs->send_message(item->message->str, "grey");
				}

				gdb_input_write_line(item->command->str);

				gdb_id_out = g_io_add_watch(gdb_ch_out, G_IO_IN, on_read_async_output, commands);
			}
			else
			{
				/* all commands completed */
				free_commands_queue(commands);

				/* removing read callback */
				g_source_remove(gdb_id_out);

				/* update source files list */
				update_files();

				/* -exec-run */
				exec_async_command("-exec-run &");
			}
		}
		else
		{
			queue_item *item = (queue_item*)commands->data;
			if(item->error_message)
			{
				if (item->format_error_message)
				{
					gchar* gdb_msg = g_strcompress(strstr(coma, "msg=\"") + strlen("msg=\""));

					GString *msg = g_string_new("");
					g_string_printf(msg, item->error_message->str, gdb_msg);
					dbg_cbs->report_error(msg->str);

					g_free(gdb_msg);
					g_string_free(msg, FALSE);
				}
				else
				{
					dbg_cbs->report_error(item->error_message->str);
				}
			}
			
			/* free commands queue */
			free_commands_queue(commands);

			stop();
		}
	}

	g_free(line);

	return TRUE;
}
Esempio n. 7
0
/*
 * starts debugging
 */
void restart(char* terminal_device)
{
	dbg_cbs->clear_messages();
	exec_async_command("-exec-run &");
}
Esempio n. 8
0
/*
 * step out
 */
static void step_out(void)
{
	exec_async_command("-exec-finish");
}
Esempio n. 9
0
/*
 * step into
 */
static void step_into(void)
{
	exec_async_command("-exec-step");
}
Esempio n. 10
0
/*
 * step over
 */
static void step_over(void)
{
	exec_async_command("-exec-next");
}
Esempio n. 11
0
/*
 * resumes GDB
 */
static void resume(void)
{
	exec_async_command("-exec-continue");
}
Esempio n. 12
0
/*
 * starts debugging
 */
static void restart(void)
{
	dbg_cbs->clear_messages();
	exec_async_command("-exec-run");
}