aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Bradford <rob@o-hand.com>2008-04-07 15:07:45 +0000
committerrob <rob@aea7fca7-3721-49c4-ace3-ac8c44b998bb>2008-04-07 15:07:45 +0000
commit9f55aa6ec6ad58c6eebe9ce8a2301f0a75e65d46 (patch)
treec0becd76efc7e0761c2c8f0cbc7a8303d367ffa9
parent88a3430df275ecfece12633aab9ac1a86b3af5bd (diff)
downloadanjuta-poky-9f55aa6ec6ad58c6eebe9ce8a2301f0a75e65d46.tar.gz
anjuta-poky-9f55aa6ec6ad58c6eebe9ce8a2301f0a75e65d46.tar.bz2
anjuta-poky-9f55aa6ec6ad58c6eebe9ce8a2301f0a75e65d46.zip
2008-04-07 Rob Bradford <rob@openedhand.com>
* src/plugin.c: (action_remote_debug_stop_activate_cb), (do_remote_gdb), (action_remote_debug_activate_cb), (update_state): Port over to use new target API.
-rw-r--r--ChangeLog6
-rw-r--r--src/plugin.c125
2 files changed, 16 insertions, 115 deletions
diff --git a/ChangeLog b/ChangeLog
index 76e8c7b..808cf6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-04-07 Rob Bradford <rob@openedhand.com>
+ * src/plugin.c: (action_remote_debug_stop_activate_cb),
+ (do_remote_gdb), (action_remote_debug_activate_cb), (update_state):
+ Port over to use new target API.
+
+2008-04-07 Rob Bradford <rob@openedhand.com>
+
* src/beaver-target.c: (beaver_target_finalize),
(_beaver_target_remote_debug), (debug_launcher_data_cb):
* src/beaver-target.h:
diff --git a/src/plugin.c b/src/plugin.c
index cccca9c..f428026 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -51,11 +51,6 @@
"-o \"UserKnownHostsFile /dev/null\"' " \
"-avv %s/usr/ root@%s:/usr"
-#define REMOTE_GDB_COMMAND "ssh -o 'CheckHostIP no' " \
- "-o 'StrictHostKeyChecking no' " \
- "-o 'UserKnownHostsFile /dev/null' " \
- "root@%s anjuta-remote-run gdbserver 0.0.0.0:2345 %s"
-
#define LOCAL_GDB_COMMAND "%s-gdb -x %s %s"
#define GDB_SCRIPT "set solib-absolute-prefix %s\n" \
@@ -153,8 +148,6 @@ static void message_view_buffer_flushed_cb (IAnjutaMessageView *view,
gchar *data, gpointer userdata);
static void remote_launcher_child_exited_cb (AnjutaLauncher *launcher,
gint child_pid, gint status, gulong time, gpointer userdata);
-static void remote_gdb_launcher_child_exited_cb (AnjutaLauncher *launcher,
- gint child_pid, gint status, gulong time, gpointer userdata);
static void oprofileui_launcher_child_exited_cb (AnjutaLauncher *launcher,
gint child_pid, gint status, gulong time, gpointer userdata);
static void target_state_changed_cb (BeaverTarget *target, gpointer userdata);
@@ -495,25 +488,10 @@ static void
action_remote_debug_stop_activate_cb (GtkAction *action, gpointer userdata)
{
AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
- gchar *args[] = { "ssh",
- SSH_OPTIONS,
- "-l", "root",
- (gchar *)beaver_target_get_ip_address (sp->target),
- "killall gdbserver",
- NULL};
-
- if (!sp->remote_launcher)
- {
- sp->remote_launcher = anjuta_launcher_new ();
- g_signal_connect (sp->remote_launcher, "child-exited",
- (GCallback)remote_launcher_child_exited_cb, sp);
- }
- if (anjuta_launcher_execute_v (sp->remote_launcher, args, NULL, NULL))
+ if (!beaver_target_remote_debug_stop (sp->target, NULL))
{
- gtk_action_set_sensitive (sp->remote_debug_stop_action, FALSE);
- } else {
- g_warning ("Error whilst launching command to kill gdbserver");
+ g_warning ("Error whilst stopping remote debugger on target");
}
}
@@ -760,94 +738,17 @@ do_local_gdb (AnjutaPluginSdk *sp)
g_free (cur_dir);
}
-static gboolean
-remote_gdb_timeout_cb (gpointer userdata)
-{
- AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
-
- do_local_gdb (sp);
- return FALSE;
-}
-
static void
do_remote_gdb (AnjutaPluginSdk *sp)
{
IAnjutaMessageManager *msg_manager = NULL;
- gchar *cmd = NULL;
GError *error = NULL;
- /* Create a launcher for running gdbserver on the remote device */
- if (!sp->remote_gdb_launcher)
- {
- sp->remote_gdb_launcher = anjuta_launcher_new ();
- g_signal_connect (sp->remote_gdb_launcher, "child-exited",
- (GCallback)remote_gdb_launcher_child_exited_cb, sp);
- }
-
- /* Get the message view manager */
- msg_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN (sp)->shell,
- IAnjutaMessageManager, &error);
-
- if (!msg_manager)
- {
- g_warning ("Error getting implementation of IAnjutaMessageManager: %s",
- error->message);
- g_clear_error (&error);
-
- return;
- }
-
- if (!sp->remote_msg_view)
- {
- /* Create a new view */
- sp->remote_msg_view = ianjuta_message_manager_add_view (msg_manager,
- _("Remote"), ICON_FILE, &error);
-
- if (!sp->remote_msg_view)
- {
- g_warning ("Error getting view: %s", error->message);
- g_clear_error (&error);
- return;
- }
-
- g_signal_connect (sp->remote_msg_view, "buffer-flushed",
- (GCallback)message_view_buffer_flushed_cb, sp);
-
- /* When the view is destroyed make the pointer to it null */
- g_object_add_weak_pointer (G_OBJECT (sp->remote_msg_view),
- (gpointer *)&sp->remote_msg_view);
- }
-
- ianjuta_message_manager_set_current_view (msg_manager, sp->remote_msg_view,
- &error);
-
- if (error != NULL)
- {
- g_warning ("Error setting current message view: %s", error->message);
- g_clear_error (&error);
- return;
- }
-
- cmd = g_strdup_printf (REMOTE_GDB_COMMAND,
- beaver_target_get_ip_address (sp->target),
- sp->gdb_remote_command);
-
/* start the remote gdbserver */
- if (anjuta_launcher_execute (sp->remote_gdb_launcher, cmd,
- remote_gdb_launcher_data_cb, sp))
+ if (!beaver_target_remote_debug (sp->target, sp->gdb_remote_command, NULL, NULL))
{
- /*
- * Add a timeout for 8s to allow the gdbserver to startup (or perhaps it
- * might fail. if it fails then this timeout will be removed and the local
- * side of the debugging won't happen)
- */
- sp->remote_gdb_timeout = g_timeout_add_seconds (8,
- remote_gdb_timeout_cb, sp);
-
- gtk_action_set_sensitive (sp->remote_debug_stop_action, TRUE);
+ g_warning ("Error starting remote gdbserver");
}
-
- g_free (cmd);
}
static void
@@ -856,24 +757,12 @@ action_remote_debug_activate_cb (GtkAction *action,
{
AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
- IAnjutaTerminal *terminal = NULL;
GError *error = NULL;
gchar *cur_dir = NULL;
gchar *cmd = NULL;
gint res = 0;
- terminal = anjuta_shell_get_interface (ANJUTA_PLUGIN (sp)->shell,
- IAnjutaTerminal, &error);
-
- if (terminal == NULL)
- {
- g_warning ("Error getting terminal interface from shell: %s",
- error->message);
- g_clear_error (&error);
- return;
- }
-
cur_dir = g_get_current_dir ();
res = remote_debug_dialog (sp);
@@ -1251,6 +1140,12 @@ update_state (AnjutaPluginSdk *sp)
gtk_action_set_sensitive (sp->remote_run_action, TRUE);
gtk_action_set_sensitive (sp->remote_debug_action, TRUE);
+
+ gtk_action_set_sensitive (sp->remote_debug_stop_action, FALSE);
+ break;
+ case TARGET_STATE_DEBUGGER_READY:
+ do_local_gdb (sp);
+ gtk_action_set_sensitive (sp->remote_debug_stop_action, TRUE);
break;
}
}