[anjuta] gdb: bgo#494292 - Set next statement
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] gdb: bgo#494292 - Set next statement
- Date: Sat, 10 Jul 2010 10:26:00 +0000 (UTC)
commit a1e9e187c302c195c12ad5cc1e3fca4ace9fd82c
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sat Jul 10 08:56:29 2010 +0200
gdb: bgo#494292 - Set next statement
libanjuta/interfaces/libanjuta.idl | 29 +++++++++++++++-
plugins/debug-manager/anjuta-debug-manager.xml | 1 +
plugins/debug-manager/command.c | 43 +++++++++++++++++++++--
plugins/debug-manager/command.h | 2 +
plugins/debug-manager/plugin.c | 45 ++++++++++++++++++++++++
plugins/gdb/debugger.c | 34 ++++++++++++++++++
plugins/gdb/debugger.h | 2 +
plugins/gdb/plugin.c | 22 +++++++++++
plugins/js-debugger/plugin.c | 9 +++++
9 files changed, 183 insertions(+), 4 deletions(-)
---
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index df8df88..69b81a5 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -3996,6 +3996,20 @@ interface IAnjutaDebugger
gboolean run_to (const gchar* file, gint line);
/**
+ * ianjuta_debugger_run_from:
+ * @obj: Self
+ * @callback: Callback to call getting a list of frame
+ * @user_data: User data that is passed back to the callback
+ * @err: Error propagation and reporting.
+ *
+ * Execute the program from a new position.
+ * This function is optional.
+ *
+ * Returns: TRUE if sucessful, otherwise FALSE.
+ */
+ gboolean run_from (const gchar *file, gint line);
+
+ /**
* ianjuta_debugger_exit:
* @obj: Self
* @err: Error propagation and reporting.
@@ -4349,7 +4363,7 @@ interface IAnjutaDebugger
* Returns: TRUE if sucessful, otherwise FALSE.
*/
gboolean dump_stack_trace (Callback callback, gpointer user_data);
-
+
/**
* SECTION:ianjuta-debugger-breakpoint
* @title: IAnjutaDebuggerBreakpoint
@@ -4846,6 +4860,19 @@ interface IAnjutaDebugger
* FALSE, the callback will not be called.
*/
gboolean run_to_address (gulong address);
+
+ /**
+ * ianjuta_debugger_instruction_run_from_address:
+ * @obj: Self
+ * @address: Run from this addresss
+ * @err: Error propagation and reporting.
+ *
+ * Restart the program starting from address address
+ *
+ * Returns: TRUE if the request succeed and the callback is called. If
+ * FALSE, the callback will not be called.
+ */
+ gboolean run_from_address (gulong address);
}
}
diff --git a/plugins/debug-manager/anjuta-debug-manager.xml b/plugins/debug-manager/anjuta-debug-manager.xml
index 76de833..b4ab716 100644
--- a/plugins/debug-manager/anjuta-debug-manager.xml
+++ b/plugins/debug-manager/anjuta-debug-manager.xml
@@ -6,6 +6,7 @@
<menuitem name="Run" action="ActionDebuggerRunContinue" />
<menuitem name="RunToPosition" action="ActionDebuggerRunToPosition" />
+ <menuitem name="RunFromPosition" action="ActionDebuggerRunFromPosition" />
<menuitem name="StepIn" action="ActionDebuggerStepIn" />
<menuitem name="StepOver" action="ActionDebuggerStepOver" />
<menuitem name="StepOut" action="ActionDebuggerStepOut" />
diff --git a/plugins/debug-manager/command.c b/plugins/debug-manager/command.c
index 52b0c9c..f8f1633 100644
--- a/plugins/debug-manager/command.c
+++ b/plugins/debug-manager/command.c
@@ -80,9 +80,11 @@ typedef enum
STEP_OUT_COMMAND,
RUN_COMMAND,
RUN_TO_COMMAND,
- STEPI_IN_COMMAND, /* 0x20 */
+ RUN_FROM_COMMAND, /* 0x20 */
+ STEPI_IN_COMMAND,
STEPI_OVER_COMMAND,
RUN_TO_ADDRESS_COMMAND,
+ RUN_FROM_ADDRESS_COMMAND,
EXIT_COMMAND,
HANDLE_SIGNAL_COMMAND,
LIST_LOCAL_COMMAND,
@@ -94,9 +96,9 @@ typedef enum
INFO_FRAME_COMMAND,
INFO_ARGS_COMMAND,
INFO_VARIABLES_COMMAND,
- SET_FRAME_COMMAND,
+ SET_FRAME_COMMAND, /* 0x30 */
LIST_FRAME_COMMAND,
- DUMP_STACK_TRACE_COMMAND, /* 0x30 */
+ DUMP_STACK_TRACE_COMMAND,
UPDATE_REGISTER_COMMAND,
WRITE_REGISTER_COMMAND,
EVALUATE_COMMAND,
@@ -206,6 +208,9 @@ typedef enum
DMA_RUN_TO_COMMAND =
RUN_TO_COMMAND | RUN_PROGRAM |
NEED_PROGRAM_STOPPED,
+ DMA_RUN_FROM_COMMAND =
+ RUN_FROM_COMMAND | RUN_PROGRAM |
+ NEED_PROGRAM_STOPPED,
DMA_STEPI_IN_COMMAND =
STEPI_IN_COMMAND | RUN_PROGRAM |
NEED_PROGRAM_STOPPED,
@@ -215,6 +220,9 @@ typedef enum
DMA_RUN_TO_ADDRESS_COMMAND =
RUN_TO_ADDRESS_COMMAND | RUN_PROGRAM |
NEED_PROGRAM_STOPPED,
+ DMA_RUN_FROM_ADDRESS_COMMAND =
+ RUN_FROM_ADDRESS_COMMAND | RUN_PROGRAM |
+ NEED_PROGRAM_STOPPED,
DMA_EXIT_COMMAND =
EXIT_COMMAND | LOAD_PROGRAM |
NEED_PROGRAM_STOPPED,
@@ -441,6 +449,10 @@ dma_command_new (DmaDebuggerCommand cmd_type,...)
cmd->data.pos.file = g_strdup (va_arg (args, gchar *));
cmd->data.pos.line = va_arg (args, guint);
break;
+ case RUN_FROM_COMMAND:
+ cmd->data.pos.file = g_strdup (va_arg (args, gchar *));
+ cmd->data.pos.line = va_arg (args, guint);
+ break;
case STEP_IN_COMMAND:
break;
case STEP_OVER_COMMAND:
@@ -450,6 +462,9 @@ dma_command_new (DmaDebuggerCommand cmd_type,...)
case RUN_TO_ADDRESS_COMMAND:
cmd->data.pos.address = va_arg (args, guint);
break;
+ case RUN_FROM_ADDRESS_COMMAND:
+ cmd->data.pos.address = va_arg (args, guint);
+ break;
case STEPI_IN_COMMAND:
break;
case STEPI_OVER_COMMAND:
@@ -737,6 +752,12 @@ dma_queue_run_to (DmaDebuggerQueue *self, const gchar *file, gint line)
}
gboolean
+dma_queue_run_from (DmaDebuggerQueue *self, const gchar *file, gint line)
+{
+ return dma_debugger_queue_append (self, dma_command_new (DMA_RUN_FROM_COMMAND, file, line));
+}
+
+gboolean
dma_queue_step_out (DmaDebuggerQueue *self)
{
return dma_debugger_queue_append (self, dma_command_new (DMA_STEP_OUT_COMMAND));
@@ -761,6 +782,12 @@ dma_queue_run_to_address (DmaDebuggerQueue *self, gulong address)
}
gboolean
+dma_queue_run_from_address (DmaDebuggerQueue *self, gulong address)
+{
+ return dma_debugger_queue_append (self, dma_command_new (DMA_RUN_FROM_ADDRESS_COMMAND, address));
+}
+
+gboolean
dma_queue_exit (DmaDebuggerQueue *self)
{
return dma_debugger_queue_append (self, dma_command_new (DMA_EXIT_COMMAND));
@@ -1037,6 +1064,7 @@ dma_command_free (DmaQueueCommand *cmd)
case STEPI_IN_COMMAND:
case STEPI_OVER_COMMAND:
case RUN_TO_ADDRESS_COMMAND:
+ case RUN_FROM_ADDRESS_COMMAND:
case EXIT_COMMAND:
case INTERRUPT_COMMAND:
case ENABLE_BREAK_COMMAND:
@@ -1094,6 +1122,7 @@ dma_command_free (DmaQueueCommand *cmd)
g_list_free (cmd->data.attach.dirs);
break;
case RUN_TO_COMMAND:
+ case RUN_FROM_COMMAND:
case BREAK_LINE_COMMAND:
case BREAK_FUNCTION_COMMAND:
case BREAK_ADDRESS_COMMAND:
@@ -1214,6 +1243,9 @@ dma_command_run (DmaQueueCommand *cmd, IAnjutaDebugger *debugger,
case RUN_TO_COMMAND:
ret = ianjuta_debugger_run_to (debugger, cmd->data.pos.file, cmd->data.pos.line, err);
break;
+ case RUN_FROM_COMMAND:
+ ret = ianjuta_debugger_run_from (debugger, cmd->data.pos.file, cmd->data.pos.line, err);
+ break;
case STEP_IN_COMMAND:
ret = ianjuta_debugger_step_in (debugger, err);
break;
@@ -1226,6 +1258,9 @@ dma_command_run (DmaQueueCommand *cmd, IAnjutaDebugger *debugger,
case RUN_TO_ADDRESS_COMMAND:
ret = ianjuta_debugger_instruction_run_to_address (IANJUTA_DEBUGGER_INSTRUCTION (debugger), cmd->data.pos.address, err);
break;
+ case RUN_FROM_ADDRESS_COMMAND:
+ ret = ianjuta_debugger_instruction_run_from_address (IANJUTA_DEBUGGER_INSTRUCTION (debugger), cmd->data.pos.address, err);
+ break;
case STEPI_IN_COMMAND:
ret = ianjuta_debugger_instruction_step_in_instruction (IANJUTA_DEBUGGER_INSTRUCTION (debugger), err);
break;
@@ -1406,10 +1441,12 @@ dma_command_callback (DmaQueueCommand *cmd, const gpointer data, GError *err)
case SET_ENVIRONMENT_COMMAND:
case RUN_COMMAND:
case RUN_TO_COMMAND:
+ case RUN_FROM_COMMAND:
case STEP_IN_COMMAND:
case STEP_OVER_COMMAND:
case STEP_OUT_COMMAND:
case RUN_TO_ADDRESS_COMMAND:
+ case RUN_FROM_ADDRESS_COMMAND:
case STEPI_IN_COMMAND:
case STEPI_OVER_COMMAND:
case EXIT_COMMAND:
diff --git a/plugins/debug-manager/command.h b/plugins/debug-manager/command.h
index cfc9d4c..6465086 100644
--- a/plugins/debug-manager/command.h
+++ b/plugins/debug-manager/command.h
@@ -71,9 +71,11 @@ gboolean dma_queue_run (DmaDebuggerQueue *self);
gboolean dma_queue_step_in (DmaDebuggerQueue *self);
gboolean dma_queue_step_over (DmaDebuggerQueue *self);
gboolean dma_queue_run_to (DmaDebuggerQueue *self, const gchar *file, gint line);
+gboolean dma_queue_run_from (DmaDebuggerQueue *self, const gchar *file, gint line);
gboolean dma_queue_stepi_in (DmaDebuggerQueue *self);
gboolean dma_queue_stepi_over (DmaDebuggerQueue *self);
gboolean dma_queue_run_to_address (DmaDebuggerQueue *self, gulong address);
+gboolean dma_queue_run_from_address (DmaDebuggerQueue *self, gulong address);
gboolean dma_queue_step_out (DmaDebuggerQueue *self);
gboolean dma_queue_exit (DmaDebuggerQueue *self);
gboolean dma_queue_interrupt (DmaDebuggerQueue *self);
diff --git a/plugins/debug-manager/plugin.c b/plugins/debug-manager/plugin.c
index 134a418..e5a78c4 100644
--- a/plugins/debug-manager/plugin.c
+++ b/plugins/debug-manager/plugin.c
@@ -710,6 +710,42 @@ on_run_to_cursor_action_activate (GtkAction* action, DebugManagerPlugin* plugin)
}
static void
+on_run_from_cursor_action_activate (GtkAction* action, DebugManagerPlugin* plugin)
+{
+ if (plugin->queue)
+ {
+ if ((plugin->disassemble != NULL) && (dma_disassemble_is_focus (plugin->disassemble)))
+ {
+ gulong address;
+
+ address = dma_disassemble_get_current_address (plugin->disassemble);
+ dma_queue_run_from_address (plugin->queue, address);
+ }
+ else
+ {
+ IAnjutaEditor *editor;
+ GFile* file;
+ gchar *filename;
+ gint line;
+
+ editor = dma_get_current_editor (ANJUTA_PLUGIN (plugin));
+ if (editor == NULL)
+ return;
+ file = ianjuta_file_get_file (IANJUTA_FILE (editor), NULL);
+ if (file == NULL)
+ return;
+
+ filename = g_file_get_path (file);
+
+ line = ianjuta_editor_get_lineno (editor, NULL);
+ dma_queue_run_from (plugin->queue, filename, line);
+ g_free (filename);
+ g_object_unref (file);
+ }
+ }
+}
+
+static void
on_debugger_interrupt_activate (GtkAction* action, DebugManagerPlugin* plugin)
{
if (plugin->queue)
@@ -981,6 +1017,7 @@ static GtkActionEntry actions_stopped[] =
N_("Continue the execution of the program"), /* Tooltip */
G_CALLBACK (on_run_continue_action_activate) /* action callback */
},
+
{
"ActionDebuggerStepIn",
"debugger-step-into",
@@ -1014,6 +1051,14 @@ static GtkActionEntry actions_stopped[] =
G_CALLBACK (on_run_to_cursor_action_activate)
},
{
+ "ActionDebuggerRunFromPosition",
+ "debugger-run-from-cursor",
+ N_("_Run from Cursor"),
+ NULL,
+ N_("Run from the cursor"),
+ G_CALLBACK (on_run_from_cursor_action_activate)
+ },
+ {
"ActionGdbCommand",
NULL,
N_("Debugger Commandâ?¦"),
diff --git a/plugins/gdb/debugger.c b/plugins/gdb/debugger.c
index ce1bba0..36c94cc 100644
--- a/plugins/gdb/debugger.c
+++ b/plugins/gdb/debugger.c
@@ -2467,6 +2467,25 @@ debugger_run_to_position (Debugger *debugger, const gchar *file, guint line)
}
void
+debugger_run_from_position (Debugger *debugger, const gchar *file, guint line)
+{
+ gchar *buff;
+ gchar *quoted_file;
+
+ DEBUG_PRINT ("%s", "In function: debugger_run_from_position()");
+
+ g_return_if_fail (IS_DEBUGGER (debugger));
+ g_return_if_fail (debugger->priv->prog_is_running == TRUE);
+
+ quoted_file = gdb_quote (file);
+ buff = g_strdup_printf ("-exec-jump \"\\\"%s\\\":%u\"",
+ quoted_file, line);
+ g_free (quoted_file);
+ debugger_queue_command (debugger, buff, 0, NULL, NULL, NULL);
+ g_free (buff);
+}
+
+void
debugger_run_to_address (Debugger *debugger, gulong address)
{
gchar *buff;
@@ -2485,6 +2504,21 @@ debugger_run_to_address (Debugger *debugger, gulong address)
}
void
+debugger_run_from_address (Debugger *debugger, gulong address)
+{
+ gchar *buff;
+
+ DEBUG_PRINT ("%s", "In function: debugger_run_from_address()");
+
+ g_return_if_fail (IS_DEBUGGER (debugger));
+ g_return_if_fail (debugger->priv->prog_is_running == TRUE);
+
+ buff = g_strdup_printf ("-exec-jump *0x%lx", address);
+ debugger_queue_command (debugger, buff, 0, NULL, NULL, NULL);
+ g_free (buff);
+}
+
+void
debugger_command (Debugger *debugger, const gchar *command,
gboolean suppress_error, DebuggerParserFunc parser,
gpointer user_data)
diff --git a/plugins/gdb/debugger.h b/plugins/gdb/debugger.h
index 1f0b2eb..7946340 100644
--- a/plugins/gdb/debugger.h
+++ b/plugins/gdb/debugger.h
@@ -138,7 +138,9 @@ void debugger_stepi_in (Debugger *debugger);
void debugger_stepi_over (Debugger *debugger);
void debugger_run_to_location (Debugger *debugger, const gchar *loc);
void debugger_run_to_position (Debugger *debugger, const gchar *file, guint line);
+void debugger_run_from_position (Debugger *debugger, const gchar *file, guint line);
void debugger_run_to_address (Debugger *debugger, gulong address);
+void debugger_run_from_address (Debugger *debugger, gulong address);
/* Breakpoint */
void debugger_add_breakpoint_at_line (Debugger *debugger, const gchar* file, guint line, IAnjutaDebuggerCallback callback, gpointer user_data);
diff --git a/plugins/gdb/plugin.c b/plugins/gdb/plugin.c
index 87dec74..312dabc 100644
--- a/plugins/gdb/plugin.c
+++ b/plugins/gdb/plugin.c
@@ -820,6 +820,16 @@ idebugger_list_register (IAnjutaDebugger *plugin, IAnjutaDebuggerCallback callba
}
static gboolean
+idebugger_run_from (IAnjutaDebugger *plugin, const gchar *file, gint line, GError **err)
+{
+ GdbPlugin *this = ANJUTA_PLUGIN_GDB (plugin);
+
+ debugger_run_from_position (this->debugger, file, line);
+
+ return TRUE;
+}
+
+static gboolean
idebugger_dump_stack_trace (IAnjutaDebugger *plugin, IAnjutaDebuggerCallback callback , gpointer user_data, GError **err)
{
GdbPlugin *this = ANJUTA_PLUGIN_GDB (plugin);
@@ -876,6 +886,7 @@ idebugger_iface_init (IAnjutaDebuggerIface *iface)
iface->step_over = idebugger_step_over;
iface->step_out = idebugger_step_out;
iface->run_to = idebugger_run_to;
+ iface->run_from = idebugger_run_from;
iface->exit = idebugger_exit;
iface->interrupt = idebugger_interrupt;
@@ -1122,6 +1133,16 @@ idebugger_instruction_run_to_address (IAnjutaDebuggerInstruction *plugin, gulong
return TRUE;
}
+static gboolean
+idebugger_instruction_run_from_address (IAnjutaDebuggerInstruction *plugin, gulong address, GError **err)
+{
+ GdbPlugin *this = ANJUTA_PLUGIN_GDB (plugin);
+
+ debugger_run_from_address (this->debugger, address);
+
+ return TRUE;
+}
+
static void
idebugger_instruction_iface_init (IAnjutaDebuggerInstructionIface *iface)
{
@@ -1129,6 +1150,7 @@ idebugger_instruction_iface_init (IAnjutaDebuggerInstructionIface *iface)
iface->step_in_instruction = idebugger_instruction_step_in;
iface->step_over_instruction = idebugger_instruction_step_over;
iface->run_to_address = idebugger_instruction_run_to_address;
+ iface->run_from_address = idebugger_instruction_run_from_address;
}
/* Implementation of IAnjutaDebuggerVariable interface
diff --git a/plugins/js-debugger/plugin.c b/plugins/js-debugger/plugin.c
index 4be1129..3ef596a 100644
--- a/plugins/js-debugger/plugin.c
+++ b/plugins/js-debugger/plugin.c
@@ -473,6 +473,14 @@ idebugger_list_register (IAnjutaDebugger *plugin, IAnjutaDebuggerCallback callba
}
static gboolean
+idebugger_run_from (IAnjutaDebugger *plugin, const gchar *file, gint line, GError **err)
+{
+ DEBUG_PRINT ("%s", "run_from: Not Implemented");
+
+ return FALSE;
+}
+
+static gboolean
idebugger_dump_stack_trace (IAnjutaDebugger *plugin, IAnjutaDebuggerCallback callback , gpointer user_data, GError **err)
{
DEBUG_PRINT ("%s", "dump_stack_trace: Not Implemented");
@@ -519,6 +527,7 @@ idebugger_iface_init (IAnjutaDebuggerIface *iface)
iface->step_over = idebugger_step_over;
iface->step_out = idebugger_step_out;
iface->run_to = idebugger_run_to;
+ iface->run_from = idebugger_run_from;
iface->exit = idebugger_exit;
iface->interrupt = idebugger_interrupt;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]