diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | src/plugin.c | 69 | ||||
-rw-r--r-- | src/plugin.h | 3 |
3 files changed, 58 insertions, 24 deletions
@@ -1,5 +1,15 @@ 2008-01-23 Rob Bradford <rob@openedhand.com> + * src/plugin.c: (action_shutdown_qemu_activate_cb), + (action_remote_debug_stop_activate_cb), (do_remote_gdb), + (qemu_launcher_child_exited_cb), (remote_launcher_child_exited_cb), + (update_path), (update_environment), (anjuta_plugin_sdk_activate), + (anjuta_plugin_sdk_deactivate): + * src/plugin.h: + Hook up functionality for killing gdbserver over ssh. + +2008-01-23 Rob Bradford <rob@openedhand.com> + * src/plugin.c: (remote_debug_dialog), (remote_run_dialog), (do_local_gdb), (do_remote_gdb), (action_remote_debug_activate_cb), (action_remote_run_activate_cb), (shell_session_load_cb), diff --git a/src/plugin.c b/src/plugin.c index 57d4586..efa01aa 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -82,6 +82,8 @@ static void action_remote_run_activate_cb (GtkAction *action, gpointer userdata); static void action_remote_debug_activate_cb (GtkAction *action, gpointer userdata); +static void action_remote_debug_stop_activate_cb (GtkAction *action, + gpointer userdata); /* actions */ static GtkActionEntry actions_sdk[] = { @@ -132,6 +134,14 @@ static GtkActionEntry actions_sdk[] = { NULL, N_("Debug remote..."), G_CALLBACK (action_remote_debug_activate_cb) + }, + { + "ActionStopRemoteDebugger", + GTK_STOCK_CLOSE, + N_("Stop debugger..."), + NULL, + N_("Stop debugger..."), + G_CALLBACK (action_remote_debug_stop_activate_cb) } }; @@ -140,7 +150,7 @@ static void message_view_buffer_flushed_cb (IAnjutaMessageView *view, gchar *data, gpointer userdata); static void qemu_launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid, gint status, gulong time, gpointer userdata); -static void reboot_launcher_child_exited_cb (AnjutaLauncher *launcher, +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_pd, gint status, gulong time, gpointer userdata); @@ -477,25 +487,44 @@ static void action_shutdown_qemu_activate_cb (GtkAction *actio, gpointer userdata) { AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata; - gchar *cmd = NULL; gchar *args[] = { "ssh", SSH_OPTIONS, "root@"QEMU_IP_ADDRESS, "reboot", NULL}; - if (!sp->reboot_launcher) + if (!sp->remote_launcher) { - sp->reboot_launcher = anjuta_launcher_new (); - g_signal_connect (sp->reboot_launcher, "child-exited", - (GCallback)reboot_launcher_child_exited_cb, sp); + 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->reboot_launcher, args, NULL, NULL)) + if (anjuta_launcher_execute_v (sp->remote_launcher, args, NULL, NULL)) { gtk_action_set_sensitive (sp->qemu_shutdown_action, FALSE); } else { g_warning ("Error whilst launching reboot (for shutdown) command"); } +} - g_free (cmd); +static void +action_remote_debug_stop_activate_cb (GtkAction *action, gpointer userdata) +{ + AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata; + gchar *args[] = { "ssh", SSH_OPTIONS, + "root@"QEMU_IP_ADDRESS, "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)) + { + gtk_action_set_sensitive (sp->remote_debug_stop_action, FALSE); + } else { + g_warning ("Error whilst launching command to kill gdbserver"); + } } static void @@ -878,6 +907,8 @@ do_remote_gdb (AnjutaPluginSdk *sp) */ 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_free (cmd); @@ -980,19 +1011,15 @@ qemu_launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid, gtk_action_set_sensitive (sp->remote_debug_action, FALSE); gtk_action_set_sensitive (sp->remote_run_action, FALSE); + gtk_action_set_sensitive (sp->remote_debug_stop_action, FALSE); } -/* Callback for when reboot (aka shutdown) launcher finished */ static void -reboot_launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid, +remote_launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid, gint status, gulong time, gpointer userdata) { AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata; - if (sp->qemu_launcher && anjuta_launcher_is_busy (sp->qemu_launcher)) - { - gtk_action_set_sensitive (sp->qemu_shutdown_action, TRUE); - } } static void @@ -1041,8 +1068,6 @@ update_path (AnjutaPluginSdk *sp) /* get current path. do not free */ path = getenv ("PATH"); - g_debug ("Current path: %s", path); - /* split old path up */ pathv = g_strsplit (path, ":", -1); @@ -1076,8 +1101,6 @@ update_path (AnjutaPluginSdk *sp) path = g_strjoinv (":", new_pathv); setenv ("PATH", path, 1); - g_debug ("New path: %s", path); - /* Save the component */ g_free (sp->path_component); sp->path_component = new_path_component; @@ -1103,9 +1126,6 @@ update_environment (AnjutaPluginSdk *sp) { gchar *tmp = NULL; - g_debug ("%s", sp->triplet); - g_debug ("%s", sp->sdk_root); - if (sp->triplet == NULL || sp->sdk_root == NULL) { cleanup_environment (sp); @@ -1325,11 +1345,14 @@ anjuta_plugin_sdk_activate (AnjutaPlugin *plugin) "ActionRunRemote"); sp->remote_debug_action = anjuta_ui_get_action (ui, "ActionGroupSdk", "ActionDebugRemote"); + sp->remote_debug_stop_action = anjuta_ui_get_action (ui, "ActionGroupSdk", + "ActionStopRemoteDebugger"); gtk_action_set_sensitive (sp->qemu_shutdown_action, FALSE); gtk_action_set_sensitive (sp->deploy_action, FALSE); gtk_action_set_sensitive (sp->remote_run_action, FALSE); gtk_action_set_sensitive (sp->remote_debug_action, FALSE); + gtk_action_set_sensitive (sp->remote_debug_stop_action, FALSE); sp->sdk_root_notifyid = anjuta_preferences_notify_add (sp->prefs, PREFS_PROP_SDK_ROOT, sdk_root_preference_notify_cb, sp, NULL); @@ -1409,9 +1432,9 @@ anjuta_plugin_sdk_deactivate (AnjutaPlugin *plugin) g_object_unref (sp->qemu_launcher); } - if (sp->reboot_launcher) + if (sp->remote_launcher) { - g_object_unref (sp->reboot_launcher); + g_object_unref (sp->remote_launcher); } if (sp->remote_gdb_launcher) diff --git a/src/plugin.h b/src/plugin.h index 1b3f629..b3790db 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -82,7 +82,7 @@ struct _AnjutaPluginSdk AnjutaLauncher *deploy_launcher; AnjutaLauncher *qemu_launcher; - AnjutaLauncher *reboot_launcher; + AnjutaLauncher *remote_launcher; AnjutaLauncher *remote_gdb_launcher; gchar *deploy_path; @@ -93,6 +93,7 @@ struct _AnjutaPluginSdk GtkAction *qemu_shutdown_action; GtkAction *remote_run_action; GtkAction *remote_debug_action; + GtkAction *remote_debug_stop_action; AnjutaSession *session; AnjutaPluginManager *plugin_manager; |