1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 10:15:39 +02:00

Bug 402217 - [breakpoints] Make use of the new "thread-groups" MI field

from GDB 7.6 breakpoint output

Change-Id: Iab94ffb3d706a2c5b53b9082e03c0f4e96028599
Reviewed-on: https://git.eclipse.org/r/10806
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:
Marc Khouzam 2013-03-02 22:16:41 -05:00
parent 617eb9e7be
commit 23d72af75b
4 changed files with 98 additions and 1 deletions

View file

@ -102,6 +102,13 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
@Override
public void getBreakpoints(final IBreakpointsTargetDMContext context, final DataRequestMonitor<IBreakpointDMContext[]> drm)
{
if (bpThreadGroupInfoAvailable()) {
// With GDB 7.6, we obtain the thread-groups to which a breakpoint applies
// directly in the -break-list command, so we don't need to do any special processing.
super.getBreakpoints(context, drm);
return;
}
// Validate the context
if (context == null) {
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_EXECUTION_CONTEXT, null));
@ -281,4 +288,17 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
}
});
}
/**
* Does the MI command -break-list provide information
* about which thread-group a breakpoint applies to?
* The use of this method allows us to avoid duplicating code.
* See Bug 402217
*
* @return true if the information is available (GDB >= 7.6),
* false otherwise.
*/
protected boolean bpThreadGroupInfoAvailable() {
return false;
}
}

View file

@ -0,0 +1,74 @@
/*******************************************************************************
* Copyright (c) 2013 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.service;
import java.util.Hashtable;
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints;
import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
import org.eclipse.cdt.dsf.service.DsfSession;
/**
* Breakpoint service for GDB 7.6.
*
* @since 4.2
*/
public class GDBBreakpoints_7_6 extends GDBBreakpoints_7_4
{
private IMICommandControl fConnection;
public GDBBreakpoints_7_6(DsfSession session) {
super(session);
}
@Override
public void initialize(final RequestMonitor rm) {
super.initialize(new ImmediateRequestMonitor(rm) {
@Override
protected void handleSuccess() {
doInitialize(rm);
}
});
}
private void doInitialize(final RequestMonitor rm) {
// Get the services references
fConnection = getServicesTracker().getService(IMICommandControl.class);
// Register this service
register(new String[] { IBreakpoints.class.getName(),
IBreakpointsExtension.class.getName(),
MIBreakpoints.class.getName(),
GDBBreakpoints_7_0.class.getName(),
GDBBreakpoints_7_2.class.getName(),
GDBBreakpoints_7_4.class.getName(),
GDBBreakpoints_7_6.class.getName() },
new Hashtable<String, String>());
rm.done();
}
@Override
public void shutdown(RequestMonitor requestMonitor) {
unregister();
super.shutdown(requestMonitor);
}
@Override
protected boolean bpThreadGroupInfoAvailable() {
return true;
}
}

View file

@ -124,6 +124,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
@Override
protected IBreakpoints createBreakpointService(DsfSession session) {
if (GDB_7_6_VERSION.compareTo(fVersion) <= 0) {
return new GDBBreakpoints_7_6(session);
}
if (GDB_7_4_VERSION.compareTo(fVersion) <= 0) {
return new GDBBreakpoints_7_4(session);
}

View file

@ -549,7 +549,7 @@ public class MIBreakpoint {
if (value instanceof MITuple) {
parseCommands((MITuple)value);
}
} else if (var.equals("thread-group")) { //$NON-NLS-1$
} else if (var.equals("thread-groups")) { //$NON-NLS-1$
if (value instanceof MIList) {
parseGroups((MIList)value);
}