mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 239050
More use of IProcesses. In the weekly meeting, we had agreed that the RunControl service would make use of IProcesses to list executionContext. To do this, it is the IProcesses service that will now create the MIExecutionDMC, which is newly declared in MIProcesses. Doing this I was able to get rid of IMIRunControl, and I introduced IMIProcesses. Also, we agreed that all RunControl use of IProcesses should be kept out of MIRunControl and put only in GDBRunControl. This is because other backends using MI will probably need a more sophisticated Process service. I still have to move the use of IProcesses out of MIRunControlNS I also cleaned up the RunControl and GDBProcesses unit tests. I also started spreading the use of a String as a ThreadId, while keeping things backwards compatible.
This commit is contained in:
parent
133ac134ee
commit
c227d7fbf1
33 changed files with 457 additions and 488 deletions
|
@ -35,7 +35,7 @@ import org.eclipse.dd.dsf.service.DsfSession;
|
|||
import org.eclipse.dd.gdb.internal.provisional.actions.IConnect;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages;
|
||||
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.dd.mi.service.MIProcesses;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.ProcessInfo;
|
||||
import org.eclipse.dd.mi.service.command.AbstractMIControl;
|
||||
import org.eclipse.dd.mi.service.command.MIControlDMContext;
|
||||
|
@ -169,7 +169,7 @@ public class GdbConnectCommand implements IConnect {
|
|||
@Override
|
||||
protected void handleSuccess() {
|
||||
// New cycle, look for service again
|
||||
final MIProcesses procService = fTracker.getService(MIProcesses.class);
|
||||
final IMIProcesses procService = fTracker.getService(IMIProcesses.class);
|
||||
if (procService != null) {
|
||||
IProcessDMContext procDmc = procService.createProcessContext(controlCtx,
|
||||
Integer.toString(getData()));
|
||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.dd.gdb.internal.ui.viewmodel.launch;
|
|||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch.AbstractThreadVMNode;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMData;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMData;
|
||||
|
@ -23,7 +24,6 @@ import org.eclipse.dd.dsf.ui.concurrent.ViewerDataRequestMonitor;
|
|||
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.AbstractDMVMProvider;
|
||||
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
|
||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
|
||||
|
@ -50,7 +50,7 @@ public class ThreadVMNode extends AbstractThreadVMNode
|
|||
@Override
|
||||
protected void updateLabelInSessionThread(ILabelUpdate[] updates) {
|
||||
for (final ILabelUpdate update : updates) {
|
||||
final IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
|
||||
final IRunControl runControl = getServicesTracker().getService(IRunControl.class);
|
||||
if (runControl == null) {
|
||||
handleFailedUpdate(update);
|
||||
continue;
|
||||
|
|
|
@ -118,7 +118,7 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate
|
|||
|
||||
// Create and invoke the launch sequence to create the debug control and services
|
||||
final ServicesLaunchSequence servicesLaunchSequence =
|
||||
new ServicesLaunchSequence(launch.getSession(), launch, exePath, sessionType, attach);
|
||||
new ServicesLaunchSequence(launch.getSession(), launch);
|
||||
launch.getSession().getExecutor().execute(servicesLaunchSequence);
|
||||
try {
|
||||
servicesLaunchSequence.get();
|
||||
|
|
|
@ -92,7 +92,7 @@ public class LaunchUtils {
|
|||
ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
||||
}
|
||||
|
||||
if (!programPath.isAbsolute()) {
|
||||
if (!programPath.isAbsolute() && cproject != null) {
|
||||
// Find the specified program within the specified project
|
||||
IFile wsProgramPath = cproject.getProject().getFile(programPath);
|
||||
programPath = wsProgramPath.getLocation();
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.dd.gdb.internal.provisional.launching;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.Sequence;
|
||||
import org.eclipse.dd.dsf.debug.service.IBreakpoints;
|
||||
|
@ -26,7 +25,6 @@ import org.eclipse.dd.dsf.debug.service.ISourceLookup;
|
|||
import org.eclipse.dd.dsf.debug.service.IStack;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.mi.service.CSourceLookup;
|
||||
import org.eclipse.dd.mi.service.MIBreakpointsManager;
|
||||
|
||||
|
@ -46,11 +44,11 @@ public class ServicesLaunchSequence extends Sequence {
|
|||
},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fLaunch.getServiceFactory().createService(IRunControl.class, fSession).initialize(requestMonitor);
|
||||
fLaunch.getServiceFactory().createService(IProcesses.class, fSession).initialize(requestMonitor);
|
||||
}},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fLaunch.getServiceFactory().createService(IProcesses.class, fSession).initialize(requestMonitor);
|
||||
fLaunch.getServiceFactory().createService(IRunControl.class, fSession).initialize(requestMonitor);
|
||||
}},
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
|
@ -101,21 +99,14 @@ public class ServicesLaunchSequence extends Sequence {
|
|||
|
||||
DsfSession fSession;
|
||||
GdbLaunch fLaunch;
|
||||
IPath fExecPath;
|
||||
|
||||
SessionType fSessionType;
|
||||
boolean fAttach;
|
||||
|
||||
GDBControl fCommandControl;
|
||||
CSourceLookup fSourceLookup;
|
||||
|
||||
public ServicesLaunchSequence(DsfSession session, GdbLaunch launch, IPath execPath, SessionType sessionType, boolean attach) {
|
||||
|
||||
public ServicesLaunchSequence(DsfSession session, GdbLaunch launch) {
|
||||
super(session.getExecutor());
|
||||
fSession = session;
|
||||
fLaunch = launch;
|
||||
fExecPath = execPath;
|
||||
fSessionType = sessionType;
|
||||
fAttach = attach;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -114,12 +114,12 @@ public class ShutdownSequence extends Sequence {
|
|||
}, new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
shutdownService(IProcesses.class, requestMonitor);
|
||||
shutdownService(IRunControl.class, requestMonitor);
|
||||
}
|
||||
}, new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
shutdownService(IRunControl.class, requestMonitor);
|
||||
shutdownService(IProcesses.class, requestMonitor);
|
||||
}
|
||||
}, new Step() {
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.dd.gdb.internal.GdbPlugin;
|
|||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
|
||||
import org.eclipse.dd.mi.service.IMIProcessDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.MIProcesses;
|
||||
import org.eclipse.dd.mi.service.command.MIControlDMContext;
|
||||
import org.eclipse.dd.mi.service.command.MIInferiorProcess;
|
||||
|
@ -74,6 +75,7 @@ public class GDBProcesses extends MIProcesses {
|
|||
|
||||
// Register this service.
|
||||
register(new String[] { IProcesses.class.getName(),
|
||||
IMIProcesses.class.getName(),
|
||||
MIProcesses.class.getName(),
|
||||
GDBProcesses.class.getName() },
|
||||
new Hashtable<String, String>());
|
||||
|
@ -98,7 +100,6 @@ public class GDBProcesses extends MIProcesses {
|
|||
|
||||
@Override
|
||||
public void getExecutionData(IThreadDMContext dmc, DataRequestMonitor<IThreadDMData> rm) {
|
||||
// We must first check for GdbProcessDMC because it is also a GdbThreadDMC
|
||||
if (dmc instanceof IMIProcessDMContext) {
|
||||
String pidStr = ((IMIProcessDMContext)dmc).getProcId();
|
||||
int pid = -1;
|
||||
|
@ -164,6 +165,7 @@ public class GDBProcesses extends MIProcesses {
|
|||
inferiorProcess.getState() != MIInferiorProcess.State.TERMINATED) {
|
||||
super.getProcessesBeingDebugged(dmc, rm);
|
||||
} else {
|
||||
rm.setData(new IDMContext[0]);
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,63 +23,24 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.GdbPlugin;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.commands.CLIInfoThreads;
|
||||
import org.eclipse.dd.mi.service.command.events.MIEvent;
|
||||
import org.eclipse.dd.mi.service.command.events.MIThreadExitEvent;
|
||||
import org.eclipse.dd.mi.service.command.output.CLIInfoThreadsInfo;
|
||||
|
||||
public class GDBRunControl extends MIRunControl {
|
||||
|
||||
/**
|
||||
* Implement a custom execution data for threads in order to provide additional
|
||||
* information. This object can be made separate from IExecutionDMData after
|
||||
* the deprecated method: IDMService.getModelData() is no longer used.
|
||||
*/
|
||||
public static class GDBThreadData {
|
||||
private final String fId;
|
||||
private final String fName;
|
||||
|
||||
GDBThreadData(String id, String name) {
|
||||
fId = id;
|
||||
fName = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fName;
|
||||
}
|
||||
public String getId() { return fId; }
|
||||
|
||||
public boolean isDebuggerAttached() { return true; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement a custom execution data the process in order to provide additional
|
||||
* information. This object can be made separate from IExecutionDMData after
|
||||
* the deprecated method: IDMService.getModelData() is no longer used.
|
||||
*/
|
||||
public static class GDBProcessData {
|
||||
private final String fName;
|
||||
|
||||
GDBProcessData(String name) {
|
||||
fName = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fName;
|
||||
}
|
||||
}
|
||||
|
||||
private GDBControl fGdb;
|
||||
|
||||
private IMIProcesses fProcService;
|
||||
|
||||
// Record list of execution contexts
|
||||
private IExecutionDMContext[] fOldExecutionCtxts;
|
||||
|
||||
|
@ -101,8 +62,10 @@ public class GDBRunControl extends MIRunControl {
|
|||
private void doInitialize(final RequestMonitor requestMonitor) {
|
||||
|
||||
fGdb = getServicesTracker().getService(GDBControl.class);
|
||||
fProcService = getServicesTracker().getService(IMIProcesses.class);
|
||||
|
||||
register(new String[]{IRunControl.class.getName(),
|
||||
IMIRunControl.class.getName(), MIRunControl.class.getName(),
|
||||
MIRunControl.class.getName(),
|
||||
GDBRunControl.class.getName()}, new Hashtable<String,String>());
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
@ -113,6 +76,19 @@ public class GDBRunControl extends MIRunControl {
|
|||
super.shutdown(requestMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, int threadId) {
|
||||
IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
|
||||
|
||||
IThreadDMContext threadDmc = null;
|
||||
if (procDmc != null) {
|
||||
// For now, reuse the threadId as the OSThreadId
|
||||
threadDmc = fProcService.createThreadContext(procDmc, Integer.toString(threadId));
|
||||
}
|
||||
|
||||
return fProcService.createExecutionContext(container, threadDmc, Integer.toString(threadId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspend(IExecutionDMContext context, final RequestMonitor rm){
|
||||
canSuspend(
|
||||
|
@ -139,50 +115,25 @@ public class GDBRunControl extends MIRunControl {
|
|||
* See bug 200615 for details.
|
||||
*/
|
||||
@Override
|
||||
public void getExecutionContexts(IContainerDMContext c, final DataRequestMonitor<IExecutionDMContext[]> rm) {
|
||||
DataRequestMonitor<IExecutionDMContext[]> rm1 = new DataRequestMonitor<IExecutionDMContext[]>(
|
||||
getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
raiseExitEvents(getData());
|
||||
fOldExecutionCtxts = getData();
|
||||
rm.setData(fOldExecutionCtxts);
|
||||
rm.done();
|
||||
}
|
||||
};
|
||||
super.getExecutionContexts(c, rm1);
|
||||
public void getExecutionContexts(IContainerDMContext containerDmc, final DataRequestMonitor<IExecutionDMContext[]> rm) {
|
||||
fProcService.getProcessesBeingDebugged(
|
||||
containerDmc,
|
||||
new DataRequestMonitor<IDMContext[]>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
if (getData() instanceof IExecutionDMContext[]) {
|
||||
IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData();
|
||||
raiseExitEvents(execDmcs);
|
||||
fOldExecutionCtxts = execDmcs;
|
||||
rm.setData(fOldExecutionCtxts);
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
|
||||
}
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void getProcessData(GDBControlDMContext gdbDmc, DataRequestMonitor<GDBProcessData> rm) {
|
||||
rm.setData( new GDBProcessData(fGdb.getExecutablePath().lastSegment()) );
|
||||
rm.done();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void getThreadData(final IMIExecutionDMContext execDmc, final DataRequestMonitor<GDBThreadData> rm) {
|
||||
IProcessDMContext prodDmc = DMContexts.getAncestorOfType(execDmc, IProcessDMContext.class);
|
||||
getCache().execute(new CLIInfoThreads(prodDmc),
|
||||
new DataRequestMonitor<CLIInfoThreadsInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
rm.setData( createThreadInfo(execDmc, getData()) );
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private GDBThreadData createThreadInfo(IMIExecutionDMContext dmc, CLIInfoThreadsInfo info){
|
||||
for (CLIInfoThreadsInfo.ThreadInfo thread : info.getThreadInfo()) {
|
||||
if(Integer.parseInt(thread.getId()) == dmc.getThreadId()){
|
||||
//fMapThreadIds.put(thread.getId(), String.valueOf(dmc.getId()));
|
||||
return new GDBThreadData(thread.getOsId(), thread.getName());
|
||||
}
|
||||
}
|
||||
return new GDBThreadData("",""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
|
||||
private void raiseExitEvents(IExecutionDMContext[] ctxts){
|
||||
if(ctxts == null || fOldExecutionCtxts == null)
|
||||
return;
|
||||
|
@ -193,7 +144,7 @@ public class GDBRunControl extends MIRunControl {
|
|||
IExecutionDMContext ctxt = iterator.next();
|
||||
if(! list.contains(ctxt)){
|
||||
IContainerDMContext containerDmc = DMContexts.getAncestorOfType(ctxt, IContainerDMContext.class);
|
||||
MIEvent<?> e = new MIThreadExitEvent(containerDmc, ((IMIExecutionDMContext)ctxt).getThreadId());
|
||||
MIEvent<?> e = new MIThreadExitEvent(containerDmc, Integer.toString(((IMIExecutionDMContext)ctxt).getThreadId()));
|
||||
// Dispatch DsfMIThreadExitEvent
|
||||
getSession().dispatchEvent(e, getProperties());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 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:
|
||||
* Ericsson - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.mi.service;
|
||||
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.mi.service.command.MIControlDMContext;
|
||||
|
||||
/**
|
||||
* This interface provides a method for creating execution contexts.
|
||||
*/
|
||||
public interface IMIProcesses extends IProcesses
|
||||
{
|
||||
/**
|
||||
* Create a thread context.
|
||||
*
|
||||
* @param processDmc The parent process context
|
||||
* @param threadId The OS Id of the thread
|
||||
*/
|
||||
IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId);
|
||||
|
||||
/**
|
||||
* Create a process context.
|
||||
*
|
||||
* @param pid The OS Id of the process
|
||||
*/
|
||||
IProcessDMContext createProcessContext(MIControlDMContext controlDmc, String pid);
|
||||
|
||||
/**
|
||||
* Create a execution context.
|
||||
*
|
||||
* @param containerDmc The parent process debugging context
|
||||
* @param threadDmc The parent thread context
|
||||
* @param threadId The thread id of the thread
|
||||
*/
|
||||
IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc,
|
||||
IThreadDMContext threadDmc,
|
||||
String threadId);
|
||||
|
||||
/**
|
||||
* Create a executionGroup context.
|
||||
*
|
||||
* @param processDmc The parent process context of this context
|
||||
* @param groupId The thread group id of the process
|
||||
*/
|
||||
IMIExecutionGroupDMContext createExecutionGroupContext(IProcessDMContext processDmc,
|
||||
String groupId);
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Ericsson - Modified for additional functionality
|
||||
*******************************************************************************/
|
||||
package org.eclipse.dd.mi.service;
|
||||
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
|
||||
/**
|
||||
* This interface provides a method for creating execution contexts.
|
||||
*/
|
||||
public interface IMIRunControl extends IRunControl
|
||||
{
|
||||
public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, int threadId);
|
||||
}
|
|
@ -19,7 +19,6 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
|||
import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExitedDMEvent;
|
||||
|
@ -37,12 +36,14 @@ import org.eclipse.dd.mi.service.command.MIControlDMContext;
|
|||
import org.eclipse.dd.mi.service.command.commands.CLIAttach;
|
||||
import org.eclipse.dd.mi.service.command.commands.CLIDetach;
|
||||
import org.eclipse.dd.mi.service.command.commands.CLIInfoThreads;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIThreadListIds;
|
||||
import org.eclipse.dd.mi.service.command.output.CLIInfoThreadsInfo;
|
||||
import org.eclipse.dd.mi.service.command.output.MIInfo;
|
||||
import org.eclipse.dd.mi.service.command.output.MIThreadListIdsInfo;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
||||
public class MIProcesses extends AbstractDsfService implements IProcesses {
|
||||
public class MIProcesses extends AbstractDsfService implements IMIProcesses {
|
||||
|
||||
// Below is the context hierarchy that is implemented between the
|
||||
// MIProcesses service and the MIRunControl service for the MI
|
||||
|
@ -58,6 +59,67 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
// (IExecution)
|
||||
//
|
||||
|
||||
/**
|
||||
* Context representing a thread in GDB/MI
|
||||
*/
|
||||
@Immutable
|
||||
private static class MIExecutionDMC extends AbstractDMContext
|
||||
implements IMIExecutionDMContext
|
||||
{
|
||||
/**
|
||||
* String ID that is used to identify the thread in the GDB/MI protocol.
|
||||
*/
|
||||
private final String fThreadId;
|
||||
|
||||
/**
|
||||
* Constructor for the context. It should not be called directly by clients.
|
||||
* Instead clients should call {@link IMIProcesses#createExecutionContext()}
|
||||
* to create instances of this context based on the thread ID.
|
||||
* <p/>
|
||||
*
|
||||
* @param sessionId Session that this context belongs to.
|
||||
* @param containerDmc The container that this context belongs to.
|
||||
* @param threadDmc The thread context parents of this context.
|
||||
* @param threadId GDB/MI thread identifier.
|
||||
*/
|
||||
protected MIExecutionDMC(String sessionId, IContainerDMContext containerDmc, IThreadDMContext threadDmc, String threadId) {
|
||||
super(sessionId,
|
||||
containerDmc == null && threadDmc == null ? new IDMContext[0] :
|
||||
containerDmc == null ? new IDMContext[] { threadDmc } :
|
||||
threadDmc == null ? new IDMContext[] { containerDmc } :
|
||||
new IDMContext[] { containerDmc, threadDmc });
|
||||
fThreadId = threadId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the GDB/MI thread identifier of this context.
|
||||
* @return
|
||||
*/
|
||||
public int getThreadId(){
|
||||
try {
|
||||
return Integer.parseInt(fThreadId);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getId(){
|
||||
return fThreadId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() { return baseToString() + ".thread[" + fThreadId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return super.baseEquals(obj) && ((MIExecutionDMC)obj).fThreadId.equals(fThreadId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return super.baseHashCode() ^ fThreadId.hashCode(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Context representing a thread group of GDB/MI.
|
||||
*/
|
||||
|
@ -72,7 +134,7 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
|
||||
/**
|
||||
* Constructor for the context. It should not be called directly by clients.
|
||||
* Instead clients should call {@link MIRunControl#createMIExecutionGroupContext
|
||||
* Instead clients should call {@link IMIProcesses#createExecutionGroupContext
|
||||
* to create instances of this context based on the group name.
|
||||
*
|
||||
* @param sessionId Session that this context belongs to.
|
||||
|
@ -116,7 +178,7 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
|
||||
/**
|
||||
* Constructor for the context. It should not be called directly by clients.
|
||||
* Instead clients should call {@link MIProcesses#createThreadContext}
|
||||
* Instead clients should call {@link IMIProcesses#createThreadContext}
|
||||
* to create instances of this context based on the thread ID.
|
||||
* <p/>
|
||||
*
|
||||
|
@ -159,7 +221,7 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
|
||||
/**
|
||||
* Constructor for the context. It should not be called directly by clients.
|
||||
* Instead clients should call {@link MIProcesses#createProcessContext}
|
||||
* Instead clients should call {@link IMIProcesses#createProcessContext}
|
||||
* to create instances of this context based on the PID.
|
||||
* <p/>
|
||||
*
|
||||
|
@ -234,6 +296,8 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
private AbstractMIControl fCommandControl;
|
||||
private CommandCache fCommandCache;
|
||||
|
||||
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
|
||||
|
||||
public MIProcesses(DsfSession session) {
|
||||
super(session);
|
||||
}
|
||||
|
@ -299,31 +363,20 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
return MIPlugin.getBundleContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a thread context.
|
||||
*
|
||||
* @param processDmc The parent process context
|
||||
* @param threadId The OS Id of the thread
|
||||
*/
|
||||
public IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId) {
|
||||
public IThreadDMContext createThreadContext(IProcessDMContext processDmc, String threadId) {
|
||||
return new MIThreadDMC(getSession().getId(), processDmc, threadId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a process context.
|
||||
*
|
||||
* @param pid The OS Id of the process
|
||||
*/
|
||||
public IProcessDMContext createProcessContext(MIControlDMContext controlDmc, String pid) {
|
||||
return new MIProcessDMC(getSession().getId(), controlDmc, pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a executionGroup context.
|
||||
*
|
||||
* @param processDmc The parent process context of this context
|
||||
* @param groupId The thread group id of the process
|
||||
*/
|
||||
public IMIExecutionDMContext createExecutionContext(IContainerDMContext containerDmc,
|
||||
IThreadDMContext threadDmc,
|
||||
String threadId) {
|
||||
return new MIExecutionDMC(getSession().getId(), containerDmc, threadDmc, threadId);
|
||||
}
|
||||
|
||||
public IMIExecutionGroupDMContext createExecutionGroupContext(IProcessDMContext processDmc,
|
||||
String groupId) {
|
||||
return new MIExecutionGroupDMC(getSession().getId(), processDmc, groupId);
|
||||
|
@ -457,15 +510,51 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
rm.done();
|
||||
}
|
||||
|
||||
public void getProcessesBeingDebugged(IDMContext dmc, DataRequestMonitor<IDMContext[]> rm) {
|
||||
// This service version only handles a single process to debug, therefore, we can simply
|
||||
// create the context describing this process ourselves.
|
||||
MIControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, MIControlDMContext.class);
|
||||
IMIExecutionGroupDMContext groupDmc = createExecutionGroupContext(createProcessContext(controlDmc, ""), "");//$NON-NLS-1$//$NON-NLS-2$
|
||||
rm.setData(new IContainerDMContext[] {groupDmc});
|
||||
rm.done();
|
||||
public void getProcessesBeingDebugged(IDMContext dmc, final DataRequestMonitor<IDMContext[]> rm) {
|
||||
final IMIExecutionGroupDMContext groupDmc = DMContexts.getAncestorOfType(dmc, IMIExecutionGroupDMContext.class);
|
||||
if (groupDmc != null) {
|
||||
fCommandCache.execute(
|
||||
new MIThreadListIds(groupDmc),
|
||||
new DataRequestMonitor<MIThreadListIdsInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
rm.setData(makeExecutionDMCs(groupDmc, getData()));
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// This service version only handles a single process to debug, therefore, we can simply
|
||||
// create the context describing this process ourselves.
|
||||
MIControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, MIControlDMContext.class);
|
||||
IMIExecutionGroupDMContext newGroupDmc = createExecutionGroupContext(createProcessContext(controlDmc, ""), "");//$NON-NLS-1$//$NON-NLS-2$
|
||||
rm.setData(new IContainerDMContext[] {newGroupDmc});
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
private IExecutionDMContext[] makeExecutionDMCs(IContainerDMContext containerDmc, MIThreadListIdsInfo info) {
|
||||
final IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
|
||||
|
||||
if (info.getStrThreadIds().length == 0) {
|
||||
// Main thread always exist even if it is not reported by GDB.
|
||||
// So create thread-id = 0 when no thread is reported.
|
||||
// This hack is necessary to prevent AbstractMIControl from issuing a thread-select
|
||||
// because it doesn't work if the application was not compiled with pthread.
|
||||
return new IMIExecutionDMContext[]{createExecutionContext(containerDmc,
|
||||
createThreadContext(procDmc, FAKE_THREAD_ID),
|
||||
FAKE_THREAD_ID)};
|
||||
} else {
|
||||
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getStrThreadIds().length];
|
||||
for (int i = 0; i < info.getStrThreadIds().length; i++) {
|
||||
String threadId = info.getStrThreadIds()[i];
|
||||
executionDmcs[i] = createExecutionContext(containerDmc,
|
||||
createThreadContext(procDmc, threadId),
|
||||
threadId);
|
||||
}
|
||||
return executionDmcs;
|
||||
}
|
||||
}
|
||||
|
||||
public void getRunningProcesses(IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID,
|
||||
NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||
|
@ -491,7 +580,6 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(IResumedDMEvent e) {
|
||||
fCommandCache.setContextAvailable(e.getDMContext(), false);
|
||||
fCommandCache.setContextAvailable(fCommandControl.getControlDMContext(), true);
|
||||
if (e.getReason() != StateChangeReason.STEP) {
|
||||
fCommandCache.reset();
|
||||
}
|
||||
|
@ -501,6 +589,7 @@ public class MIProcesses extends AbstractDsfService implements IProcesses {
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(ISuspendedDMEvent e) {
|
||||
fCommandCache.setContextAvailable(e.getDMContext(), true);
|
||||
fCommandCache.setContextAvailable(fCommandControl.getControlDMContext(), true);
|
||||
fCommandCache.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,7 @@ import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
|
|||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
|
||||
import org.eclipse.dd.dsf.service.AbstractDsfService;
|
||||
|
@ -72,8 +71,9 @@ import org.osgi.framework.BundleContext;
|
|||
* events and track service state, to be perfectly in sync with the service
|
||||
* state.
|
||||
*/
|
||||
public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
||||
public class MIRunControl extends AbstractDsfService implements IRunControl
|
||||
{
|
||||
@Deprecated
|
||||
protected class MIExecutionDMC extends AbstractDMContext implements IMIExecutionDMContext
|
||||
{
|
||||
/**
|
||||
|
@ -91,27 +91,10 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
|||
*
|
||||
* @param sessionId Session that this context belongs to.
|
||||
* @param containerDmc The container that this context belongs to.
|
||||
* @param threadDmc The thread context parents of this context.
|
||||
* @param threadId GDB/MI thread identifier.
|
||||
*/
|
||||
protected MIExecutionDMC(String sessionId, IContainerDMContext containerDmc, IThreadDMContext threadDmc, int threadId) {
|
||||
super(sessionId,
|
||||
containerDmc == null && threadDmc == null ? new IDMContext[0] :
|
||||
containerDmc == null ? new IDMContext[] { threadDmc } :
|
||||
threadDmc == null ? new IDMContext[] { containerDmc } :
|
||||
new IDMContext[] { containerDmc, threadDmc });
|
||||
fThreadId = threadId;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected MIExecutionDMC(String sessionId, IContainerDMContext containerDmc, int threadId) {
|
||||
super(sessionId,
|
||||
containerDmc == null ? new IDMContext[0]
|
||||
: new IDMContext[] { containerDmc,
|
||||
fProcService.createThreadContext(DMContexts.getAncestorOfType(containerDmc,
|
||||
IProcessDMContext.class),
|
||||
Integer.toString(threadId)) });
|
||||
|
||||
super(sessionId, containerDmc != null ? new IDMContext[] { containerDmc } : new IDMContext[0]);
|
||||
fThreadId = threadId;
|
||||
}
|
||||
|
||||
|
@ -277,7 +260,6 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
|||
|
||||
private AbstractMIControl fConnection;
|
||||
private CommandCache fMICommandCache;
|
||||
private MIProcesses fProcService;
|
||||
|
||||
// State flags
|
||||
private boolean fSuspended = true;
|
||||
|
@ -308,7 +290,6 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
|||
fConnection = getServicesTracker().getService(AbstractMIControl.class);
|
||||
fMICommandCache = new CommandCache(getSession(), fConnection);
|
||||
fMICommandCache.setContextAvailable(fConnection.getControlDMContext(), true);
|
||||
fProcService = getServicesTracker().getService(MIProcesses.class);
|
||||
getSession().addServiceEventListener(this, null);
|
||||
rm.done();
|
||||
}
|
||||
|
@ -335,16 +316,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
|||
public CommandCache getCache() { return fMICommandCache; }
|
||||
|
||||
public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, int threadId) {
|
||||
MIProcesses procService = getServicesTracker().getService(MIProcesses.class);
|
||||
IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
|
||||
|
||||
IThreadDMContext threadDmc = null;
|
||||
if (procService != null && procDmc != null) {
|
||||
// For now, reuse the threadId as the OSThreadId
|
||||
threadDmc = procService.createThreadContext(procDmc, Integer.toString(threadId));
|
||||
}
|
||||
|
||||
return new MIExecutionDMC(getSession().getId(), container, threadDmc, threadId);
|
||||
return new MIExecutionDMC(getSession().getId(), container, threadId);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -390,7 +362,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(final MIThreadCreatedEvent e) {
|
||||
IContainerDMContext containerDmc = e.getDMContext();
|
||||
IMIExecutionDMContext executionCtx = e.getId() != -1 ? createMIExecutionContext(containerDmc, e.getId()) : null;
|
||||
IMIExecutionDMContext executionCtx = e.getStrId() != null ? createMIExecutionContext(containerDmc, e.getId()) : null;
|
||||
getSession().dispatchEvent(new StartedDMEvent(executionCtx, e), getProperties());
|
||||
}
|
||||
|
||||
|
@ -401,7 +373,7 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl
|
|||
@DsfServiceEventHandler
|
||||
public void eventDispatched(final MIThreadExitEvent e) {
|
||||
IContainerDMContext containerDmc = e.getDMContext();
|
||||
IMIExecutionDMContext executionCtx = e.getId() != -1 ? createMIExecutionContext(containerDmc, e.getId()) : null;
|
||||
IMIExecutionDMContext executionCtx = e.getStrId() != null ? createMIExecutionContext(containerDmc, e.getId()) : null;
|
||||
getSession().dispatchEvent(new ExitedDMEvent(executionCtx, e), getProperties());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,13 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.AbstractDMEvent;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMEvent;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.CommandCache;
|
||||
import org.eclipse.dd.dsf.service.AbstractDsfService;
|
||||
|
@ -71,57 +72,8 @@ import org.osgi.framework.BundleContext;
|
|||
* that listen to service events and track service state, to be perfectly in
|
||||
* sync with the service state.
|
||||
*/
|
||||
public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
||||
public class MIRunControlNS extends AbstractDsfService implements IRunControl
|
||||
{
|
||||
// This is an exact copy of the structures in MIRunControl. In an ideal world,
|
||||
// it would be declared only once in IMIRunControl but this is real life and
|
||||
// it has to be duplicated for the sake of backward compatibility.
|
||||
// It sucks and leads to bloated, error-prone code but that's the way it is.
|
||||
@Immutable
|
||||
private static class MIExecutionDMCNS extends AbstractDMContext implements IMIExecutionDMContext
|
||||
{
|
||||
/**
|
||||
* Integer ID that is used to identify the thread in the GDB/MI protocol.
|
||||
*/
|
||||
private final int fThreadId;
|
||||
|
||||
/**
|
||||
* Constructor for the context. It should not be called directly by clients.
|
||||
* Instead clients should call {@link MIRunControl#createMIExecutionContext(IContainerDMContext, int)}
|
||||
* to create instances of this context based on the thread ID.
|
||||
* <p/>
|
||||
* Classes extending {@link MIRunControl} may also extend this class to include
|
||||
* additional information in the context.
|
||||
*
|
||||
* @param sessionId Session that this context belongs to.
|
||||
* @param containerDmc The container that this context belongs to.
|
||||
* @param threadId GDB/MI thread identifier.
|
||||
*/
|
||||
protected MIExecutionDMCNS(String sessionId, IContainerDMContext containerDmc, int threadId) {
|
||||
super(sessionId, containerDmc != null ? new IDMContext[] { containerDmc } : new IDMContext[0]);
|
||||
fThreadId = threadId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the GDB/MI thread identifier of this context.
|
||||
* @return
|
||||
*/
|
||||
public int getThreadId(){
|
||||
return fThreadId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() { return baseToString() + ".thread[" + fThreadId + "]"; } //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return super.baseEquals(obj) && ((MIExecutionDMCNS)obj).fThreadId == fThreadId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return super.baseHashCode() ^ fThreadId; }
|
||||
}
|
||||
|
||||
@Immutable
|
||||
static class ExecutionData implements IExecutionDMData {
|
||||
private final StateChangeReason fReason;
|
||||
|
@ -322,7 +274,7 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
}
|
||||
|
||||
private void doInitialize(final RequestMonitor rm) {
|
||||
register(new String[]{IRunControl.class.getName(), IMIRunControl.class.getName()}, new Hashtable<String,String>());
|
||||
register(new String[]{IRunControl.class.getName()}, new Hashtable<String,String>());
|
||||
fConnection = getServicesTracker().getService(AbstractMIControl.class);
|
||||
fMICommandCache = new CommandCache(getSession(), fConnection);
|
||||
fMICommandCache.setContextAvailable(fConnection.getControlDMContext(), true);
|
||||
|
@ -372,7 +324,7 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
public boolean isSuspended(IExecutionDMContext context) {
|
||||
|
||||
// Thread case
|
||||
if (context instanceof MIExecutionDMCNS) {
|
||||
if (context instanceof IMIExecutionDMContext) {
|
||||
MIThreadRunState threadState = fThreadRunStates.get(context);
|
||||
return (threadState == null) ? false : !fTerminated && threadState.fSuspended;
|
||||
}
|
||||
|
@ -395,7 +347,7 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
public void canSuspend(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
|
||||
// Thread case
|
||||
if (context instanceof MIExecutionDMCNS) {
|
||||
if (context instanceof IMIExecutionDMContext) {
|
||||
rm.setData(doCanSuspend(context));
|
||||
rm.done();
|
||||
return;
|
||||
|
@ -472,7 +424,7 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
public void canResume(IExecutionDMContext context, DataRequestMonitor<Boolean> rm) {
|
||||
|
||||
// Thread case
|
||||
if (context instanceof MIExecutionDMCNS) {
|
||||
if (context instanceof IMIExecutionDMContext) {
|
||||
rm.setData(doCanResume(context));
|
||||
rm.done();
|
||||
return;
|
||||
|
@ -558,7 +510,7 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
public boolean isStepping(IExecutionDMContext context) {
|
||||
|
||||
// If it's a thread, just look it up
|
||||
if (context instanceof MIExecutionDMCNS) {
|
||||
if (context instanceof IMIExecutionDMContext) {
|
||||
MIThreadRunState threadState = fThreadRunStates.get(context);
|
||||
return (threadState == null) ? false : !fTerminated && threadState.fStepping;
|
||||
}
|
||||
|
@ -570,7 +522,7 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
public void canStep(IExecutionDMContext context, StepType stepType, DataRequestMonitor<Boolean> rm) {
|
||||
|
||||
// If it's a thread, just look it up
|
||||
if (context instanceof MIExecutionDMCNS) {
|
||||
if (context instanceof IMIExecutionDMContext) {
|
||||
canResume(context, rm);
|
||||
return;
|
||||
}
|
||||
|
@ -706,9 +658,9 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
}
|
||||
|
||||
private IExecutionDMContext[] makeExecutionDMCs(IContainerDMContext containerCtx, MIThreadListIdsInfo info) {
|
||||
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getThreadIds().length];
|
||||
for (int i = 0; i < info.getThreadIds().length; i++) {
|
||||
executionDmcs[i] = createMIExecutionContext(containerCtx, info.getThreadIds()[i]);
|
||||
IExecutionDMContext[] executionDmcs = new IMIExecutionDMContext[info.getStrThreadIds().length];
|
||||
for (int i = 0; i < info.getStrThreadIds().length; i++) {
|
||||
executionDmcs[i] = createMIExecutionContext(containerCtx, info.getStrThreadIds()[i]);
|
||||
}
|
||||
return executionDmcs;
|
||||
}
|
||||
|
@ -731,18 +683,21 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
rm.done();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IMIRunControl
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, int threadId) {
|
||||
return new MIExecutionDMCNS(getSession().getId(), container, threadId);
|
||||
private IMIExecutionDMContext createMIExecutionContext(IContainerDMContext container, String threadId) {
|
||||
IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
|
||||
|
||||
IProcessDMContext procDmc = DMContexts.getAncestorOfType(container, IProcessDMContext.class);
|
||||
|
||||
IThreadDMContext threadDmc = null;
|
||||
if (procDmc != null) {
|
||||
// For now, reuse the threadId as the OSThreadId
|
||||
threadDmc = procService.createThreadContext(procDmc, threadId);
|
||||
}
|
||||
|
||||
return procService.createExecutionContext(container, threadDmc, threadId);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IMIRunControl
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public CommandCache getCache() {
|
||||
return fMICommandCache;
|
||||
}
|
||||
|
@ -842,8 +797,8 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
public void eventDispatched(final MIThreadCreatedEvent e) {
|
||||
IContainerDMContext containerDmc = e.getDMContext();
|
||||
IMIExecutionDMContext executionCtx = null;
|
||||
if (e.getId() != -1) {
|
||||
executionCtx = createMIExecutionContext(containerDmc, e.getId());
|
||||
if (e.getStrId() != null) {
|
||||
executionCtx = createMIExecutionContext(containerDmc, e.getStrId());
|
||||
if (fThreadRunStates.get(executionCtx) == null) {
|
||||
fThreadRunStates.put(executionCtx, new MIThreadRunState());
|
||||
}
|
||||
|
@ -855,8 +810,8 @@ public class MIRunControlNS extends AbstractDsfService implements IMIRunControl
|
|||
public void eventDispatched(final MIThreadExitEvent e) {
|
||||
IContainerDMContext containerDmc = e.getDMContext();
|
||||
IMIExecutionDMContext executionCtx = null;
|
||||
if (e.getId() != -1) {
|
||||
executionCtx = createMIExecutionContext(containerDmc, e.getId());
|
||||
if (e.getStrId() != null) {
|
||||
executionCtx = createMIExecutionContext(containerDmc, e.getStrId());
|
||||
fThreadRunStates.remove(executionCtx);
|
||||
}
|
||||
getSession().dispatchEvent(new ExitedDMEvent(executionCtx, e), getProperties());
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
|||
import org.eclipse.dd.dsf.datamodel.AbstractDMContext;
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack;
|
||||
import org.eclipse.dd.dsf.debug.service.IStack2;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
|
@ -124,7 +125,7 @@ public class MIStackNS extends AbstractDsfService
|
|||
|
||||
private CommandCache fMICommandCache;
|
||||
private MIStoppedEvent fCachedStoppedEvent;
|
||||
private IMIRunControl fMIRunControl;
|
||||
private IRunControl fRunControl;
|
||||
|
||||
public MIStackNS(DsfSession session)
|
||||
{
|
||||
|
@ -152,7 +153,7 @@ public class MIStackNS extends AbstractDsfService
|
|||
AbstractMIControl miControl = getServicesTracker().getService(AbstractMIControl.class);
|
||||
fMICommandCache = new CommandCache(getSession(), miControl);
|
||||
fMICommandCache.setContextAvailable(miControl.getControlDMContext(), true);
|
||||
fMIRunControl = getServicesTracker().getService(IMIRunControl.class);
|
||||
fRunControl = getServicesTracker().getService(IRunControl.class);
|
||||
|
||||
getSession().addServiceEventListener(this, null);
|
||||
register(new String[]{IStack.class.getName(), MIStackNS.class.getName()}, new Hashtable<String,String>());
|
||||
|
@ -219,7 +220,7 @@ public class MIStackNS extends AbstractDsfService
|
|||
}
|
||||
|
||||
// Make sure the thread is stopped
|
||||
if (!fMIRunControl.isSuspended(execDmc)) {
|
||||
if (!fRunControl.isSuspended(execDmc)) {
|
||||
rm.setData(new IFrameDMContext[0]);
|
||||
rm.done();
|
||||
return;
|
||||
|
@ -623,7 +624,7 @@ public class MIStackNS extends AbstractDsfService
|
|||
}
|
||||
|
||||
// Make sure the thread is stopped
|
||||
if (!fMIRunControl.isSuspended(execDmc)) {
|
||||
if (!fRunControl.isSuspended(execDmc)) {
|
||||
rm.setData(0);
|
||||
rm.done();
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.eclipse.dd.dsf.debug.service.command.ICommandToken;
|
|||
import org.eclipse.dd.dsf.debug.service.command.IEventListener;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.MIProcesses;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.command.commands.CLICommand;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIInterpreterExecConsole;
|
||||
import org.eclipse.dd.mi.service.command.events.MIBreakpointChangedEvent;
|
||||
|
@ -123,10 +123,10 @@ public class CLIEventProcessor
|
|||
Pattern pattern = Pattern.compile("(^\\[New Thread.*LWP\\s*)(\\d*)", Pattern.MULTILINE); //$NON-NLS-1$
|
||||
Matcher matcher = pattern.matcher(exec.getCString());
|
||||
if (matcher.find()) {
|
||||
MIProcesses procService = fServicesTracker.getService(MIProcesses.class);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, ""); //$NON-NLS-1$
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, ""); //$NON-NLS-1$
|
||||
MIEvent<?> e = new MIThreadCreatedEvent(processContainerDmc, ++fLastThreadId);
|
||||
MIEvent<?> e = new MIThreadCreatedEvent(processContainerDmc, Integer.toString(++fLastThreadId));
|
||||
fCommandControl.getSession().dispatchEvent(e, fCommandControl.getProperties());
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class CLIEventProcessor
|
|||
if (fInferior != null && "error".equals(state)) { //$NON-NLS-1$
|
||||
if (fInferior.getState() == MIInferiorProcess.State.RUNNING) {
|
||||
fInferior.setState(MIInferiorProcess.State.STOPPED);
|
||||
MIProcesses procService = fServicesTracker.getService(MIProcesses.class);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, ""); //$NON-NLS-1$
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, ""); //$NON-NLS-1$
|
||||
fCommandControl.getSession().dispatchEvent(
|
||||
|
@ -190,7 +190,7 @@ public class CLIEventProcessor
|
|||
int type = getSteppingOperationKind(operation);
|
||||
if (type != -1) {
|
||||
// if it was a step instruction set state running
|
||||
MIProcesses procService = fServicesTracker.getService(MIProcesses.class);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, ""); //$NON-NLS-1$
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, ""); //$NON-NLS-1$
|
||||
MIEvent<?> event = new MIRunningEvent(processContainerDmc, token, type);
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.dd.dsf.datamodel.DMContexts;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.command.ICommand;
|
||||
|
@ -25,8 +26,7 @@ import org.eclipse.dd.dsf.debug.service.command.ICommandToken;
|
|||
import org.eclipse.dd.dsf.debug.service.command.IEventListener;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.mi.internal.MIPlugin;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIProcesses;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIExecContinue;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIExecFinish;
|
||||
import org.eclipse.dd.mi.service.command.commands.MIExecNext;
|
||||
|
@ -172,7 +172,7 @@ public class MIRunControlEventProcessor
|
|||
}
|
||||
}
|
||||
|
||||
MIProcesses procService = fServicesTracker.getService(MIProcesses.class);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, ""); //$NON-NLS-1$
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||
|
||||
|
@ -213,22 +213,15 @@ public class MIRunControlEventProcessor
|
|||
}
|
||||
}
|
||||
|
||||
IMIRunControl runControl = fServicesTracker.getService(IMIRunControl.class);
|
||||
MIProcesses procService = fServicesTracker.getService(MIProcesses.class);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, ""); //$NON-NLS-1$
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, groupId);
|
||||
|
||||
IExecutionDMContext execDmc = processContainerDmc;
|
||||
if (runControl != null && threadId != null) {
|
||||
int threadIdInt = -1;
|
||||
try {
|
||||
threadIdInt = Integer.parseInt(threadId);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
if (threadIdInt != -1) {
|
||||
execDmc = runControl.createMIExecutionContext(processContainerDmc, threadIdInt);
|
||||
}
|
||||
if (procService != null && threadId != null) {
|
||||
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
|
||||
execDmc = procService.createExecutionContext(processContainerDmc, threadDmc, threadId);
|
||||
}
|
||||
|
||||
MIEvent<?> event = null;
|
||||
|
@ -297,7 +290,7 @@ public class MIRunControlEventProcessor
|
|||
else if (cmd instanceof MIExecContinue) { type = MIRunningEvent.CONTINUE; }
|
||||
else { type = MIRunningEvent.CONTINUE; }
|
||||
|
||||
MIProcesses procService = fServicesTracker.getService(MIProcesses.class);
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, ""); //$NON-NLS-1$
|
||||
IContainerDMContext processContainerDmc = procService.createExecutionGroupContext(procDmc, ""); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIConst;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
@ -41,7 +41,7 @@ public class MIBreakpointHitEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MIBreakpointHitEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
int bkptno = -1;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIConst;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
@ -55,7 +55,7 @@ public class MIFunctionFinishedEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MIFunctionFinishedEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
String gdbResult = ""; //$NON-NLS-1$
|
||||
String returnValue = ""; //$NON-NLS-1$
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class MILocationReachedEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MILocationReachedEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(runControl, containerDmc, token, results);
|
||||
return new MILocationReachedEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame());
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class MISharedLibEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MIStoppedEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(runControl, containerDmc, token, results);
|
||||
return new MISharedLibEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame());
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIConst;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
@ -51,7 +51,7 @@ public class MISignalEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MISignalEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
String sigName = ""; //$NON-NLS-1$
|
||||
String sigMeaning = ""; //$NON-NLS-1$
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class MISteppingRangeEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MISteppingRangeEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
MIStoppedEvent stoppedEvent = MIStoppedEvent.parse(runControl, containerDmc, token, results);
|
||||
return new MISteppingRangeEvent(stoppedEvent.getDMContext(), token, results, stoppedEvent.getFrame());
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIConst;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
@ -42,7 +42,7 @@ public class MIStoppedEvent extends MIEvent<IExecutionDMContext> {
|
|||
|
||||
@Deprecated
|
||||
public static MIStoppedEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
int threadId = -1;
|
||||
MIFrame frame = null;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.dd.mi.service.command.output.MIValue;
|
|||
@Immutable
|
||||
public class MIThreadCreatedEvent extends MIEvent<IContainerDMContext> {
|
||||
|
||||
final private int tid;
|
||||
final private String fThreadId;
|
||||
|
||||
public MIThreadCreatedEvent(IContainerDMContext ctx, int id) {
|
||||
this(ctx, 0, id);
|
||||
|
@ -34,11 +34,29 @@ public class MIThreadCreatedEvent extends MIEvent<IContainerDMContext> {
|
|||
|
||||
public MIThreadCreatedEvent(IContainerDMContext ctx, int token, int id) {
|
||||
super(ctx, token, null);
|
||||
tid = id;
|
||||
fThreadId = Integer.toString(id);
|
||||
}
|
||||
|
||||
public MIThreadCreatedEvent(IContainerDMContext ctx, String threadId) {
|
||||
this(ctx, 0, threadId);
|
||||
}
|
||||
|
||||
public MIThreadCreatedEvent(IContainerDMContext ctx, int token, String threadId) {
|
||||
super(ctx, token, null);
|
||||
fThreadId = threadId;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return tid;
|
||||
try {
|
||||
return Integer.parseInt(fThreadId);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public String getStrId() {
|
||||
return fThreadId;
|
||||
}
|
||||
|
||||
public static MIThreadCreatedEvent parse(IContainerDMContext ctx, int token, MIResult[] results)
|
||||
|
@ -48,13 +66,7 @@ public class MIThreadCreatedEvent extends MIEvent<IContainerDMContext> {
|
|||
MIValue val = results[i].getMIValue();
|
||||
if (var.equals("id")) { //$NON-NLS-1$
|
||||
if (val instanceof MIConst) {
|
||||
try {
|
||||
int thread = Integer.parseInt(((MIConst) val).getString());
|
||||
return new MIThreadCreatedEvent(ctx, token, thread);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
return new MIThreadCreatedEvent(ctx, token, ((MIConst) val).getString().trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,19 +26,37 @@ import org.eclipse.dd.mi.service.command.output.MIValue;
|
|||
@Immutable
|
||||
public class MIThreadExitEvent extends MIEvent<IContainerDMContext> {
|
||||
|
||||
final private int tid;
|
||||
final private String fThreadId;
|
||||
|
||||
public MIThreadExitEvent(IContainerDMContext ctx, int id) {
|
||||
this(ctx, 0, id);
|
||||
}
|
||||
|
||||
|
||||
public MIThreadExitEvent(IContainerDMContext ctx, int token, int id) {
|
||||
super(ctx, token, null);
|
||||
tid = id;
|
||||
fThreadId = Integer.toString(id);
|
||||
}
|
||||
|
||||
public MIThreadExitEvent(IContainerDMContext ctx, String threadId) {
|
||||
this(ctx, 0, threadId);
|
||||
}
|
||||
|
||||
public MIThreadExitEvent(IContainerDMContext ctx, int token, String threadId) {
|
||||
super(ctx, token, null);
|
||||
fThreadId = threadId;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return tid;
|
||||
try {
|
||||
return Integer.parseInt(fThreadId);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public String getStrId() {
|
||||
return fThreadId;
|
||||
}
|
||||
|
||||
public static MIThreadExitEvent parse(IContainerDMContext ctx, int token, MIResult[] results)
|
||||
|
@ -48,13 +66,7 @@ public class MIThreadExitEvent extends MIEvent<IContainerDMContext> {
|
|||
MIValue val = results[i].getMIValue();
|
||||
if (var.equals("id")) { //$NON-NLS-1$
|
||||
if (val instanceof MIConst) {
|
||||
try {
|
||||
int thread = Integer.parseInt(((MIConst) val).getString());
|
||||
return new MIThreadExitEvent(ctx, token, thread);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
return new MIThreadExitEvent(ctx, token, ((MIConst) val).getString().trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIConst;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
@ -43,7 +43,7 @@ public class MIWatchpointScopeEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MIWatchpointScopeEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
int number = 0;
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
|
|
|
@ -15,7 +15,7 @@ package org.eclipse.dd.mi.service.command.events;
|
|||
import org.eclipse.dd.dsf.concurrent.Immutable;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIRunControl;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.output.MIConst;
|
||||
import org.eclipse.dd.mi.service.command.output.MIFrame;
|
||||
import org.eclipse.dd.mi.service.command.output.MIResult;
|
||||
|
@ -63,7 +63,7 @@ public class MIWatchpointTriggerEvent extends MIStoppedEvent {
|
|||
|
||||
@Deprecated
|
||||
public static MIWatchpointTriggerEvent parse(
|
||||
IMIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
MIRunControl runControl, IContainerDMContext containerDmc, int token, MIResult[] results)
|
||||
{
|
||||
int number = 0;
|
||||
String exp = ""; //$NON-NLS-1$
|
||||
|
|
|
@ -17,6 +17,7 @@ package org.eclipse.dd.mi.service.command.output;
|
|||
public class MIThreadListIdsInfo extends MIInfo {
|
||||
|
||||
int[] threadIds;
|
||||
private String[] strThreadIds;
|
||||
|
||||
public MIThreadListIdsInfo(MIOutput out) {
|
||||
super(out);
|
||||
|
@ -24,9 +25,27 @@ public class MIThreadListIdsInfo extends MIInfo {
|
|||
|
||||
public int[] getThreadIds() {
|
||||
if (threadIds == null) {
|
||||
// To make sure that the threads have be parsed
|
||||
String[] tIds = getStrThreadIds();
|
||||
|
||||
threadIds = new int[tIds.length];
|
||||
for (int i=0; i<tIds.length; i++) {
|
||||
try {
|
||||
threadIds[i] = Integer.parseInt(tIds[i]);
|
||||
} catch (NumberFormatException e) {
|
||||
threadIds[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return threadIds;
|
||||
}
|
||||
|
||||
public String[] getStrThreadIds() {
|
||||
if (strThreadIds == null) {
|
||||
parse();
|
||||
}
|
||||
return threadIds;
|
||||
return strThreadIds;
|
||||
}
|
||||
|
||||
void parse() {
|
||||
|
@ -46,24 +65,20 @@ public class MIThreadListIdsInfo extends MIInfo {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (threadIds == null) {
|
||||
threadIds = new int[0];
|
||||
if (strThreadIds == null) {
|
||||
strThreadIds = new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
void parseThreadIds(MITuple tuple) {
|
||||
MIResult[] results = tuple.getMIResults();
|
||||
threadIds = new int[results.length];
|
||||
strThreadIds = new String[results.length];
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
String var = results[i].getVariable();
|
||||
if (var.equals("thread-id")) { //$NON-NLS-1$
|
||||
MIValue value = results[i].getMIValue();
|
||||
if (value instanceof MIConst) {
|
||||
String str = ((MIConst)value).getCString();
|
||||
try {
|
||||
threadIds[i] = Integer.parseInt(str.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
strThreadIds[i] = ((MIConst)value).getCString().trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.junit.runners.Suite;
|
|||
MIMemoryTest.class,
|
||||
MIBreakpointsTest.class,
|
||||
MIDisassemblyTest.class,
|
||||
|
||||
GDBProcessesTest.class
|
||||
/* Add your test class here */
|
||||
})
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ import java.util.regex.Pattern;
|
|||
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IThreadDMData;
|
||||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.dsf.service.DsfSession;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.GDBRunControl;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.GDBRunControl.GDBProcessData;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.GDBRunControl.GDBThreadData;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.MIProcesses;
|
||||
import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor;
|
||||
import org.eclipse.dd.tests.gdb.framework.BaseTestCase;
|
||||
import org.eclipse.dd.tests.gdb.launching.TestsPlugin;
|
||||
|
@ -52,7 +52,7 @@ public class GDBProcessesTest extends BaseTestCase {
|
|||
private DsfServicesTracker fServicesTracker;
|
||||
|
||||
private GDBControl fGdbCtrl;
|
||||
private GDBRunControl fRunCtrl;
|
||||
private MIProcesses fProcService;
|
||||
|
||||
/*
|
||||
* Create a waiter and a generic completion object. They will be used to
|
||||
|
@ -67,13 +67,13 @@ public class GDBProcessesTest extends BaseTestCase {
|
|||
/*
|
||||
* Get the GDBProcesses & MIRunControl service.
|
||||
*/
|
||||
fRunCtrl = fServicesTracker.getService(GDBRunControl.class);
|
||||
fProcService = fServicesTracker.getService(MIProcesses.class);
|
||||
fGdbCtrl = fServicesTracker.getService(GDBControl.class);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
fRunCtrl = null;
|
||||
fProcService = null;
|
||||
fServicesTracker.dispose();
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,8 @@ public class GDBProcessesTest extends BaseTestCase {
|
|||
/*
|
||||
* Create a request monitor
|
||||
*/
|
||||
final DataRequestMonitor<GDBProcessData> rm =
|
||||
new DataRequestMonitor<GDBProcessData>(fSession.getExecutor(), null) {
|
||||
final DataRequestMonitor<IThreadDMData> rm =
|
||||
new DataRequestMonitor<IThreadDMData>(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
if (isSuccess()) {
|
||||
|
@ -108,7 +108,8 @@ public class GDBProcessesTest extends BaseTestCase {
|
|||
*/
|
||||
fSession.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fRunCtrl.getProcessData(fGdbCtrl.getGDBDMContext(), rm);
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGdbCtrl.getGDBDMContext(), "");
|
||||
fProcService.getExecutionData(procDmc, rm);
|
||||
}
|
||||
});
|
||||
/*
|
||||
|
@ -123,7 +124,7 @@ public class GDBProcessesTest extends BaseTestCase {
|
|||
/*
|
||||
* Get process data
|
||||
*/
|
||||
GDBProcessData processData = rm.getData();
|
||||
IThreadDMData processData = (IThreadDMData)fWait.getReturnInfo();
|
||||
|
||||
if(processData == null)
|
||||
Assert.fail("No process data is returned for Process DMC");
|
||||
|
@ -135,14 +136,14 @@ public class GDBProcessesTest extends BaseTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
IMIExecutionDMContext fExecDmc = null;
|
||||
/*
|
||||
* getThreadData() for multiple threads
|
||||
*/
|
||||
@Test
|
||||
public void getThreadData() throws InterruptedException{
|
||||
final DataRequestMonitor<GDBThreadData> rm =
|
||||
new DataRequestMonitor<GDBThreadData>(fSession.getExecutor(), null) {
|
||||
final String THREAD_ID = "1";
|
||||
final DataRequestMonitor<IThreadDMData> rm =
|
||||
new DataRequestMonitor<IThreadDMData>(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
if (isSuccess()) {
|
||||
|
@ -153,29 +154,26 @@ public class GDBProcessesTest extends BaseTestCase {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* Create an execution DMC then getModelData for Execution DMC
|
||||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
fProcService.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fExecDmc = fRunCtrl.createMIExecutionContext(fGdbCtrl.getGDBDMContext(), 1);
|
||||
|
||||
fRunCtrl.getThreadData(fExecDmc, rm);
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGdbCtrl.getGDBDMContext(), "");
|
||||
IThreadDMContext threadDmc = fProcService.createThreadContext(procDmc, THREAD_ID);
|
||||
fProcService.getExecutionData(threadDmc, rm);
|
||||
}
|
||||
});
|
||||
fWait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
assertTrue(fWait.getMessage(), fWait.isOK());
|
||||
|
||||
GDBThreadData threadData = rm.getData();
|
||||
IThreadDMData threadData = (IThreadDMData)fWait.getReturnInfo();
|
||||
if(threadData == null)
|
||||
fail("Thread data not returned for thread id = " + fExecDmc.getThreadId());
|
||||
fail("Thread data not returned for thread id = " + THREAD_ID);
|
||||
else{
|
||||
// Thread id is only a series of numbers
|
||||
Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); //$NON-NLS-1$
|
||||
Matcher matcher = pattern.matcher(threadData.getId());
|
||||
assertTrue("Thread ID is a series of number", matcher.find());
|
||||
// Name is blank in case of GDB back end
|
||||
assertEquals("Thread name is blank for GDB Back end", "", threadData.getName());
|
||||
assertEquals("Thread name is should have been blank for GDB Back end", "", threadData.getName());
|
||||
}
|
||||
fWait.waitReset();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMData;
|
||||
import org.eclipse.dd.dsf.debug.service.IRunControl.IResumedDMEvent;
|
||||
|
@ -24,6 +26,7 @@ import org.eclipse.dd.dsf.debug.service.IRunControl.StepType;
|
|||
import org.eclipse.dd.dsf.service.DsfServicesTracker;
|
||||
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
|
||||
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.dd.mi.service.IMIProcesses;
|
||||
import org.eclipse.dd.mi.service.MIRunControl;
|
||||
import org.eclipse.dd.mi.service.command.events.MIStoppedEvent;
|
||||
import org.eclipse.dd.mi.service.command.output.MIInfo;
|
||||
|
@ -49,6 +52,7 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
|
||||
private GDBControl fGDBCtrl;
|
||||
private MIRunControl fRunCtrl;
|
||||
private IMIProcesses fProcService;
|
||||
|
||||
/*
|
||||
* Path to executable
|
||||
|
@ -67,8 +71,10 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
getGDBLaunch().getSession().getId());
|
||||
fGDBCtrl = fServicesTracker.getService(GDBControl.class);
|
||||
fRunCtrl = fServicesTracker.getService(MIRunControl.class);
|
||||
fProcService = fServicesTracker.getService(IMIProcesses.class);
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
fServicesTracker.dispose();
|
||||
|
@ -105,7 +111,9 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionContexts(fGDBCtrl.getGDBDMContext(), rm);
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getGDBDMContext(), "");
|
||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, "");
|
||||
fRunCtrl.getExecutionContexts(groupDmc, rm);
|
||||
}
|
||||
});
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
|
@ -114,7 +122,7 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
/*
|
||||
* Get data from the Request Monitor
|
||||
*/
|
||||
IRunControl.IExecutionDMContext[] ctxts = rm.getData();
|
||||
IExecutionDMContext[] ctxts = (IExecutionDMContext[])wait.getReturnInfo();
|
||||
|
||||
// Context can not be null
|
||||
if(ctxts == null)
|
||||
|
@ -187,7 +195,10 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionContexts(fGDBCtrl.getGDBDMContext(), rmExecutionCtxts);
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getGDBDMContext(), "");
|
||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, "");
|
||||
|
||||
fRunCtrl.getExecutionContexts(groupDmc, rmExecutionCtxts);
|
||||
}
|
||||
});
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
|
@ -196,7 +207,7 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
/*
|
||||
* Get data
|
||||
*/
|
||||
IRunControl.IExecutionDMContext[] data = rmExecutionCtxts.getData();
|
||||
IExecutionDMContext[] data = rmExecutionCtxts.getData();
|
||||
/*
|
||||
* Contexts returned can not be null
|
||||
*/
|
||||
|
@ -236,7 +247,10 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionData(fRunCtrl.createMIExecutionContext(fGDBCtrl.getGDBDMContext(), 1), rm);
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getGDBDMContext(), "");
|
||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, "");
|
||||
|
||||
fRunCtrl.getExecutionData(fRunCtrl.createMIExecutionContext(groupDmc, 1), rm);
|
||||
}
|
||||
});
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
|
@ -417,7 +431,10 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
@Test
|
||||
public void cacheAfterContainerSuspendEvent() throws InterruptedException{
|
||||
|
||||
final IExecutionDMContext dmc = fRunCtrl.createMIExecutionContext(fGDBCtrl.getGDBDMContext(), 1);
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getGDBDMContext(), "");
|
||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, "");
|
||||
|
||||
final IExecutionDMContext dmc = fRunCtrl.createMIExecutionContext(groupDmc, 1);
|
||||
/*
|
||||
* Step to fire ContainerSuspendEvent
|
||||
*/
|
||||
|
@ -454,7 +471,10 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fRunCtrl.resume(fGDBCtrl.getGDBDMContext(), rm);
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getGDBDMContext(), "");
|
||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, "");
|
||||
|
||||
fRunCtrl.resume(groupDmc, rm);
|
||||
}
|
||||
});
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
|
@ -466,9 +486,22 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
if (wait.isOK() == false)
|
||||
Assert.assertTrue(wait.getMessage(), false);
|
||||
Assert.assertFalse("Target is suspended. It should have been running", fRunCtrl.isSuspended(fGDBCtrl.getGDBDMContext()));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
||||
wait.waitReset();
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getGDBDMContext(), "");
|
||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, "");
|
||||
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(groupDmc));
|
||||
wait.waitFinished();
|
||||
}
|
||||
});
|
||||
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
Assert.assertFalse("Target is suspended. It should have been running", (Boolean)wait.getReturnInfo());
|
||||
|
||||
wait.waitReset();
|
||||
}
|
||||
|
||||
|
@ -507,114 +540,22 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
return;
|
||||
}
|
||||
|
||||
if (wait.isOK() == false)
|
||||
Assert.assertTrue(wait.getMessage(), false);
|
||||
Assert.assertFalse("Target is suspended. It should have been running", fRunCtrl.isSuspended(fGDBCtrl.getGDBDMContext()));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
||||
wait.waitReset();
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getGDBDMContext(), "");
|
||||
IContainerDMContext groupDmc = fProcService.createExecutionGroupContext(procDmc, "");
|
||||
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(groupDmc));
|
||||
wait.waitFinished();
|
||||
}
|
||||
});
|
||||
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
Assert.assertFalse("Target is suspended. It should have been running", (Boolean)wait.getReturnInfo());
|
||||
|
||||
wait.waitReset();
|
||||
}
|
||||
|
||||
// PP: test no longer applies, the resume command now takes a strongly-typed execution context as an argument.
|
||||
//
|
||||
// @Test
|
||||
// public void resumeFrameContext() throws Throwable {
|
||||
// //TestsPlugin.debugMethod("resumeFrameContext()");
|
||||
// final DataRequestMonitor<DsfMIInfo> rm =
|
||||
// new DataRequestMonitor<DsfMIInfo>(fRunCtrl.getExecutor(), null) {
|
||||
// @Override
|
||||
// protected void handleCompleted() {
|
||||
// wait.waitFinished(getStatus());
|
||||
// }
|
||||
// };
|
||||
// final ServiceEventWaitor<IResumedDMEvent> eventWaitor =
|
||||
// new ServiceEventWaitor<IResumedDMEvent>(
|
||||
// getGDBLaunch().getSession(),
|
||||
// IResumedDMEvent.class);
|
||||
//
|
||||
// IExecutionDMContext execDmc = fRunCtrl.createMIExecutionContext(fGDBCtrl.getGDBDMContext(), 1);
|
||||
// final IFrameDMContext dmc = SyncUtil.SyncGetStackFrame(execDmc, 0);
|
||||
// fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
// public void run() {
|
||||
// fRunCtrl.resume(dmc, rm);
|
||||
// }
|
||||
// });
|
||||
// wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
//
|
||||
// try {
|
||||
// eventWaitor.waitForEvent(ServiceEventWaitor.WAIT_FOREVER);
|
||||
// } catch (Exception e) {
|
||||
// Assert.fail("Exception raised:: " + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (wait.isOK() == false)
|
||||
// Assert.assertTrue(wait.getMessage(), false);
|
||||
// Assert.assertFalse("Target is suspended. It should have been running", fRunCtrl.isSuspended(fGDBCtrl.getGDBDMContext()));
|
||||
// wait.waitReset();
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void resumeAndSuspend() throws InterruptedException{
|
||||
// final DataRequestMonitor<DsfMIInfo> rm =
|
||||
// new DataRequestMonitor<DsfMIInfo>(fRunCtrl.getExecutor(), null) {
|
||||
// @Override
|
||||
// protected void handleCompleted() {
|
||||
// if (isSuccess()) {
|
||||
// assert true;
|
||||
// wait.setReturnInfo(getData());
|
||||
// }
|
||||
// System.out.println("Wait Finished called on getTHreads rm with status " + getStatus().getMessage());
|
||||
// wait.waitFinished(getStatus());
|
||||
// }
|
||||
// };
|
||||
// final MIExecutionDMC dmc = new MIExecutionDMC(fRunCtrl, 1);
|
||||
// fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
// public void run() {
|
||||
// fRunCtrl.resume(dmc, rm);
|
||||
// }
|
||||
// });
|
||||
// wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
// if (wait.isOK() == false)
|
||||
// Assert.assertTrue(wait.getMessage(), false);
|
||||
// System.out.println("Message from isSuspended " +fRunCtrl.isSuspended(dmc));
|
||||
// Assert.assertFalse("Target is suspended. It should have been running", fRunCtrl.isSuspended(dmc));
|
||||
// wait.waitReset();
|
||||
//
|
||||
// final DataRequestMonitor<DsfMIInfo> rmSuspend =
|
||||
// new DataRequestMonitor<DsfMIInfo>(fRunCtrl.getExecutor(), null) {
|
||||
// @Override
|
||||
// protected void handleCompleted() {
|
||||
// if (isSuccess()) {
|
||||
// assert true;
|
||||
// wait.setReturnInfo(getData());
|
||||
// }
|
||||
// System.out.println("Wait Finished called on getTHreads rm with status " + getStatus().getMessage());
|
||||
// wait.waitFinished(getStatus());
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// final ServiceEventWaitor eventWaitor =
|
||||
// new ServiceEventWaitor(
|
||||
// getGDBLaunch().getSession(),
|
||||
// DsfMIStoppedEvent.class);
|
||||
//
|
||||
// fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
// public void run() {
|
||||
// fRunCtrl.suspend(dmc, rmSuspend);
|
||||
// }
|
||||
// });
|
||||
// wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
// try {
|
||||
// eventWaitor.waitForEvent(ServiceEventWaitor.WAIT_FOREVER);
|
||||
// } catch (Exception e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// if (wait.isOK() == false)
|
||||
// Assert.assertTrue(wait.getMessage(), false);
|
||||
// System.out.println("Message from isSuspended !!! " +fRunCtrl.isSuspended(dmc));
|
||||
// Assert.assertTrue("Target is running. It should have been suspended.", fRunCtrl.isSuspended(dmc));
|
||||
// wait.waitReset();
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ public class BaseTestCase {
|
|||
attrs.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
|
||||
attrs.put(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
|
||||
attrs.put(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
|
||||
attrs.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
|
||||
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -85,7 +85,7 @@ public class TestLaunchDelegate extends LaunchConfigurationDelegate
|
|||
launch.setServiceFactory(new GdbDebugServicesFactory(LaunchUtils.getGDBVersion(config)));
|
||||
|
||||
final ServicesLaunchSequence servicesLaunchSequence =
|
||||
new ServicesLaunchSequence(launch.getSession(), launch, exePath, SessionType.LOCAL, false);
|
||||
new ServicesLaunchSequence(launch.getSession(), launch);
|
||||
launch.getSession().getExecutor().execute(servicesLaunchSequence);
|
||||
try {
|
||||
servicesLaunchSequence.get();
|
||||
|
|
Loading…
Add table
Reference in a new issue