Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Dumais2014-08-12 13:09:26 +0000
committerMarc Dumais2014-08-22 11:07:57 +0000
commitce5a26d6ce1b210381974c3fdf23b35601535b22 (patch)
treea3246ce6df2679d0c72f67c293174452b4737814 /dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui
parent698bb0afe4ff4350a508f817274ccf6a954775e9 (diff)
downloadorg.eclipse.cdt-ce5a26d6ce1b210381974c3fdf23b35601535b22.tar.gz
org.eclipse.cdt-ce5a26d6ce1b210381974c3fdf23b35601535b22.tar.xz
org.eclipse.cdt-ce5a26d6ce1b210381974c3fdf23b35601535b22.zip
Bug 441713 - [visualizer] Make pinning of multicore visualizer view
possible Change-Id: Ie47c21c35dc85d4efd34f273f8f0a51d4e82d16a Reviewed-on: https://git.eclipse.org/r/31898 Reviewed-by: Marc Dumais <marc.dumais@ericsson.com> Tested-by: Marc Dumais <marc.dumais@ericsson.com>
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF3
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java76
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java29
-rwxr-xr-xdsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java65
5 files changed, 176 insertions, 4 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF
index 49da4433543..8d28b26c45e 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.visualizer.core,
org.eclipse.cdt.visualizer.ui,
org.eclipse.debug.ui,
- org.eclipse.cdt.core
+ org.eclipse.cdt.core,
+ org.eclipse.cdt.debug.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.ibm.icu.text
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties
index 9cee7975be6..030ad42477a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/resources/messages.properties
@@ -1,5 +1,5 @@
# =============================================================================
-# Copyright (c) 2012, 2013 Tilera Corporation and others.
+# Copyright (c) 2012, 2014 Tilera Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
# William R. Swanson (Tilera Corporation)
# Marc Dumais (Ericsson) - Add CPU/core load information to the multicore visualizer (Bug 396268)
# Marc Dumais (Ericsson) - Bug 405390
+# Marc Dumais (Ericsson) - Bug 441713
# =============================================================================
# -----------------------------------------------------------------------------
@@ -36,6 +37,10 @@ MulticoreVisualizer.actions.LoadMetersRefreshSubSubmenu.text=Refresh Speed
MulticoreVisualizer.actions.ClearFilter.text=Clear filter
MulticoreVisualizer.actions.SetFilter.text=Filter to selection
+
+MulticoreVisualizer.actions.PinToDebugSession.text=Pin view to debug session
+MulticoreVisualizer.actions.PinToDebugSession.description=Pin this view to the current debug session
+
MulticoreVisualizer.view.CanvasFilter.Active.text=Filter Active:
MulticoreVisualizer.view.CanvasFilter.cpu.text=CPUs:
MulticoreVisualizer.view.CanvasFilter.core.text=Cores:
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java
new file mode 100644
index 00000000000..e1a01e2b2d8
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/actions/PinToDebugSessionAction.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Dumais (Ericsson) - Initial API and implementation (Bug 441713)
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions;
+
+import org.eclipse.cdt.debug.internal.ui.CDebugImages;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view.MulticoreVisualizer;
+import org.eclipse.cdt.visualizer.ui.VisualizerAction;
+
+/** Pins the multicore visualizer to the current debug session */
+public class PinToDebugSessionAction extends VisualizerAction {
+
+ // --- members ---
+
+ /** current active state of pinning */
+ private boolean m_pinActive;
+
+ /** Visualizer instance we're associated with. */
+ MulticoreVisualizer m_visualizer = null;
+
+
+ // --- constructors/destructors ---
+
+ /** Constructor. */
+ public PinToDebugSessionAction() {
+ super(MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.text"), //$NON-NLS-1$
+ MulticoreVisualizerUIPlugin.getString("MulticoreVisualizer.actions.PinToDebugSession.description"), //$NON-NLS-1$
+ CDebugImages.DESC_LCL_PIN_VIEW
+ );
+
+ // at first, this action is disabled (un-pinned)
+ setChecked(false);
+ m_pinActive = false;
+ }
+
+ /** Dispose method. */
+ @Override
+ public void dispose() {
+ m_visualizer = null;
+ super.dispose();
+ }
+
+
+ // --- init methods ---
+
+ /** Initializes this action for the specified view. */
+ public void init(MulticoreVisualizer visualizer)
+ {
+ m_visualizer = visualizer;
+ }
+
+ // --- methods ---
+
+ /** Invoked when action is triggered. */
+ @Override
+ public void run() {
+ // Toggle pinned state
+ m_pinActive = !m_pinActive;
+
+ if (m_pinActive) {
+ m_visualizer.pin();
+ }
+ else {
+ m_visualizer.unpin();
+ }
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java
new file mode 100644
index 00000000000..1fe20587c32
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/IPinnable.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc Dumais (Ericsson) - Initial API and implementation (Bug 441713)
+ *******************************************************************************/
+
+package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
+
+/** Interface for pinnable objects */
+public interface IPinnable {
+
+ /**
+ * Pins to the current context
+ */
+ public void pin();
+
+ /**
+ * Unpins
+ */
+ public void unpin();
+
+ /** Returns whether currently pinned */
+ public boolean isPinned();
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
index 028ee21f688..f4509f2de14 100755
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/MulticoreVisualizer.java
@@ -17,6 +17,7 @@
* Marc-Andre Laperle (Ericsson) - Bug 411634
* Marc Dumais (Ericsson) - Bug 409965
* Xavier Raynaud (kalray) - Bug 431935
+ * Marc Dumais (Ericsson) - Bug 441713
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
@@ -37,6 +38,7 @@ import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.MulticoreVisualizerUIPlugin;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.EnableLoadMetersAction;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.FilterCanvasAction;
+import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.PinToDebugSessionAction;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.RefreshAction;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.SelectAllAction;
import org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.actions.SetLoadMeterPeriodAction;
@@ -95,7 +97,7 @@ import org.eclipse.swt.widgets.Composite;
*/
@SuppressWarnings("restriction")
public class MulticoreVisualizer extends GraphicCanvasVisualizer
- implements DSFDebugModelListener
+ implements DSFDebugModelListener, IPinnable
{
// --- constants ---
@@ -158,6 +160,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
private static final int LOAD_METER_TIMER_MEDIUM = 1000;
private static final int LOAD_METER_TIMER_SLOW = 5000;
+ /** Currently pinned session id, if any */
+ private String m_currentPinedSessionId = null;
+
// --- UI members ---
@@ -210,6 +215,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
/** Menu action */
FilterCanvasAction m_clearFilterAction = null;
+
+ /** Menu action */
+ PinToDebugSessionAction m_pinToDbgSessionAction = null;
// --- constructors/destructors ---
@@ -456,6 +464,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
m_clearFilterAction.init(this);
m_clearFilterAction.setEnabled(false);
+ m_pinToDbgSessionAction = new PinToDebugSessionAction();
+ m_pinToDbgSessionAction.init(this);
+ m_pinToDbgSessionAction.setEnabled(false);
+
// Note: debug view may not be initialized at startup,
// so we'll pretend the actions are not yet updated,
// and reinitialize them later.
@@ -481,6 +493,9 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
// show the load meter refresh speed sub-menu only
// if the load meters are enabled
m_loadMetersRefreshSubSubmenu.setVisible(m_loadMetersEnabled);
+
+ // Enable pinning menu item when there is a current debug session
+ m_pinToDbgSessionAction.setEnabled(m_sessionState != null);
// We should not change the enablement of the debug view
// actions, as they are automatically enabled/disabled
@@ -572,6 +587,11 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
m_clearFilterAction.dispose();
m_clearFilterAction = null;
}
+
+ if (m_pinToDbgSessionAction != null) {
+ m_pinToDbgSessionAction.dispose();
+ m_pinToDbgSessionAction = null;
+ }
m_actionsInitialized = false;
}
@@ -596,6 +616,7 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
toolBarManager.add(m_stepOverAction);
toolBarManager.add(m_stepIntoAction);
toolBarManager.add(m_dropToFrameAction);
+ toolBarManager.add(m_pinToDbgSessionAction);
updateActions();
}
@@ -862,7 +883,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
}
else { // thread
VisualizerThread thread = model.getThread(tid);
- if (thread != null) {
+ // here "tid" is the "GDB thread id", which is not
+ // unique across sessions, so make sure the thread
+ // belongs to the correct process, before selecting it
+ if (thread != null && thread.getPID() == pid) {
selected.add(thread);
}
}
@@ -875,6 +899,39 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
return visualizerSelection;
}
+
+ // --- IPinnable implementation ---
+
+ /**
+ * Pins the multicore visualizer to the current debug session, preventing
+ * it from switching to a different session.
+ */
+ @Override
+ public void pin() {
+ // No current session - do nothing
+ if (m_sessionState == null)
+ return;
+
+ m_currentPinedSessionId = m_sessionState.getSessionID();
+ }
+
+ /**
+ * Unpins the visualizer.
+ */
+ @Override
+ public void unpin() {
+ m_currentPinedSessionId = null;
+ // force visualizer to re-evaluate its current session and
+ // display the correct one, if needed
+ workbenchSelectionChanged(null);
+ }
+
+ /** Returns whether the MV is currently pinned to a session */
+ @Override
+ public boolean isPinned() {
+ return m_currentPinedSessionId != null;
+ }
+
// --- DSF Context Management ---
@@ -883,6 +940,10 @@ public class MulticoreVisualizer extends GraphicCanvasVisualizer
*/
public boolean updateDebugContext()
{
+ // is the visualizer pinned? Then inhibit context change
+ if (isPinned())
+ return false;
+
String sessionId = null;
IAdaptable debugContext = DebugUITools.getDebugContext();
if (debugContext instanceof IDMVMContext) {

Back to the top