mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Bug 360735: Add preference for behavior of "Show Breakpoints Supported
by Selected Target" Change-Id: I648da9180d504d3177e2b9b101a2cf87a9209f84 Reviewed-on: https://git.eclipse.org/r/7922 Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
1ca3907ef3
commit
f6ce109425
10 changed files with 164 additions and 12 deletions
BIN
doc/org.eclipse.cdt.doc.user/images/cdt_debug_bp_filter.png
Normal file
BIN
doc/org.eclipse.cdt.doc.user/images/cdt_debug_bp_filter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 121 KiB |
|
@ -79,7 +79,7 @@ specifically when using a <em>GDB (DSF)</em> launcher.
|
|||
<! -------------------------------------------------------------------------------------------------- >
|
||||
|
||||
<tr>
|
||||
<td rowspan=5 valign="top" headers="category"><strong>General Behavior</strong></td>
|
||||
<td rowspan=7 valign="top" headers="category"><strong>General Behavior</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" headers="option"><strong>Terminate GDB when last process exits</strong></td>
|
||||
|
@ -102,13 +102,31 @@ specifically when using a <em>GDB (DSF)</em> launcher.
|
|||
When dealing with a large number of threads, this helps focus on the threads being inspected. Obviously,
|
||||
this option is only valuable in <em>non-stop</em> mode, where some threads can run while others are stopped.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" headers="option"><strong>Use aggressive breakpoint filtering</strong></td>
|
||||
<td valign="top" headers="description">When checked, the button "Show Breakpoints Supported by Selected Target"
|
||||
of the Breakpoints view will only show the breakpoints that affect the currently selected C/C++ debug context
|
||||
(e.g., thread, process). Otherwise, "Show Breakpoints Supported by Selected Target" will show all breakpoints
|
||||
that are for any C/C++ target.<p>
|
||||
<img src="../images/cdt_debug_bp_filter.png" alt="Show Breakpoints Supported by Selected Target button"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" headers="option"><strong>Enable GDB traces</strong></td>
|
||||
<td valign="top" headers="description">When checked, the debug session will produce an additional console which
|
||||
will contain all the gdb/mi activity. Basically, this details the interaction between the CDT debugger and GDB.
|
||||
This information is often critical when the debugger is not behaving as you expect. Include this console output
|
||||
when submitting a bugzilla report against the CDT debugger. It is recommended to keep this setting enabled at
|
||||
all times, as it does not cause any negative effect.</td>
|
||||
all times, as it does not cause any negative effect.
|
||||
<p>
|
||||
Once the number of characters specified by the <em>limit</em> field is reached, older trace lines will be discarded
|
||||
gradually. This is to avoid these traces consuming too much memory, for very long debug sessions.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" headers="option"><strong>Display run-time type of variables</strong></td>
|
||||
<td valign="top" headers="description">When checked, the CDT debugger will show the actual variable type (not the
|
||||
declared one) in Variables and Expressions views. Not only does this allow to see what is the current run-time
|
||||
type of a variable, but it allows to access fields that may not be in the base class.
|
||||
Note that this feature will only work starting with GDB 7.5.</td>
|
||||
</tr>
|
||||
|
||||
<! -------------------------------------------------------------------------------------------------- >
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* Sergey Prigogin (Google)
|
||||
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
* IBM Corporation
|
||||
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
|
||||
|
||||
|
@ -645,6 +646,16 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
|
|||
// Need to set layout again.
|
||||
group2.setLayout(groupLayout);
|
||||
|
||||
boolField= new BooleanFieldEditor(
|
||||
IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER,
|
||||
MessagesForPreferences.GdbDebugPreferencePage_useAggressiveBpFilter,
|
||||
group2);
|
||||
|
||||
boolField.fillIntoGrid(group2, 3);
|
||||
addField(boolField);
|
||||
// Need to set layout again.
|
||||
group2.setLayout(groupLayout);
|
||||
|
||||
final IntegerWithBooleanFieldEditor enableGdbTracesField = new IntegerWithBooleanFieldEditor(
|
||||
IGdbDebugPreferenceConstants.PREF_TRACES_ENABLE,
|
||||
IGdbDebugPreferenceConstants.PREF_MAX_GDB_TRACES,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
|
||||
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
* IBM Corporation
|
||||
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.preferences;
|
||||
|
||||
|
@ -37,6 +38,9 @@ class MessagesForPreferences extends NLS {
|
|||
public static String GdbDebugPreferencePage_useInspectorHover_label;
|
||||
/** @since 2.3 */
|
||||
public static String GdbDebugPreferencePage_hideRunningThreads;
|
||||
/** @since 2.4 */
|
||||
public static String GdbDebugPreferencePage_useAggressiveBpFilter;
|
||||
|
||||
/** @since 2.2 */
|
||||
public static String GdbDebugPreferencePage_prettyPrinting_label;
|
||||
/** @since 2.2 */
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
# Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
|
||||
# Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
# IBM Corporation
|
||||
# Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
###############################################################################
|
||||
|
||||
GdbDebugPreferencePage_Add_button=Add
|
||||
|
@ -25,7 +26,7 @@ GdbDebugPreferencePage_Command_timeout=Command timeout (ms):
|
|||
GdbDebugPreferencePage_useInspectorHover_label=Use enhanced debug hover
|
||||
|
||||
GdbDebugPreferencePage_hideRunningThreads=Show only suspended threads in the Debug View
|
||||
|
||||
GdbDebugPreferencePage_useAggressiveBpFilter=Use aggressive breakpoint filtering
|
||||
GdbDebugPreferencePage_prettyPrinting_label=Pretty Printing
|
||||
GdbDebugPreferencePage_enablePrettyPrinting_label1=Enable pretty printers in variable/expression tree
|
||||
GdbDebugPreferencePage_enablePrettyPrinting_label2=(Note: requires python-enabled GDB)
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Marc Khouzam (Ericsson) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints;
|
||||
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
|
||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode;
|
||||
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.ui.viewmodel.VMDelta;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
|
||||
/**
|
||||
* BreakpointVMNode for GDB which supports aggressive breakpoint filtering.
|
||||
* @since 2.4
|
||||
*/
|
||||
public class GdbBreakpointVMNode extends RawBreakpointVMNode {
|
||||
|
||||
public GdbBreakpointVMNode(BreakpointVMProvider provider) {
|
||||
super(provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeltaFlags(Object event) {
|
||||
if (event instanceof PropertyChangeEvent) {
|
||||
String property = ((PropertyChangeEvent)event).getProperty();
|
||||
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
|
||||
return IModelDelta.CONTENT;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getDeltaFlags(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDelta(Object event, VMDelta parent, int nodeOffset, RequestMonitor rm) {
|
||||
if (event instanceof PropertyChangeEvent) {
|
||||
String property = ((PropertyChangeEvent)event).getProperty();
|
||||
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(property)) {
|
||||
parent.setFlags(parent.getFlags() | IModelDelta.CONTENT);
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.buildDelta(event, parent, nodeOffset, rm);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
@ -7,13 +7,19 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Mikhail Khodjaiants (Mentor), Marc Khouzam (Ericsson)
|
||||
* - Optionally use aggressive breakpoint filtering (Bug 360735)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.breakpoints;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||
|
@ -26,7 +32,7 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
|
|||
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.BreakpointVMProvider;
|
||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints.RawBreakpointVMNode;
|
||||
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
||||
|
@ -38,10 +44,14 @@ import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
|
|||
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.model.IBreakpoint;
|
||||
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
|
@ -57,14 +67,35 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
|
|||
|
||||
final private DsfServicesTracker fServicesTracker;
|
||||
|
||||
/** Indicator that we should use aggressive breakpoint filtering */
|
||||
private boolean fUseAggressiveBpFilter = false;
|
||||
|
||||
/** PropertyChangeListener to keep track of the PREF_HIDE_RUNNING_THREADS preference */
|
||||
private IPropertyChangeListener fPropertyChangeListener = new IPropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent event) {
|
||||
if (IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER.equals(event.getProperty())) {
|
||||
fUseAggressiveBpFilter = (Boolean)event.getNewValue();
|
||||
// Set the property in the presentation context so it can be seen by the vmnode which
|
||||
// will refresh the view
|
||||
getPresentationContext().setProperty(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, fUseAggressiveBpFilter);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public GdbBreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session) {
|
||||
super(adapter, presentationContext);
|
||||
fSession = session;
|
||||
fServicesTracker = new DsfServicesTracker(GdbUIPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
|
||||
store.addPropertyChangeListener(fPropertyChangeListener);
|
||||
fUseAggressiveBpFilter = store.getBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
|
||||
fServicesTracker.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
@ -72,6 +103,8 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
|
|||
@Override
|
||||
protected void calcFileteredBreakpoints( final DataRequestMonitor<IBreakpoint[]> rm ) {
|
||||
if ( Boolean.TRUE.equals( getPresentationContext().getProperty( IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION ) ) ) {
|
||||
if (fUseAggressiveBpFilter) {
|
||||
// Aggressive filtering of breakpoints. Only return bps that are installed on the target.
|
||||
IBreakpointsTargetDMContext bpContext = null;
|
||||
IMIExecutionDMContext threadContext = null;
|
||||
ISelection debugContext = getDebugContext();
|
||||
|
@ -88,13 +121,24 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
|
|||
IStatus.ERROR,
|
||||
GdbUIPlugin.PLUGIN_ID,
|
||||
IDsfStatusConstants.INVALID_HANDLE,
|
||||
"Debug context doesn't contain a thread", //$NON-NLS-1$
|
||||
"Debug context doesn't contain a breakpoint context", //$NON-NLS-1$
|
||||
null ) );
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
getInstalledBreakpoints( bpContext, threadContext, rm );
|
||||
} else {
|
||||
// Original behavior of bp filtering. Return all bp of type ICBreakpoint
|
||||
IBreakpoint[] allBreakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
|
||||
List<IBreakpoint> filteredBPs = new ArrayList<IBreakpoint>(allBreakpoints.length);
|
||||
for (IBreakpoint bp : allBreakpoints) {
|
||||
if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(CDebugCorePlugin.PLUGIN_ID)) {
|
||||
filteredBPs.add(bp);
|
||||
}
|
||||
}
|
||||
rm.done( filteredBPs.toArray(new IBreakpoint[filteredBPs.size()]) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.calcFileteredBreakpoints( rm );
|
||||
|
@ -103,7 +147,7 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
|
|||
|
||||
@Override
|
||||
protected IVMNode createBreakpointVMNode() {
|
||||
return new RawBreakpointVMNode(this);
|
||||
return new GdbBreakpointVMNode(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -181,6 +225,7 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
|
|||
|
||||
try {
|
||||
fSession.getExecutor().execute( new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final IBreakpointsExtension bpService = fServicesTracker.getService( IBreakpointsExtension.class );
|
||||
if ( bpService == null ) {
|
||||
|
@ -201,14 +246,14 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
|
|||
rm.setStatus( new Status(
|
||||
IStatus.ERROR,
|
||||
GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
|
||||
"Breakpoints service not available", //$NON-NLS-1$
|
||||
"Breakpoint manager service not available", //$NON-NLS-1$
|
||||
null ) );
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( getData().length > 0 ) {
|
||||
final List<IBreakpoint> bps = new ArrayList<IBreakpoint>( getData().length );
|
||||
final Set<IBreakpoint> bps = new HashSet<IBreakpoint>( getData().length );
|
||||
final CountingRequestMonitor crm = new CountingRequestMonitor( ImmediateExecutor.getInstance(), rm ) {
|
||||
|
||||
@Override
|
||||
|
@ -236,8 +281,8 @@ public class GdbBreakpointVMProvider extends BreakpointVMProvider {
|
|||
if ( bp != null )
|
||||
bps.add( bp );
|
||||
}
|
||||
crm.done();
|
||||
}
|
||||
crm.done();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* Jens Elmenthaler (Verigy) - Added Full GDB pretty-printing support (bug 302121)
|
||||
* Sergey Prigogin (Google)
|
||||
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb;
|
||||
|
||||
|
@ -131,5 +132,19 @@ public interface IGdbDebugPreferenceConstants {
|
|||
* @since 4.1
|
||||
*/
|
||||
public static final String PREF_HIDE_RUNNING_THREADS = PREFIX + "hideRunningThreads"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Boolean preference whether to use the new behavior of the command
|
||||
* "Show Breakpoints Supported by Selected Target" from the Breakpoints view.
|
||||
* The original behavior is to only show breakpoints that apply to the current debug
|
||||
* session; so all C/C++ breakpoints but not Java ones.
|
||||
* The new behavior is to only show breakpoints that are actually installed in the current
|
||||
* debug session.
|
||||
*
|
||||
* Default is <code>true</code>.
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static final String PREF_AGGRESSIVE_BP_FILTER = PREFIX + "aggressiveBpFilter"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* Sergey Prigogin (Google)
|
||||
* Marc Khouzam (Ericsson) - Move to org.eclipse.cdt.dsf.gdb from UI plugin (bug 348159)
|
||||
* Anton Gorenkov - A preference to use RTTI for variable types determination (Bug 377536)
|
||||
* Marc Khouzam (Ericsson) - Add preference for aggressive breakpoint filtering (Bug 360735)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal;
|
||||
|
||||
|
@ -43,5 +44,6 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
|
|||
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);
|
||||
node.putBoolean(IGdbDebugPreferenceConstants.PREF_AGGRESSIVE_BP_FILTER, true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue