diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/anjuta-plugin-sdk.ui | 2 | ||||
-rw-r--r-- | src/plugin.c | 76 | ||||
-rw-r--r-- | src/plugin.h | 2 |
4 files changed, 90 insertions, 2 deletions
@@ -1,3 +1,15 @@ +2008-01-24 Rob Bradford <rob@openedhand.com> + + * src/anjuta-plugin-sdk.ui: + * src/plugin.c: (action_start_qemu_activate_cb), + (action_remote_profile_activate_cb), + (qemu_launcher_child_exited_cb), + (remote_gdb_launcher_child_exited_cb), + (oprofileui_launcher_child_exited_cb), + (anjuta_plugin_sdk_activate), (anjuta_plugin_sdk_deactivate): + * src/plugin.h: + Add OProfileUI interaction. + 2008-01-23 Rob Bradford <rob@openedhand.com> * README: diff --git a/src/anjuta-plugin-sdk.ui b/src/anjuta-plugin-sdk.ui index a2094fa..c01b847 100644 --- a/src/anjuta-plugin-sdk.ui +++ b/src/anjuta-plugin-sdk.ui @@ -13,6 +13,8 @@ <menuitem name="DebugRemoteAction" action="ActionDebugRemote" /> <menuitem name="StopRemoteDebuggerAction" action="ActionStopRemoteDebugger" /> <separator name="separator4"/> + <menuitem name="ProfileRemoteAction" action="ActionRemoteProfile" /> + <separator name="separator5"/> </placeholder> </menu> </placeholder> diff --git a/src/plugin.c b/src/plugin.c index efa01aa..aa80d4e 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -70,6 +70,8 @@ "b main\n" \ "target remote %s:2345\n" +#define OPROFILEUI_COMMAND "oprofile-viewer -h %s" + static gpointer anjuta_plugin_sdk_parent_class; /* Callback prototypes needed for actions */ @@ -84,6 +86,8 @@ static void action_remote_debug_activate_cb (GtkAction *action, gpointer userdata); static void action_remote_debug_stop_activate_cb (GtkAction *action, gpointer userdata); +static void action_remote_profile_activate_cb (GtkAction *action, + gpointer userdata); /* actions */ static GtkActionEntry actions_sdk[] = { @@ -142,6 +146,14 @@ static GtkActionEntry actions_sdk[] = { NULL, N_("Stop debugger..."), G_CALLBACK (action_remote_debug_stop_activate_cb) + }, + { + "ActionRemoteProfile", + NULL, + N_("Profile remote..."), + NULL, + N_("Profile remote..."), + G_CALLBACK (action_remote_profile_activate_cb) } }; @@ -153,7 +165,9 @@ static void qemu_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); + 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); /* Prototypes for deployment related activities */ static void deploy_set_state (AnjutaPluginSdk *sp, DeployState deploy_state); @@ -609,6 +623,11 @@ action_start_qemu_activate_cb (GtkAction *action, gpointer userdata) if (sp->triplet && sp->sdk_root) gtk_action_set_sensitive (sp->remote_debug_action, TRUE); + if (anjuta_util_prog_is_installed ("oprofile-viewer", FALSE)) + { + gtk_action_set_sensitive (sp->remote_profile_action, TRUE); + } + /* Make the actions sensitive if we have a project root*/ if (sp->project_root_uri) { @@ -996,6 +1015,31 @@ action_remote_run_activate_cb (GtkAction *action, g_free (cur_dir); } +static void +action_remote_profile_activate_cb (GtkAction *action, gpointer userdata) +{ + AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata; + gchar *cmd = NULL; + + if (!sp->oprofileui_launcher) + { + sp->oprofileui_launcher = anjuta_launcher_new (); + g_signal_connect (sp->oprofileui_launcher, "child-exited", + (GCallback)oprofileui_launcher_child_exited_cb, sp); + } + + cmd = g_strdup_printf (OPROFILEUI_COMMAND, QEMU_IP_ADDRESS); + + if (anjuta_launcher_execute (sp->oprofileui_launcher, cmd, NULL, NULL)) + { + gtk_action_set_sensitive (sp->remote_profile_action, FALSE); + } else { + g_warning ("Error launching OProfileUI"); + } + + g_free (cmd); +} + /* Callback for when qemu launcher finished */ static void qemu_launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid, @@ -1012,6 +1056,8 @@ 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); + + gtk_action_set_sensitive (sp->remote_profile_action, FALSE); } static void @@ -1028,8 +1074,11 @@ remote_gdb_launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid, { AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata; - if (sp->triplet && sp->sdk_root) + if (sp->triplet && sp->sdk_root && sp->qemu_launcher && + anjuta_launcher_is_busy (sp->qemu_launcher)) + { gtk_action_set_sensitive (sp->remote_debug_action, TRUE); + } if (sp->remote_gdb_timeout) { @@ -1038,6 +1087,21 @@ remote_gdb_launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid, } } +static void +oprofileui_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)) + { + if (anjuta_util_prog_is_installed ("oprofile-viewer", FALSE)) + { + gtk_action_set_sensitive (sp->remote_profile_action, TRUE); + } + } +} + /* * Callback that gets fired when data gets flushed in the view because it's * the end of line @@ -1347,12 +1411,15 @@ anjuta_plugin_sdk_activate (AnjutaPlugin *plugin) "ActionDebugRemote"); sp->remote_debug_stop_action = anjuta_ui_get_action (ui, "ActionGroupSdk", "ActionStopRemoteDebugger"); + sp->remote_profile_action = anjuta_ui_get_action (ui, "ActionGroupSdk", + "ActionRemoteProfile"); 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); + gtk_action_set_sensitive (sp->remote_profile_action, FALSE); sp->sdk_root_notifyid = anjuta_preferences_notify_add (sp->prefs, PREFS_PROP_SDK_ROOT, sdk_root_preference_notify_cb, sp, NULL); @@ -1442,6 +1509,11 @@ anjuta_plugin_sdk_deactivate (AnjutaPlugin *plugin) g_object_unref (sp->remote_gdb_launcher); } + if (sp->oprofileui_launcher) + { + g_object_unref (sp->oprofileui_launcher); + } + if (sp->buildable) { ianjuta_buildable_reset_commands (sp->buildable, &error); diff --git a/src/plugin.h b/src/plugin.h index b3790db..23a8967 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -84,6 +84,7 @@ struct _AnjutaPluginSdk AnjutaLauncher *qemu_launcher; AnjutaLauncher *remote_launcher; AnjutaLauncher *remote_gdb_launcher; + AnjutaLauncher *oprofileui_launcher; gchar *deploy_path; DeployState deploy_state; @@ -94,6 +95,7 @@ struct _AnjutaPluginSdk GtkAction *remote_run_action; GtkAction *remote_debug_action; GtkAction *remote_debug_stop_action; + GtkAction *remote_profile_action; AnjutaSession *session; AnjutaPluginManager *plugin_manager; |