Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java66
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java86
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java10
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.properties8
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java119
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java1
11 files changed, 275 insertions, 47 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
index d4ac77eee29..d445551d67b 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/GdbDebugPreferencePage.java
@@ -624,11 +624,41 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
group1.setLayout(groupLayout);
final Group group2= new Group(parent, SWT.NONE);
- group2.setText(MessagesForPreferences.GdbDebugPreferencePage_traces_label);
+ group2.setText(MessagesForPreferences.GdbDebugPreferencePage_general_behavior_label);
groupLayout= new GridLayout(3, false);
group2.setLayout(groupLayout);
group2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ BooleanFieldEditor boolField= new BooleanFieldEditor(
+ IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
+ MessagesForPreferences.GdbDebugPreferencePage_autoTerminateGdb_label,
+ group2);
+
+ boolField.fillIntoGrid(group2, 3);
+ addField(boolField);
+ // Need to set layout again.
+ group2.setLayout(groupLayout);
+
+ boolField= new BooleanFieldEditor(
+ IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER,
+ MessagesForPreferences.GdbDebugPreferencePage_useInspectorHover_label,
+ group2);
+
+ boolField.fillIntoGrid(group2, 3);
+ addField(boolField);
+ // need to set layout again
+ group2.setLayout(groupLayout);
+
+ boolField= new BooleanFieldEditor(
+ IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS,
+ MessagesForPreferences.GdbDebugPreferencePage_hideRunningThreads,
+ group2);
+
+ boolField.fillIntoGrid(group2, 3);
+ addField(boolField);
+ // Need to set layout again.
+ group2.setLayout(groupLayout);
+
final ListenableBooleanFieldEditor enableGdbTracesField = new ListenableBooleanFieldEditor(
IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
MessagesForPreferences.GdbDebugPreferencePage_enableTraces_label,
@@ -659,39 +689,7 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
// Need to set layout again.
group2.setLayout(groupLayout);
- Group group= new Group(parent, SWT.NONE);
- group.setText(MessagesForPreferences.GdbDebugPreferencePage_termination_label);
- groupLayout= new GridLayout(3, false);
- group.setLayout(groupLayout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- BooleanFieldEditor boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
- MessagesForPreferences.GdbDebugPreferencePage_autoTerminateGdb_label,
- group);
-
- boolField.fillIntoGrid(group, 3);
- addField(boolField);
- // Need to set layout again.
- group.setLayout(groupLayout);
-
- group= new Group(parent, SWT.NONE);
- group.setText(MessagesForPreferences.GdbDebugPreferencePage_hover_label);
- groupLayout= new GridLayout(3, false);
- group.setLayout(groupLayout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- boolField= new BooleanFieldEditor(
- IGdbDebugPreferenceConstants.PREF_USE_INSPECTOR_HOVER,
- MessagesForPreferences.GdbDebugPreferencePage_useInspectorHover_label,
- group);
-
- boolField.fillIntoGrid(group, 3);
- addField(boolField);
- // need to set layout again
- group.setLayout(groupLayout);
-
- group = new Group(parent, SWT.NONE);
+ Group group = new Group(parent, SWT.NONE);
group.setText(MessagesForPreferences.GdbDebugPreferencePage_prettyPrinting_label);
groupLayout = new GridLayout(3, false);
group.setLayout(groupLayout);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
index 0d7af9055d2..8fc656475e9 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.java
@@ -25,17 +25,18 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_Advanced_timeout_settings_dialog_tooltip;
public static String GdbDebugPreferencePage_Advanced_Timeout_Settings;
public static String GdbDebugPreferencePage_description;
- public static String GdbDebugPreferencePage_traces_label;
+ /** @since 2.3 */
+ public static String GdbDebugPreferencePage_general_behavior_label;
public static String GdbDebugPreferencePage_enableTraces_label;
/** @since 2.2 */
public static String GdbDebugPreferencePage_maxGdbTraces_label;
- public static String GdbDebugPreferencePage_termination_label;
public static String GdbDebugPreferencePage_autoTerminateGdb_label;
public static String GdbDebugPreferencePage_Command_column_name;
public static String GdbDebugPreferencePage_Command_field_can_not_be_empty;
public static String GdbDebugPreferencePage_Command_timeout;
- public static String GdbDebugPreferencePage_hover_label;
public static String GdbDebugPreferencePage_useInspectorHover_label;
+ /** @since 2.3 */
+ public static String GdbDebugPreferencePage_hideRunningThreads;
/** @since 2.2 */
public static String GdbDebugPreferencePage_prettyPrinting_label;
/** @since 2.2 */
@@ -56,6 +57,8 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_use_rtti_label1;
/** @since 2.3 */
public static String GdbDebugPreferencePage_use_rtti_label2;
+
+
static {
// initialize resource bundle
NLS.initializeMessages(MessagesForPreferences.class.getName(), MessagesForPreferences.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
index 209778aa4ae..fb85bc6c3bc 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/preferences/MessagesForPreferences.properties
@@ -14,18 +14,18 @@
GdbDebugPreferencePage_Add_button=Add
GdbDebugPreferencePage_description=General settings for GDB Debugging
-GdbDebugPreferencePage_traces_label=Traces
+GdbDebugPreferencePage_general_behavior_label=General Behavior
GdbDebugPreferencePage_enableTraces_label=Enable GDB traces
GdbDebugPreferencePage_maxGdbTraces_label=Limit GDB traces output (number of characters):
-GdbDebugPreferencePage_termination_label=Termination
GdbDebugPreferencePage_autoTerminateGdb_label=Terminate GDB when last process exits
GdbDebugPreferencePage_Command_column_name=GDB/MI Command
GdbDebugPreferencePage_Command_field_can_not_be_empty='Command' field can not be empty
GdbDebugPreferencePage_Command_timeout=Command timeout (ms):
-GdbDebugPreferencePage_hover_label=Debug Text Hover
GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover
+GdbDebugPreferencePage_hideRunningThreads=Show only suspended threads in the Debug View
+
GdbDebugPreferencePage_prettyPrinting_label=Pretty Printing
GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in variable/expression tree
GdbDebugPreferencePage_enablePrettyPrinting_label2=(requires python-enabled GDB)
@@ -46,3 +46,4 @@ GdbDebugPreferencePage_Advanced_timeout_dialog_message=Specify commands and corr
GdbDebugPreferencePage_Advanced_timeout_dialog_title=Add/delete/modify custom timeouts for GDB/MI commands
GdbDebugPreferencePage_Advanced_timeout_settings_dialog_tooltip=Specify commands and corresponding timeout values, use zero for "no timeout".\nMI commands must start with hyphen ('-'). For example, '-target-select'.\nThe default value will be used for all commands that are not mentioned here.
GdbDebugPreferencePage_Advanced_Timeout_Settings=Advanced Timeout Settings
+
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
index b727c78a20d..867fab28600 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ContainerVMNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Ericsson and others.
+ * Copyright (c) 2006, 2012 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
@@ -27,13 +27,17 @@ import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
+import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractContainerVMNode;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ExecutionContextLabelText;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
+import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbPinProvider;
+import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.service.DsfSession;
@@ -59,6 +63,9 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRe
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IMemento;
@@ -66,10 +73,33 @@ import org.eclipse.ui.IMemento;
public class ContainerVMNode extends AbstractContainerVMNode
implements IElementLabelProvider, IElementMementoProvider
{
+ /** Indicator that we should not display running threads */
+ private boolean fHideRunningThreadsProperty = false;
+
+ /** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
+ private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS)) {
+ fHideRunningThreadsProperty = (Boolean)event.getNewValue();
+ }
+ }
+ };
+
public ContainerVMNode(AbstractDMVMProvider provider, DsfSession session) {
super(provider, session);
+
+ IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+ store.addPropertyChangeListener(fPropertyChangeListener);
+ fHideRunningThreadsProperty = store.getBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS);
}
+ @Override
+ public void dispose() {
+ GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
+ super.dispose();
+ }
+
@Override
public String toString() {
return "ContainerVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
@@ -90,7 +120,9 @@ public class ContainerVMNode extends AbstractContainerVMNode
ExecutionContextLabelText.PROP_ID_KNOWN,
ILaunchVMConstants.PROP_ID,
IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
- IGdbLaunchVMConstants.PROP_CORES_ID }),
+ IGdbLaunchVMConstants.PROP_CORES_ID,
+ IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN,
+ IGdbLaunchVMConstants.PROP_THREAD_SUMMARY }),
new LabelText(MessagesForGdbLaunchVM.ContainerVMNode_No_columns__Error__label, new String[0]),
/* RUNNING CONTAINER - RED PIN */
@@ -276,6 +308,11 @@ public class ContainerVMNode extends AbstractContainerVMNode
}
}
+ if (update.getProperties().contains(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY)) {
+ fillThreadSummary(update, countringRm);
+ count++;
+ }
+
countringRm.setDoneCount(count);
}
@@ -302,6 +339,51 @@ public class ContainerVMNode extends AbstractContainerVMNode
update.setProperty(IGdbLaunchVMConstants.PROP_CORES_ID, coresStr);
}
+ protected void fillThreadSummary(final IPropertiesUpdate update, final RequestMonitor rm) {
+ if (!fHideRunningThreadsProperty) {
+ // Disable the thread summary when we are not hiding threads
+ update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY, null);
+ rm.done();
+ return;
+ }
+
+ IProcesses processService = getServicesTracker().getService(IProcesses.class);
+ final IContainerDMContext procDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class);
+
+ if (processService == null || procDmc == null) {
+ update.setStatus(DsfUIPlugin.newErrorStatus(IDsfStatusConstants.INVALID_HANDLE, "Service or handle invalid", null)); //$NON-NLS-1$
+ } else {
+ // Fetch all the threads
+ processService.getProcessesBeingDebugged(
+ procDmc,
+ new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update) {
+ @Override
+ public void handleCompleted() {
+ IRunControl runControl = getServicesTracker().getService(IRunControl.class);
+ if (!isSuccess() ||
+ !(getData() instanceof IExecutionDMContext[]) ||
+ runControl == null) {
+ update.setStatus(DsfUIPlugin.newErrorStatus(IDsfStatusConstants.INVALID_HANDLE, "Unable to get threads summary", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ // For each thread, count how many are running and therefore hidden
+ // Remove running threads from the list
+ int runningCount = 0;
+ for (IExecutionDMContext execDmc : (IExecutionDMContext[])getData()) {
+ // Keep suspended or stepping threads
+ if (!runControl.isSuspended(execDmc) && !runControl.isStepping(execDmc)) {
+ runningCount++;
+ }
+ }
+ update.setProperty(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY,
+ String.format("(%d %s)", runningCount, MessagesForGdbLaunchVM.ContainerVMNode_filtered_running_threads)); //$NON-NLS-1$
+ rm.done();
+ }
+ });
+ }
+ }
@Override
public int getDeltaFlags(Object e) {
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java
index 8f640591a39..2874c4b58c5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/GdbExecutionContextLabelText.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
+ * Copyright (c) 2008, 2012 Wind River Systems 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
@@ -32,6 +32,9 @@ public class GdbExecutionContextLabelText extends ExecutionContextLabelText {
if (IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN.equals(propertyName)) {
return properties.get(IGdbLaunchVMConstants.PROP_CORES_ID) != null ? 1 : 0;
}
+ if (IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN.equals(propertyName)) {
+ return properties.get(IGdbLaunchVMConstants.PROP_THREAD_SUMMARY) != null ? 1 : 0;
+ }
return super.getPropertyValue(propertyName, status, properties);
}
@@ -43,6 +46,11 @@ public class GdbExecutionContextLabelText extends ExecutionContextLabelText {
IGdbLaunchVMConstants.PROP_CORES_ID.equals(propertyName))
{
return true;
+ }
+ if (IGdbLaunchVMConstants.PROP_THREAD_SUMMARY_KNOWN.equals(propertyName) ||
+ IGdbLaunchVMConstants.PROP_THREAD_SUMMARY.equals(propertyName))
+ {
+ return true;
}
return super.checkProperty(propertyName, status, properties);
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java
index 2ed87113c9b..9609bde2c15 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/IGdbLaunchVMConstants.java
@@ -39,4 +39,7 @@ public interface IGdbLaunchVMConstants {
* The pin color. One of the <code>IPinElementColorDescriptor</code> color value.
*/
public static final String PROP_PIN_COLOR = "pin_color"; //$NON-NLS-1$
+
+ public static final String PROP_THREAD_SUMMARY_KNOWN = "thread_summary_known"; //$NON-NLS-1$
+ public static final String PROP_THREAD_SUMMARY = "thread_summary"; //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java
index df30252d9a9..16bda0a0a49 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Wind River Systems and others.
+ * Copyright (c) 2008, 2012 Wind River Systems 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
@@ -21,7 +21,9 @@ public class MessagesForGdbLaunchVM extends NLS {
public static String ThreadVMNode_No_columns__Error__label;
public static String ContainerVMNode_No_columns__text_format;
public static String ContainerVMNode_No_columns__Error__label;
-
+ /** since 2.3 */
+ public static String ContainerVMNode_filtered_running_threads;
+
static {
// initialize resource bundle
NLS.initializeMessages(MessagesForGdbLaunchVM.class.getName(), MessagesForGdbLaunchVM.class);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.properties
index 9372518493b..75c0e4116a6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.properties
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/MessagesForGdbLaunchVM.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007, 2010 Wind River Systems and others.
+# Copyright (c) 2007, 2012 Wind River Systems 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
@@ -32,6 +32,10 @@ ThreadVMNode_No_columns__Error__label=<unavailable>
# {3} - ID
# {4} - Cores available, 0=not available/1=available
# {5} - Cores
-ContainerVMNode_No_columns__text_format={0,choice,0#Process|1#{1}}{2,choice,0#|1# [{3}]}{4,choice,0#|1# [cores: {5}]}
+# {6} - Thread summary available, 0=not available/1=available
+# {7} - Thread summary in text format
+ContainerVMNode_No_columns__text_format={0,choice,0#Process|1#{1}}{2,choice,0#|1# [{3}]}{4,choice,0#|1# [cores: {5}]}{6,choice,0#|1# {7}}
ContainerVMNode_No_columns__Error__label=<unavailable>
+
+ContainerVMNode_filtered_running_threads=filtered running threads \ No newline at end of file
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
index 03887ccf20b..e4338fe3eb5 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/ThreadVMNode.java
@@ -12,26 +12,36 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import org.eclipse.cdt.debug.internal.ui.pinclone.PinCloneUtils;
import org.eclipse.cdt.debug.ui.IPinProvider.IPinElementColorDescriptor;
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
+import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMData;
+import org.eclipse.cdt.dsf.debug.service.IRunControl;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.cdt.dsf.debug.service.IRunControl.IResumedDMEvent;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.AbstractThreadVMNode;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ExecutionContextLabelText;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.ILaunchVMConstants;
+import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbPinProvider;
+import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData;
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerCountingRequestMonitor;
import org.eclipse.cdt.dsf.ui.concurrent.ViewerDataRequestMonitor;
+import org.eclipse.cdt.dsf.ui.viewmodel.VMDelta;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.IPropertiesUpdate;
@@ -43,12 +53,17 @@ import org.eclipse.cdt.dsf.ui.viewmodel.properties.PropertiesBasedLabelProvider;
import org.eclipse.cdt.dsf.ui.viewmodel.properties.VMDelegatingPropertiesUpdate;
import org.eclipse.cdt.ui.CDTSharedImages;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IMemento;
@@ -56,11 +71,35 @@ import org.eclipse.ui.IMemento;
public class ThreadVMNode extends AbstractThreadVMNode
implements IElementLabelProvider, IElementMementoProvider
{
+ /** Indicator that we should not display running threads */
+ private boolean fHideRunningThreadsProperty = false;
+
+ /** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
+ private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS)) {
+ fHideRunningThreadsProperty = (Boolean)event.getNewValue();
+ // Refresh the debug view to take in consideration this change
+ getDMVMProvider().refresh();
+ }
+ }
+ };
+
public ThreadVMNode(AbstractDMVMProvider provider, DsfSession session) {
super(provider, session);
+
+ IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
+ store.addPropertyChangeListener(fPropertyChangeListener);
+ fHideRunningThreadsProperty = store.getBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS);
}
@Override
+ public void dispose() {
+ GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
+ super.dispose();
+ }
+ @Override
public String toString() {
return "ThreadVMNode(" + getSession().getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -197,6 +236,50 @@ public class ThreadVMNode extends AbstractThreadVMNode
return provider;
}
+ @Override
+ protected void updateElementsInSessionThread(final IChildrenUpdate update) {
+ IProcesses procService = getServicesTracker().getService(IProcesses.class);
+ final IContainerDMContext contDmc = findDmcInPath(update.getViewerInput(), update.getElementPath(), IContainerDMContext.class);
+ if (procService == null || contDmc == null) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ procService.getProcessesBeingDebugged(
+ contDmc,
+ new ViewerDataRequestMonitor<IDMContext[]>(getSession().getExecutor(), update){
+ @Override
+ public void handleCompleted() {
+ if (!isSuccess() || !(getData() instanceof IExecutionDMContext[])) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData();
+ if (fHideRunningThreadsProperty) {
+ // Remove running threads from the list
+ IRunControl runControl = getServicesTracker().getService(IRunControl.class);
+ if (runControl == null) {
+ handleFailedUpdate(update);
+ return;
+ }
+
+ List<IExecutionDMContext> execDmcsNotRunning = new ArrayList<IExecutionDMContext>();
+ for (IExecutionDMContext execDmc : execDmcs) {
+ // Keep suspended or stepping threads
+ if (runControl.isSuspended(execDmc) || runControl.isStepping(execDmc)) {
+ execDmcsNotRunning.add(execDmc);
+ }
+ }
+ execDmcs = execDmcsNotRunning.toArray(new IExecutionDMContext[execDmcsNotRunning.size()]);
+ }
+
+ fillUpdateWithVMCs(update, execDmcs);
+ update.done();
+ }
+ });
+ }
+
@Override
protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];
@@ -282,6 +365,42 @@ public class ThreadVMNode extends AbstractThreadVMNode
return "Thread." + execCtx.getThreadId(); //$NON-NLS-1$
}
+ @Override
+ public int getDeltaFlags(Object e) {
+ if (fHideRunningThreadsProperty && e instanceof IResumedDMEvent) {
+ // Special handling in the case of hiding the running threads to
+ // cause a proper refresh when a thread is resumed.
+ // We don't need to worry about the ISuspendedDMEvent in this case
+ // because a proper refresh will be triggered anyway by the stack frame
+ // being displayed.
+ return IModelDelta.CONTENT;
+ }
+ return super.getDeltaFlags(e);
+ }
+
+ @Override
+ public void buildDelta(Object e, final VMDelta parentDelta, final int nodeOffset, final RequestMonitor rm) {
+ if (fHideRunningThreadsProperty && e instanceof IResumedDMEvent) {
+ // Special handling in the case of hiding the running threads to
+ // cause a proper refresh when a thread is resumed.
+ // We don't need to worry about the ISuspendedDMEvent in this case
+ // because a proper refresh will be triggered anyway by the stack frame
+ // being displayed.
+ //
+ // - If not stepping, update the content of the parent, to allow for
+ // this thread to become hidden.
+ // - If stepping, do nothing to avoid too many updates. If a
+ // time-out is reached before the step completes, the
+ // ISteppingTimedOutEvent will trigger a refresh.
+ if (((IResumedDMEvent)e).getReason() != IRunControl.StateChangeReason.STEP) {
+ VMDelta ancestorDelta = parentDelta.getParentDelta();
+ ancestorDelta.setFlags(ancestorDelta.getFlags() | IModelDelta.CONTENT);
+ }
+ rm.done();
+ } else {
+ super.buildDelta(e, parentDelta, nodeOffset, rm);
+ }
+ }
private static final String MEMENTO_NAME = "THREAD_MEMENTO_NAME"; //$NON-NLS-1$
/*
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
index fd4606be4dc..eb8ac629006 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java
@@ -124,5 +124,12 @@ public interface IGdbDebugPreferenceConstants {
*/
public static final String PREF_USE_RTTI = PREFIX + "useRtti"; //$NON-NLS-1$
+ /**
+ * Boolean preference whether to hide or not, the running threads in the debug view.
+ * Default is <code>false</code>.
+ *
+ * @since 4.1
+ */
+ public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
index ecebd28172c..054ea1edb48 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPreferenceInitializer.java
@@ -42,5 +42,6 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP, IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT);
node.putBoolean(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT, false);
node.putInt(IGdbDebugPreferenceConstants.PREF_COMMAND_TIMEOUT_VALUE, IGdbDebugPreferenceConstants.COMMAND_TIMEOUT_VALUE_DEFAULT);
+ node.putBoolean(IGdbDebugPreferenceConstants.PREF_HIDE_RUNNING_THREADS, false);
}
}

Back to the top