mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
Bug 389945 - Only set breakpoints once for GDB >= 7.4
Make the IBreakpoinTargetDMC map to the GDB context for GDB >= 7.4. This will allow to track breakpoints globally for GDB since that is how GDB handles breakpoints from 7.4 and up. Change-Id: I84bccf9bdc6e169624908fee106080f840843e28 Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/22388
This commit is contained in:
parent
ede42e1820
commit
79dc0b8184
9 changed files with 152 additions and 43 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2013 Ericsson and others.
|
* Copyright (c) 2008, 2014 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -11,6 +11,8 @@
|
||||||
* John Dallaway - GDB 7.x MI thread details field ignored (Bug 325556)
|
* John Dallaway - GDB 7.x MI thread details field ignored (Bug 325556)
|
||||||
* Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
|
* Marc Khouzam (Ericsson) - Make each thread an IDisassemblyDMContext (bug 352748)
|
||||||
* Andy Jin (QNX) - Not output thread osId as a string when it is null (Bug 397039)
|
* Andy Jin (QNX) - Not output thread osId as a string when it is null (Bug 397039)
|
||||||
|
* Marc Khouzam (Ericsson) - Move IBreakpointsTargetDMContext from MIContainerDMC
|
||||||
|
* to GDBContainerDMC to ease inheritance (Bug 389945)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.service;
|
package org.eclipse.cdt.dsf.gdb.service;
|
||||||
|
|
||||||
|
@ -183,8 +185,8 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
* Context representing a thread group of GDB/MI.
|
* Context representing a thread group of GDB/MI.
|
||||||
*/
|
*/
|
||||||
@Immutable
|
@Immutable
|
||||||
private static class MIContainerDMC extends AbstractDMContext
|
static class MIContainerDMC extends AbstractDMContext
|
||||||
implements IMIContainerDMContext, IBreakpointsTargetDMContext, IDisassemblyDMContext
|
implements IMIContainerDMContext, IDisassemblyDMContext
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* String ID that is used to identify the thread group in the GDB/MI protocol.
|
* String ID that is used to identify the thread group in the GDB/MI protocol.
|
||||||
|
@ -225,7 +227,7 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class GDBContainerDMC extends MIContainerDMC
|
private static class GDBContainerDMC extends MIContainerDMC
|
||||||
implements IMemoryDMContext
|
implements IMemoryDMContext, IBreakpointsTargetDMContext
|
||||||
{
|
{
|
||||||
public GDBContainerDMC(String sessionId, IProcessDMContext processDmc, String groupId) {
|
public GDBContainerDMC(String sessionId, IProcessDMContext processDmc, String groupId) {
|
||||||
super(sessionId, processDmc, groupId);
|
super(sessionId, processDmc, groupId);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010, 2013 TUBITAK BILGEM-ITI and others.
|
* Copyright (c) 2010, 2014 TUBITAK BILGEM-ITI and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
|
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
|
||||||
* Marc Khouzam (Ericsson) - Workaround for Bug 352998
|
* Marc Khouzam (Ericsson) - Workaround for Bug 352998
|
||||||
|
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.service;
|
package org.eclipse.cdt.dsf.gdb.service;
|
||||||
|
|
||||||
|
@ -558,11 +559,14 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
|
||||||
@Override
|
@Override
|
||||||
public void eventDispatched(IExitedDMEvent e) {
|
public void eventDispatched(IExitedDMEvent e) {
|
||||||
IDMContext dmc = e.getDMContext();
|
IDMContext dmc = e.getDMContext();
|
||||||
if (dmc instanceof IContainerDMContext) {
|
if (dmc instanceof IBreakpointsTargetDMContext) {
|
||||||
// A process has died, we should stop tracking its breakpoints, but only if it is not restarting
|
// A process has died, we should stop tracking its breakpoints, but only if it is not restarting
|
||||||
|
// We only do this when the process is a breakpointTargetDMC itself (GDB < 7.4);
|
||||||
|
// we don't want to stop tracking breakpoints when breakpoints are only set once
|
||||||
|
// for all processes (GDB >= 7.4)
|
||||||
if (!fProcRestarting.remove(dmc)) {
|
if (!fProcRestarting.remove(dmc)) {
|
||||||
if (fBackend.getSessionType() != SessionType.CORE) {
|
if (fBackend.getSessionType() != SessionType.CORE) {
|
||||||
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
|
IBreakpointsTargetDMContext bpTargetDmc = (IBreakpointsTargetDMContext)dmc;
|
||||||
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
|
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
|
||||||
if (bpmService != null) {
|
if (bpmService != null) {
|
||||||
bpmService.stopTrackingBreakpoints(bpTargetDmc, new ImmediateRequestMonitor() {
|
bpmService.stopTrackingBreakpoints(bpTargetDmc, new ImmediateRequestMonitor() {
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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 Khouzam (Ericsson) - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.dsf.gdb.service;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapt to GDB 7.4 where breakpoints are for all inferiors at once.
|
||||||
|
*
|
||||||
|
* @since 4.4
|
||||||
|
*/
|
||||||
|
public class GDBProcesses_7_4 extends GDBProcesses_7_2_1 {
|
||||||
|
|
||||||
|
public GDBProcesses_7_4(DsfSession session) {
|
||||||
|
super(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A container context that is not an IBreakpointsTargetDMContext.
|
||||||
|
*/
|
||||||
|
private static class GDBContainerDMC_7_4 extends MIContainerDMC
|
||||||
|
implements IMemoryDMContext
|
||||||
|
{
|
||||||
|
public GDBContainerDMC_7_4(String sessionId, IProcessDMContext processDmc, String groupId) {
|
||||||
|
super(sessionId, processDmc, groupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMIContainerDMContext createContainerContext(IProcessDMContext processDmc,
|
||||||
|
String groupId) {
|
||||||
|
return new GDBContainerDMC_7_4(getSession().getId(), processDmc, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* Marc Khouzam (Ericsson) - Support for GDB 7.6 memory service
|
* Marc Khouzam (Ericsson) - Support for GDB 7.6 memory service
|
||||||
* Marc Khouzam (Ericsson) - Support for GDB 7.4 trace control service
|
* Marc Khouzam (Ericsson) - Support for GDB 7.4 trace control service
|
||||||
* William Riley (Renesas) - Support for GDB 7.3 disassembly service (Bug 357270)
|
* William Riley (Renesas) - Support for GDB 7.3 disassembly service (Bug 357270)
|
||||||
|
* Marc Khouzam (Ericsson) - Support for GDB 7.4 processes service (Bug 389945)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.service;
|
package org.eclipse.cdt.dsf.gdb.service;
|
||||||
|
|
||||||
|
@ -200,6 +201,9 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProcesses createProcessesService(DsfSession session) {
|
protected IProcesses createProcessesService(DsfSession session) {
|
||||||
|
if (GDB_7_4_VERSION.compareTo(fVersion) <= 0) {
|
||||||
|
return new GDBProcesses_7_4(session);
|
||||||
|
}
|
||||||
if (GDB_7_2_1_VERSION.compareTo(fVersion) <= 0) {
|
if (GDB_7_2_1_VERSION.compareTo(fVersion) <= 0) {
|
||||||
return new GDBProcesses_7_2_1(session);
|
return new GDBProcesses_7_2_1(session);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* Mikhail Khodjaiants (Mentor Graphics) - Terminate should cancel the initialization sequence
|
* Mikhail Khodjaiants (Mentor Graphics) - Terminate should cancel the initialization sequence
|
||||||
* if it is still running (bug 373845)
|
* if it is still running (bug 373845)
|
||||||
* Marc Khouzam (Ericsson) - Terminate the session if we lose the connection to the remote target (bug 422586)
|
* Marc Khouzam (Ericsson) - Terminate the session if we lose the connection to the remote target (bug 422586)
|
||||||
|
* Marc Khouzam (Ericsson) - Allow to override the creation of the ControlDMC (Bug 389945)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.service.command;
|
package org.eclipse.cdt.dsf.gdb.service.command;
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private GDBControlDMContext fControlDmc;
|
private ICommandControlDMContext fControlDmc;
|
||||||
|
|
||||||
private IGDBBackend fMIBackend;
|
private IGDBBackend fMIBackend;
|
||||||
|
|
||||||
|
@ -250,9 +251,9 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
|
|
||||||
fMIBackend = getServicesTracker().getService(IGDBBackend.class);
|
fMIBackend = getServicesTracker().getService(IGDBBackend.class);
|
||||||
|
|
||||||
// getId uses the MIBackend service, which is why we must wait until we
|
// getId, called to create this context, uses the MIBackend service,
|
||||||
// have it, before we can create this context.
|
// which is why we must wait until we have MIBackend, before we can create the below context.
|
||||||
fControlDmc = new GDBControlDMContext(getSession().getId(), getId());
|
fControlDmc = createComandControlContext();
|
||||||
|
|
||||||
getExecutor().execute(getStartupSequence(requestMonitor));
|
getExecutor().execute(getStartupSequence(requestMonitor));
|
||||||
}
|
}
|
||||||
|
@ -273,9 +274,23 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
return fMIBackend.getId();
|
return fMIBackend.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the commandControl context.
|
||||||
|
* This method can be overridden to provide a different context.
|
||||||
|
* @since 4.4
|
||||||
|
*/
|
||||||
|
protected ICommandControlDMContext createComandControlContext() {
|
||||||
|
return new GDBControlDMContext(getSession().getId(), getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public MIControlDMContext getControlDMContext() {
|
public MIControlDMContext getControlDMContext() {
|
||||||
return fControlDmc;
|
assert fControlDmc instanceof MIControlDMContext;
|
||||||
|
if (fControlDmc instanceof MIControlDMContext) {
|
||||||
|
return (MIControlDMContext)fControlDmc;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -325,7 +340,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
getGDBExitWaitTime(), TimeUnit.SECONDS);
|
getGDBExitWaitTime(), TimeUnit.SECONDS);
|
||||||
|
|
||||||
queueCommand(
|
queueCommand(
|
||||||
getCommandFactory().createMIGDBExit(fControlDmc),
|
getCommandFactory().createMIGDBExit(getContext()),
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
public void handleCompleted() {
|
public void handleCompleted() {
|
||||||
|
@ -437,7 +452,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
// Before GDB 7.0, we have to send the containerExited event ourselves
|
// Before GDB 7.0, we have to send the containerExited event ourselves
|
||||||
IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class);
|
IGDBProcesses procService = getServicesTracker().getService(IGDBProcesses.class);
|
||||||
if (procService != null) {
|
if (procService != null) {
|
||||||
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
|
IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(getContext(), MIProcesses.UNIQUE_GROUP_ID);
|
||||||
getSession().dispatchEvent(
|
getSession().dispatchEvent(
|
||||||
new ContainerExitedDMEvent(processContainerDmc), getProperties());
|
new ContainerExitedDMEvent(processContainerDmc), getProperties());
|
||||||
}
|
}
|
||||||
|
@ -447,7 +462,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
public void eventDispatched(BackendStateChangedEvent e) {
|
public void eventDispatched(BackendStateChangedEvent e) {
|
||||||
if (e.getState() == IMIBackend.State.TERMINATED && e.getBackendId().equals(fMIBackend.getId())) {
|
if (e.getState() == IMIBackend.State.TERMINATED && e.getBackendId().equals(fMIBackend.getId())) {
|
||||||
// Handle "GDB Exited" event, just relay to following event.
|
// Handle "GDB Exited" event, just relay to following event.
|
||||||
getSession().dispatchEvent(new GDBControlShutdownDMEvent(fControlDmc), getProperties());
|
getSession().dispatchEvent(new GDBControlShutdownDMEvent(getContext()), getProperties());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,8 +533,8 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, fControlDmc);
|
fCLICommandProcessor = createCLIEventProcessor(GDBControl.this, getContext());
|
||||||
fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, fControlDmc);
|
fMIEventProcessor = createMIRunControlEventProcessor(GDBControl.this, getContext());
|
||||||
fControlEventProcessor = createControlEventProcessor();
|
fControlEventProcessor = createControlEventProcessor();
|
||||||
|
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
|
@ -575,7 +590,7 @@ public class GDBControl extends AbstractMIControl implements IGDBControl {
|
||||||
AbstractMIControl.class.getName(),
|
AbstractMIControl.class.getName(),
|
||||||
IGDBControl.class.getName() },
|
IGDBControl.class.getName() },
|
||||||
new Hashtable<String,String>());
|
new Hashtable<String,String>());
|
||||||
getSession().dispatchEvent(new GDBControlInitializedDMEvent(fControlDmc), getProperties());
|
getSession().dispatchEvent(new GDBControlInitializedDMEvent(getContext()), getProperties());
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
* Copyright (c) 2006, 2014 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -183,7 +183,7 @@ public class GDBControl_7_0 extends GDBControl {
|
||||||
|
|
||||||
private void listFeatures(final RequestMonitor requestMonitor) {
|
private void listFeatures(final RequestMonitor requestMonitor) {
|
||||||
queueCommand(
|
queueCommand(
|
||||||
getCommandFactory().createMIListFeatures(getControlDMContext()),
|
getCommandFactory().createMIListFeatures(getContext()),
|
||||||
new DataRequestMonitor<MIListFeaturesInfo>(getExecutor(), requestMonitor) {
|
new DataRequestMonitor<MIListFeaturesInfo>(getExecutor(), requestMonitor) {
|
||||||
@Override
|
@Override
|
||||||
public void handleSuccess() {
|
public void handleSuccess() {
|
||||||
|
@ -235,7 +235,7 @@ public class GDBControl_7_0 extends GDBControl {
|
||||||
@Override
|
@Override
|
||||||
public void enablePrettyPrintingForMIVariableObjects(RequestMonitor rm) {
|
public void enablePrettyPrintingForMIVariableObjects(RequestMonitor rm) {
|
||||||
queueCommand(
|
queueCommand(
|
||||||
getCommandFactory().createMIEnablePrettyPrinting(getControlDMContext()),
|
getCommandFactory().createMIEnablePrettyPrinting(getContext()),
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ public class GDBControl_7_0 extends GDBControl {
|
||||||
String subCommand = "set python print-stack " + (enabled ? "on" : "off"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
String subCommand = "set python print-stack " + (enabled ? "on" : "off"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
||||||
|
|
||||||
queueCommand(
|
queueCommand(
|
||||||
getCommandFactory().createCLIMaintenance(getControlDMContext(), subCommand),
|
getCommandFactory().createCLIMaintenance(getContext(), subCommand),
|
||||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 Ericsson and others.
|
* Copyright (c) 2012, 2014 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,11 +7,13 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Marc Khouzam (Ericsson) - initial API and implementation
|
* Marc Khouzam (Ericsson) - initial API and implementation
|
||||||
|
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.service.command;
|
package org.eclipse.cdt.dsf.gdb.service.command;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
|
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
@ -20,13 +22,33 @@ import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
/**
|
/**
|
||||||
* With GDB 7.4, the command 'maintenance set python print-stack' is not supported.
|
* With GDB 7.4, the command 'maintenance set python print-stack' is not supported.
|
||||||
* The new command "set python print-stack none|full|message" has replaced it.
|
* The new command "set python print-stack none|full|message" has replaced it.
|
||||||
|
*
|
||||||
|
* With GDB 7.4, breakpoints are handled globally for all of GDB, so our
|
||||||
|
* IBreakpointsTargetDMContext becomes the GDBControlContext.
|
||||||
|
*
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public class GDBControl_7_4 extends GDBControl_7_2 implements IGDBControl {
|
public class GDBControl_7_4 extends GDBControl_7_2 implements IGDBControl {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A command control context that is also a IBreakpointsTargetDMContext
|
||||||
|
*/
|
||||||
|
private class GDBControlDMContext_7_4 extends GDBControlDMContext implements IBreakpointsTargetDMContext {
|
||||||
|
public GDBControlDMContext_7_4(String sessionId, String commandControlId) {
|
||||||
|
super(sessionId, commandControlId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public GDBControl_7_4(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
|
public GDBControl_7_4(DsfSession session, ILaunchConfiguration config, CommandFactory factory) {
|
||||||
super(session, config, factory);
|
super(session, config, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @since 4.4 */
|
||||||
|
@Override
|
||||||
|
protected ICommandControlDMContext createComandControlContext() {
|
||||||
|
return new GDBControlDMContext_7_4(getSession().getId(), getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
|
public void setPrintPythonErrors(boolean enabled, RequestMonitor rm) {
|
||||||
// With GDB 7.4, the command 'maintenance set python print-stack' has been replaced by
|
// With GDB 7.4, the command 'maintenance set python print-stack' has been replaced by
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* Ericsson - Added Action support
|
* Ericsson - Added Action support
|
||||||
* Marc Khouzam (Ericsson) - Fix support for thread filter (Bug 355833)
|
* Marc Khouzam (Ericsson) - Fix support for thread filter (Bug 355833)
|
||||||
* Marc Khouzam (Ericsson) - Generalize thread filtering logic (Bug 431986)
|
* Marc Khouzam (Ericsson) - Generalize thread filtering logic (Bug 431986)
|
||||||
|
* Marc Khouzam (Ericsson) - Accept multiple calls to startTrackingBreakpoints (Bug 389945)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.mi.service;
|
package org.eclipse.cdt.dsf.mi.service;
|
||||||
|
@ -367,13 +368,14 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure a mapping for this execution context does not already exist
|
|
||||||
Map<ICBreakpoint,Map<String, Object>> platformBPs = fPlatformBPs.get(dmc);
|
Map<ICBreakpoint,Map<String, Object>> platformBPs = fPlatformBPs.get(dmc);
|
||||||
Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fBreakpointIDs.get(dmc);
|
Map<ICBreakpoint, Vector<IBreakpointDMContext>> breakpointIDs = fBreakpointIDs.get(dmc);
|
||||||
Map<IBreakpointDMContext, ICBreakpoint> targetIDs = fTargetBPs.get(dmc);
|
Map<IBreakpointDMContext, ICBreakpoint> targetIDs = fTargetBPs.get(dmc);
|
||||||
Map<ICBreakpoint, Set<String>> threadIDs = fBreakpointThreads.get(dmc);
|
Map<ICBreakpoint, Set<String>> threadIDs = fBreakpointThreads.get(dmc);
|
||||||
if ((platformBPs != null) || (breakpointIDs != null) || (targetIDs != null) || (threadIDs != null)) {
|
if ((platformBPs != null) || (breakpointIDs != null) || (targetIDs != null) || (threadIDs != null)) {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, CONTEXT_ALREADY_INITIALIZED, null));
|
// If the maps already contains this context we can simply ignore this request.
|
||||||
|
// This happens when we start or attach to another process with GDB >= 7.4
|
||||||
|
assert platformBPs != null && breakpointIDs != null && targetIDs != null && threadIDs != null;
|
||||||
rm.done();
|
rm.done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 Mentor Graphics and others.
|
* Copyright (c) 2012, 2014 Mentor Graphics and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Mentor Graphics - Initial API and implementation
|
* Mentor Graphics - Initial API and implementation
|
||||||
* Salvatore Culcasi (ST) - Bug 407163 - GDB Console: breakpoint not added with MinGW and gdb
|
* Salvatore Culcasi (ST) - Bug 407163 - GDB Console: breakpoint not added with MinGW and gdb
|
||||||
|
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.mi.service;
|
package org.eclipse.cdt.dsf.mi.service;
|
||||||
|
@ -294,9 +295,6 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
if (breakpointsService == null || bm == null)
|
if (breakpointsService == null || bm == null)
|
||||||
return;
|
return;
|
||||||
final IBreakpointsTargetDMContext bpTargetDMC = breakpointsService.getBreakpointTargetContext(id);
|
final IBreakpointsTargetDMContext bpTargetDMC = breakpointsService.getBreakpointTargetContext(id);
|
||||||
final IContainerDMContext contDMC = DMContexts.getAncestorOfType(bpTargetDMC, IContainerDMContext.class);
|
|
||||||
if (contDMC == null)
|
|
||||||
return;
|
|
||||||
if (bpTargetDMC != null){
|
if (bpTargetDMC != null){
|
||||||
final MIBreakpointDMContext bpDMC =
|
final MIBreakpointDMContext bpDMC =
|
||||||
new MIBreakpointDMContext(breakpointsService, new IDMContext[] { bpTargetDMC }, id);
|
new MIBreakpointDMContext(breakpointsService, new IDMContext[] { bpTargetDMC }, id);
|
||||||
|
@ -327,6 +325,17 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
IDsfBreakpointExtension bpExtension =
|
IDsfBreakpointExtension bpExtension =
|
||||||
(IDsfBreakpointExtension)((ICBreakpoint)plBpt).getExtension(
|
(IDsfBreakpointExtension)((ICBreakpoint)plBpt).getExtension(
|
||||||
MIBreakpointsManager.GDB_DEBUG_MODEL_ID, ICBreakpointExtension.class);
|
MIBreakpointsManager.GDB_DEBUG_MODEL_ID, ICBreakpointExtension.class);
|
||||||
|
|
||||||
|
IMIProcesses processes = getServicesTracker().getService(IMIProcesses.class);
|
||||||
|
if (processes == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IContainerDMContext contDMC = processes.createContainerContextFromThreadId(getCommandControl().getContext(), data.getThreadId());
|
||||||
|
if (contDMC == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IExecutionDMContext[] execDMCs = bpExtension.getThreadFilters(contDMC);
|
IExecutionDMContext[] execDMCs = bpExtension.getThreadFilters(contDMC);
|
||||||
List<IExecutionDMContext> list = new ArrayList<IExecutionDMContext>(execDMCs.length);
|
List<IExecutionDMContext> list = new ArrayList<IExecutionDMContext>(execDMCs.length);
|
||||||
for (IExecutionDMContext c : execDMCs) {
|
for (IExecutionDMContext c : execDMCs) {
|
||||||
|
@ -453,7 +462,12 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
MIBreakpoint miBpt) {
|
MIBreakpoint miBpt) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IContainerDMContext contDMC = DMContexts.getAncestorOfType(bpTargetDMC, IContainerDMContext.class);
|
IMIProcesses processes = getServicesTracker().getService(IMIProcesses.class);
|
||||||
|
if (processes == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String threadId = miBpt.getThreadId();
|
||||||
|
IContainerDMContext contDMC = processes.createContainerContextFromThreadId(getCommandControl().getContext(), threadId);
|
||||||
if (contDMC == null) {
|
if (contDMC == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -462,20 +476,16 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
if (procDmc == null) {
|
if (procDmc == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IMIProcesses processes = getServicesTracker().getService(IMIProcesses.class);
|
|
||||||
if (processes == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
IDsfBreakpointExtension bpExtension = (IDsfBreakpointExtension)plBpt.getExtension(
|
IDsfBreakpointExtension bpExtension = (IDsfBreakpointExtension)plBpt.getExtension(
|
||||||
MIBreakpointsManager.GDB_DEBUG_MODEL_ID, ICBreakpointExtension.class);
|
MIBreakpointsManager.GDB_DEBUG_MODEL_ID, ICBreakpointExtension.class);
|
||||||
IExecutionDMContext[] execDMCs = bpExtension.getThreadFilters(contDMC);
|
IExecutionDMContext[] execDMCs = bpExtension.getThreadFilters(contDMC);
|
||||||
if (execDMCs == null) {
|
if (execDMCs == null) {
|
||||||
execDMCs = new IExecutionDMContext[0];
|
execDMCs = new IExecutionDMContext[0];
|
||||||
}
|
}
|
||||||
int threadId = Integer.parseInt(miBpt.getThreadId());
|
int threadNum = Integer.parseInt(threadId);
|
||||||
for (IExecutionDMContext execDMC : execDMCs) {
|
for (IExecutionDMContext execDMC : execDMCs) {
|
||||||
if (execDMC instanceof IMIExecutionDMContext
|
if (execDMC instanceof IMIExecutionDMContext
|
||||||
&& ((IMIExecutionDMContext)execDMC).getThreadId() == threadId) {
|
&& ((IMIExecutionDMContext)execDMC).getThreadId() == threadNum) {
|
||||||
// The platform breakpoint is already restricted to the given thread.
|
// The platform breakpoint is already restricted to the given thread.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -484,8 +494,8 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
System.arraycopy(execDMCs, 0, newExecDMCs, 0, execDMCs.length);
|
System.arraycopy(execDMCs, 0, newExecDMCs, 0, execDMCs.length);
|
||||||
newExecDMCs[execDMCs.length] = processes.createExecutionContext(
|
newExecDMCs[execDMCs.length] = processes.createExecutionContext(
|
||||||
contDMC,
|
contDMC,
|
||||||
processes.createThreadContext(procDmc, miBpt.getThreadId()),
|
processes.createThreadContext(procDmc, threadId),
|
||||||
miBpt.getThreadId());
|
threadId);
|
||||||
bpExtension.setThreadFilters(newExecDMCs);
|
bpExtension.setThreadFilters(newExecDMCs);
|
||||||
}
|
}
|
||||||
catch(NumberFormatException e) {
|
catch(NumberFormatException e) {
|
||||||
|
@ -723,6 +733,9 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
if (processes == null) {
|
if (processes == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For GDB < 7.4, each process is its own breakpointTargetDMC so we need to find a the proper process
|
||||||
|
// based on the threadId. For GDB >= 7.4, this does not matter as we'll always end up with the global bpTargetDMC
|
||||||
String threadId = (miBpt != null) ? miBpt.getThreadId() : null;
|
String threadId = (miBpt != null) ? miBpt.getThreadId() : null;
|
||||||
IContainerDMContext contContext = processes.createContainerContextFromThreadId(commandControl.getContext(), threadId);
|
IContainerDMContext contContext = processes.createContainerContextFromThreadId(commandControl.getContext(), threadId);
|
||||||
if (contContext == null) {
|
if (contContext == null) {
|
||||||
|
@ -1231,10 +1244,11 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IExitedDMEvent e) {
|
public void eventDispatched(IExitedDMEvent e) {
|
||||||
if (e.getDMContext() instanceof IContainerDMContext) {
|
if (e.getDMContext() instanceof IBreakpointsTargetDMContext) {
|
||||||
IBreakpointsTargetDMContext bpTargetDMContext =
|
// Remove breakpoint entries when a breakpoint target is removed.
|
||||||
DMContexts.getAncestorOfType(e.getDMContext(), IBreakpointsTargetDMContext.class);
|
// This will happen for GDB < 7.4 where the container is the breakpoint target.
|
||||||
if (bpTargetDMContext != null) {
|
// For GDB >= 7.4, GDB is the breakpoint target and will not be removed.
|
||||||
|
IBreakpointsTargetDMContext bpTargetDMContext = (IBreakpointsTargetDMContext)e.getDMContext();
|
||||||
Map<Integer, MIBreakpoint> createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext);
|
Map<Integer, MIBreakpoint> createdBreakpoints = fCreatedTargetBreakpoints.remove(bpTargetDMContext);
|
||||||
if (createdBreakpoints != null)
|
if (createdBreakpoints != null)
|
||||||
createdBreakpoints.clear();
|
createdBreakpoints.clear();
|
||||||
|
@ -1246,7 +1260,6 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
deletedBreakpoints.clear();
|
deletedBreakpoints.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private String getFunctionFromOriginalLocation(String origLocation) {
|
private String getFunctionFromOriginalLocation(String origLocation) {
|
||||||
if (origLocation.isEmpty()) {
|
if (origLocation.isEmpty()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue