1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 335324 - [multi-process][breakpoints] Make the container (process) the breakpointTarget context

This commit is contained in:
Marc Khouzam 2011-02-05 04:27:36 +00:00
parent 5d1be8f620
commit d034f60b19
8 changed files with 63 additions and 22 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2010 Ericsson and others.
* Copyright (c) 2008, 2011 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
@ -40,6 +40,7 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceTargetDMContext;
import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
import org.eclipse.cdt.dsf.mi.service.CSourceLookup;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
@ -674,9 +675,10 @@ public class FinalLaunchSequence extends ReflectionSequence {
public void stepStartTrackingBreakpoints(final RequestMonitor requestMonitor) {
if (fSessionType != SessionType.CORE) {
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
IBreakpointsTargetDMContext breakpointDmc = (IBreakpointsTargetDMContext)fCommandControl.getContext();
IMIContainerDMContext containerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), null);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
bpmService.startTrackingBreakpoints(breakpointDmc, requestMonitor);
bpmService.startTrackingBreakpoints(bpTargetDmc, requestMonitor);
} else {
requestMonitor.done();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 TUBITAK BILGEM-ITI and others.
* Copyright (c) 2010, 2011 TUBITAK BILGEM-ITI 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
@ -20,6 +20,7 @@ import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
@ -99,7 +100,10 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
@Override
protected void handleSuccess() {
rm.setData(containerDmc);
rm.done();
// Start tracking this process' breakpoints.
MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
bpmService.startTrackingBreakpoints(containerDmc, rm);
}
});
}

View file

@ -41,6 +41,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl2;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.internal.service.command.events.MITracepointSelectedEvent;
@ -948,9 +949,25 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
@Override
public void execute(final RequestMonitor rm) {
fContainerDmcToSuspend = DMContexts.getAncestorOfType(fCtx, IContainerDMContext.class);
if (fContainerDmcToSuspend != null) {
// In non-stop, we don't actually need this particular process to be suspended,
// all we need is one of any of the processes to be suspended.
// However, for efficiency, we can first check if the process in question
// is suspended.
if (isSuspended(fContainerDmcToSuspend)) {
fTargetAvailable = true;
rm.done();
return;
}
}
// If we get here, we have to get the list of processes to know if any of
// them is suspended.
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(fCtx, ICommandControlDMContext.class);
IProcesses processControl = getServicesTracker().getService(IProcesses.class);
processControl.getProcessesBeingDebugged(
fCtx,
controlDmc,
new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
@Override
protected void handleSuccess() {

View file

@ -21,6 +21,7 @@ import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor;
import org.eclipse.cdt.dsf.concurrent.ReflectionSequence;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
@ -202,10 +203,11 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class);
fCommandControl.queueCommand(
fCommandFactory.createMIBreakInsert((IBreakpointsTargetDMContext)fCommandControl.getContext(),
true, false, null, 0, userStopSymbol, 0),
new DataRequestMonitor<MIBreakInsertInfo>(ImmediateExecutor.getInstance(), rm) {
fCommandFactory.createMIBreakInsert(bpTargetDmc, true, false, null, 0, userStopSymbol, 0),
new DataRequestMonitor<MIBreakInsertInfo>(ImmediateExecutor.getInstance(), rm) {
@Override
public void handleSuccess() {
if (getData() != null) {
@ -231,10 +233,12 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
@Execute
public void stepSetBreakpointForReverse(final RequestMonitor rm) {
if (fReverseEnabled) {
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(getContainerContext(), IBreakpointsTargetDMContext.class);
fCommandControl.queueCommand(
fCommandFactory.createMIBreakInsert((IBreakpointsTargetDMContext)fCommandControl.getContext(),
true, false, null, 0, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, 0),
new DataRequestMonitor<MIBreakInsertInfo>(ImmediateExecutor.getInstance(), rm) {
fCommandFactory.createMIBreakInsert(bpTargetDmc, true, false, null, 0,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, 0),
new DataRequestMonitor<MIBreakInsertInfo>(ImmediateExecutor.getInstance(), rm) {
@Override
public void handleSuccess() {
if (getData() != null) {
@ -291,8 +295,6 @@ public class StartOrRestartProcessSequence_7_0 extends ReflectionSequence {
GDBRunControl_7_0 reverseService = fTracker.getService(GDBRunControl_7_0.class);
if (reverseService != null) {
reverseService.setReverseModeEnabled(false);
} else {
assert false : "Missing reverse runControl service"; //$NON-NLS-1$
}
}
rm.done();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems and others.
* Copyright (c) 2007, 2011 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,10 +7,10 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 335324)
*******************************************************************************/
package org.eclipse.cdt.dsf.gdb.service.command;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext;
import org.eclipse.cdt.dsf.debug.service.IModules.ISymbolDMContext;
import org.eclipse.cdt.dsf.debug.service.ISignals.ISignalsDMContext;
@ -22,7 +22,7 @@ import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext;
*
*/
public class GDBControlDMContext extends MIControlDMContext
implements ISymbolDMContext, IBreakpointsTargetDMContext, ISourceLookupDMContext,
implements ISymbolDMContext, ISourceLookupDMContext,
ISignalsDMContext, IDisassemblyDMContext, ITraceTargetDMContext
{

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 Ericsson and others.
* Copyright (c) 2008, 2011 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
@ -7,9 +7,11 @@
*
* Contributors:
* Ericsson - initial API and implementation
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 335324)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
/**
@ -18,7 +20,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
* identifier. These thread groups are the basis for this context.
* @since 1.1
*/
public interface IMIContainerDMContext extends IContainerDMContext
public interface IMIContainerDMContext extends IContainerDMContext, IBreakpointsTargetDMContext
{
/**
* Returns the GDB/MI thread group identifier of this context.

View file

@ -38,6 +38,7 @@ import org.eclipse.cdt.dsf.debug.service.command.BufferedCommandControl;
import org.eclipse.cdt.dsf.debug.service.command.CommandCache;
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.internal.service.command.events.MITracepointSelectedEvent;
@ -967,9 +968,19 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
@Override
public void execute(final RequestMonitor rm) {
fContainerDmc = DMContexts.getAncestorOfType(fCtx, IContainerDMContext.class);
if (fContainerDmc != null) {
// In all-stop, if any process is suspended, then all of them are suspended
// so we only need to check this process.
fTargetAvailable = isSuspended(fContainerDmc);
rm.done();
return;
}
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(fCtx, ICommandControlDMContext.class);
IProcesses processControl = getServicesTracker().getService(IProcesses.class);
processControl.getProcessesBeingDebugged(
fCtx,
controlDmc,
new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
@Override
protected void handleSuccess() {

View file

@ -37,6 +37,7 @@ import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.DsfExecutor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Sequence;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.DataModelInitializedEvent;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
import org.eclipse.cdt.dsf.debug.service.ISourceLookup.ISourceLookupDMContext;
@ -47,6 +48,7 @@ import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
import org.eclipse.cdt.dsf.mi.service.CSourceLookup;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
@ -605,9 +607,10 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
public void execute(final RequestMonitor requestMonitor) {
if (fSessionType != SessionType.CORE) {
MIBreakpointsManager bpmService = fTracker.getService(MIBreakpointsManager.class);
IBreakpointsTargetDMContext breakpointDmc = (IBreakpointsTargetDMContext)fCommandControl.getContext();
IMIContainerDMContext containerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), null);
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
bpmService.startTrackingBreakpoints(breakpointDmc, requestMonitor);
bpmService.startTrackingBreakpoints(bpTargetDmc, requestMonitor);
} else {
requestMonitor.done();
}