diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java index 1571e1a635a..5784858a932 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java @@ -102,6 +102,13 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 @Override public void getBreakpoints(final IBreakpointsTargetDMContext context, final DataRequestMonitor 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; + } } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java new file mode 100644 index 00000000000..51222f6d67d --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_6.java @@ -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()); + + rm.done(); + } + + @Override + public void shutdown(RequestMonitor requestMonitor) { + unregister(); + super.shutdown(requestMonitor); + } + + @Override + protected boolean bpThreadGroupInfoAvailable() { + return true; + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java index d01fcd6e7de..f8abef45c91 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java @@ -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); } diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java index 753b1e1ceb6..f65e4a6b54f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java @@ -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); }