mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[302324] Make RunToLine work for DSF Disassembly view
This commit is contained in:
parent
eec11c475f
commit
a381ee1d47
10 changed files with 288 additions and 68 deletions
|
@ -167,6 +167,13 @@
|
|||
adaptableType="org.eclipse.cdt.dsf.ui.viewmodel.IVMContext">
|
||||
<adapter type="org.eclipse.debug.core.model.ISuspendResume"/>
|
||||
</factory>
|
||||
<factory
|
||||
class="org.eclipse.cdt.dsf.gdb.internal.ui.actions.RetargettableActionAdapterFactory"
|
||||
adaptableType="org.eclipse.cdt.dsf.debug.internal.ui.disassembly.DisassemblyView">
|
||||
<adapter type="org.eclipse.debug.ui.actions.IRunToLineTarget"/>
|
||||
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget"/>
|
||||
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget"/>
|
||||
</factory>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.debug.ui.memoryRenderings">
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010 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.cdt.dsf.gdb.internal.ui.actions;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.model.IRunToAddress;
|
||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
|
||||
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
|
||||
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
|
||||
import org.eclipse.cdt.utils.Addr64;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.ISuspendResume;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||
import org.eclipse.debug.ui.actions.IRunToLineTarget;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
/**
|
||||
* Run to line target adapter for the DSF Disassembly view
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IRunToLineTarget#runToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection, org.eclipse.debug.core.model.ISuspendResume)
|
||||
*/
|
||||
public void runToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
|
||||
if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
|
||||
if (!(selection instanceof IDisassemblySelection)) {
|
||||
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
|
||||
}
|
||||
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
|
||||
BigInteger rawAddress = disassemblySelection.getStartAddress();
|
||||
if (rawAddress == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IAddress address = new Addr64(rawAddress);
|
||||
if (address != null && target instanceof IAdaptable) {
|
||||
final IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class);
|
||||
if (runToAddress != null && runToAddress.canRunToAddress(address)) {
|
||||
// Runnable r = new Runnable() {
|
||||
// public void run() {
|
||||
try {
|
||||
boolean skipBreakpoints = DebugUITools.getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE);
|
||||
runToAddress.runToAddress(address, skipBreakpoints);
|
||||
}
|
||||
catch( DebugException e ) {
|
||||
failed( e );
|
||||
}
|
||||
// }
|
||||
// };
|
||||
// DebugPlugin.getDefault().asyncExec(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.debug.ui.actions.IRunToLineTarget#canRunToLine(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection, org.eclipse.debug.core.model.ISuspendResume)
|
||||
*/
|
||||
public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
|
||||
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
|
||||
IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter(IRunToAddress.class);
|
||||
if (runToAddress == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(selection instanceof IDisassemblySelection)) {
|
||||
selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
|
||||
}
|
||||
IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
|
||||
BigInteger rawAddress = disassemblySelection.getStartAddress();
|
||||
if (rawAddress == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final IAddress address = new Addr64(rawAddress);
|
||||
return runToAddress.canRunToAddress(address);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void failed( Throwable e ) {
|
||||
MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "RunToLine failed", null ); //$NON-NLS-1$
|
||||
ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e ) );
|
||||
GdbUIPlugin.log(ms);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Wind River Systems and others.
|
||||
* Copyright (c) 2009, 2010 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,12 +7,15 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* Ericsson - Added support for IRunToAddress for DSF DisassemblyView (302324)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.gdb.internal.ui.actions;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
import org.eclipse.cdt.debug.core.model.IRunToAddress;
|
||||
import org.eclipse.cdt.debug.core.model.IRunToLine;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||
|
@ -37,7 +40,7 @@ import org.eclipse.debug.ui.actions.IRunToLineTarget;
|
|||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public class GdbRunToLine implements IRunToLine {
|
||||
public class GdbRunToLine implements IRunToLine, IRunToAddress {
|
||||
|
||||
private final IExecutionDMContext fContext;
|
||||
|
||||
|
@ -46,14 +49,32 @@ public class GdbRunToLine implements IRunToLine {
|
|||
}
|
||||
|
||||
public boolean canRunToLine(IFile file, int lineNumber) {
|
||||
return canRunToLine();
|
||||
return canRunToLocation();
|
||||
}
|
||||
|
||||
public boolean canRunToLine(String fileName, int lineNumber) {
|
||||
return canRunToLine();
|
||||
return canRunToLocation();
|
||||
}
|
||||
|
||||
private boolean canRunToLine() {
|
||||
public void runToLine(IFile file, int lineNumber, boolean skipBreakpoints) throws DebugException {
|
||||
runToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber, skipBreakpoints);
|
||||
}
|
||||
|
||||
public void runToLine(String fileName, int lineNumber, boolean skipBreakpoints) throws DebugException {
|
||||
runToLocation(fileName + ":" + lineNumber, skipBreakpoints); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/** @since 2.1 */
|
||||
public boolean canRunToAddress(IAddress address) {
|
||||
return canRunToLocation();
|
||||
}
|
||||
|
||||
/** @since 2.1 */
|
||||
public void runToAddress(IAddress address, boolean skipBreakpoints) throws DebugException {
|
||||
runToLocation("*0x" + address.toString(16), skipBreakpoints); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private boolean canRunToLocation() {
|
||||
DsfSession session = DsfSession.getSession(fContext.getSessionId());
|
||||
if (session != null && session.isActive()) {
|
||||
try {
|
||||
|
@ -83,11 +104,7 @@ public class GdbRunToLine implements IRunToLine {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void runToLine(IFile file, int lineNumber, boolean skipBreakpoints) throws DebugException {
|
||||
runToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber, skipBreakpoints);
|
||||
}
|
||||
|
||||
public void runToLine(final String fileName, final int lineNumber, final boolean skipBreakpoints) throws DebugException {
|
||||
private void runToLocation(final String location, final boolean skipBreakpoints) throws DebugException {
|
||||
DsfSession session = DsfSession.getSession(fContext.getSessionId());
|
||||
if (session != null && session.isActive()) {
|
||||
Throwable exception = null;
|
||||
|
@ -100,15 +117,9 @@ public class GdbRunToLine implements IRunToLine {
|
|||
|
||||
IMIRunControl miRunControl = tracker.getService(IMIRunControl.class);
|
||||
if (miRunControl != null) {
|
||||
miRunControl.runToLine(
|
||||
fContext, fileName, Integer.toString(lineNumber), skipBreakpoints,
|
||||
new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
rm.setData(new Object());
|
||||
rm.done();
|
||||
};
|
||||
});
|
||||
miRunControl.runToLocation(
|
||||
fContext, location, skipBreakpoints,
|
||||
new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm));
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "MIRunControl service not available", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2010 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.cdt.dsf.gdb.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.debug.ui.actions.IRunToLineTarget;
|
||||
|
||||
/**
|
||||
* Retargettable Action Adapter Factory for the DSF Disassembly view
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class RetargettableActionAdapterFactory implements IAdapterFactory {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||
*/
|
||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||
if (adapterType == IRunToLineTarget.class) {
|
||||
return new DisassemblyRunToLineAdapter();
|
||||
}
|
||||
// if (adapterType == IResumeAtLineTarget.class) {
|
||||
// return new DisassemblyResumeAtLineAdapter();
|
||||
// }
|
||||
// if (adapterType == IMoveToLineTarget.class) {
|
||||
// return new DisassemblyMoveToLineAdapter();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
||||
*/
|
||||
public Class[] getAdapterList() {
|
||||
return new Class[]{ IRunToLineTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class };
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -257,11 +257,9 @@ public class GDBRunControl extends MIRunControl {
|
|||
canResume(context, rm);
|
||||
}
|
||||
|
||||
/** @since 2.0 */
|
||||
/** @since 3.0 */
|
||||
@Override
|
||||
public void runToLine(final IExecutionDMContext context, String fileName, String lineNo, final boolean skipBreakpoints, final DataRequestMonitor<MIInfo> rm){
|
||||
// Later add support for Address and function.
|
||||
|
||||
public void runToLocation(IExecutionDMContext context, final String location, final boolean skipBreakpoints, final RequestMonitor rm){
|
||||
assert context != null;
|
||||
|
||||
final IMIExecutionDMContext dmc = DMContexts.getAncestorOfType(context, IMIExecutionDMContext.class);
|
||||
|
@ -271,12 +269,11 @@ public class GDBRunControl extends MIRunControl {
|
|||
return;
|
||||
}
|
||||
|
||||
if (doCanResume(context)) {
|
||||
final String fileLocation = fileName + ":" + lineNo; //$NON-NLS-1$
|
||||
if (doCanResume(dmc)) {
|
||||
IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
|
||||
getConnection().queueCommand(
|
||||
new MIBreakInsert(bpDmc, true, false, null, 0,
|
||||
fileLocation, dmc.getThreadId()),
|
||||
location, dmc.getThreadId()),
|
||||
new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
|
@ -284,9 +281,9 @@ public class GDBRunControl extends MIRunControl {
|
|||
// or else we may get the stopped event, before we have set this variable.
|
||||
int bpId = getData().getMIBreakpoints()[0].getNumber();
|
||||
String addr = getData().getMIBreakpoints()[0].getAddress();
|
||||
fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, fileLocation, addr, skipBreakpoints);
|
||||
fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr, skipBreakpoints);
|
||||
|
||||
resume(context, new RequestMonitor(getExecutor(), rm) {
|
||||
resume(dmc, new RequestMonitor(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleFailure() {
|
||||
IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2008, 2010 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
|
||||
|
@ -435,10 +435,9 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
|
|||
});
|
||||
}
|
||||
|
||||
/** @since 2.0 */
|
||||
/** @since 3.0 */
|
||||
@Override
|
||||
public void runToLine(final IExecutionDMContext context, String fileName, String lineNo, final boolean skipBreakpoints, final DataRequestMonitor<MIInfo> rm){
|
||||
// Later add support for Address and function.
|
||||
public void runToLocation(final IExecutionDMContext context, final String location, final boolean skipBreakpoints, final RequestMonitor rm){
|
||||
|
||||
assert context != null;
|
||||
|
||||
|
@ -449,12 +448,11 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
|
|||
return;
|
||||
}
|
||||
|
||||
if (doCanResume(context)) {
|
||||
final String fileLocation = fileName + ":" + lineNo; //$NON-NLS-1$
|
||||
if (doCanResume(dmc)) {
|
||||
IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
|
||||
getConnection().queueCommand(
|
||||
new MIBreakInsert(bpDmc, true, false, null, 0,
|
||||
fileLocation, dmc.getThreadId()),
|
||||
location, dmc.getThreadId()),
|
||||
new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
|
@ -462,9 +460,9 @@ public class GDBRunControl_7_0 extends MIRunControl implements IReverseRunContro
|
|||
// or else we may get the stopped event, before we have set this variable.
|
||||
int bpId = getData().getMIBreakpoints()[0].getNumber();
|
||||
String addr = getData().getMIBreakpoints()[0].getAddress();
|
||||
fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, fileLocation, addr, skipBreakpoints);
|
||||
fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr, skipBreakpoints);
|
||||
|
||||
resume(context, new RequestMonitor(getExecutor(), rm) {
|
||||
resume(dmc, new RequestMonitor(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleFailure() {
|
||||
IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(fRunToLineActiveOperation.getThreadContext(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -608,7 +608,8 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
|||
// Run to line
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
public void runToLine(IExecutionDMContext context, String fileName, String lineNo, final boolean skipBreakpoints, final DataRequestMonitor<MIInfo> rm) {
|
||||
/** @since 3.0 */
|
||||
public void runToLocation(final IExecutionDMContext context, final String location, final boolean skipBreakpoints, final RequestMonitor rm){
|
||||
|
||||
assert context != null;
|
||||
|
||||
|
@ -620,26 +621,25 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
|||
return;
|
||||
}
|
||||
|
||||
if (!doCanResume(context)) {
|
||||
if (!doCanResume(dmc)) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
|
||||
"Cannot resume context", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
MIThreadRunState threadState = fThreadRunStates.get(context);
|
||||
MIThreadRunState threadState = fThreadRunStates.get(dmc);
|
||||
if (threadState == null) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE,
|
||||
"Given context: " + context + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"Given context: " + dmc + " is not an MI execution context.", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
final String fileLocation = fileName + ":" + lineNo; //$NON-NLS-1$
|
||||
IBreakpointsTargetDMContext bpDmc = DMContexts.getAncestorOfType(context, IBreakpointsTargetDMContext.class);
|
||||
fConnection.queueCommand(
|
||||
new MIBreakInsert(bpDmc, true, false, null, 0,
|
||||
fileLocation, dmc.getThreadId()),
|
||||
location, dmc.getThreadId()),
|
||||
new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
|
@ -647,7 +647,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService implements IMIRunCo
|
|||
// or else we may get the stopped event, before we have set this variable.
|
||||
int bpId = getData().getMIBreakpoints()[0].getNumber();
|
||||
String addr = getData().getMIBreakpoints()[0].getAddress();
|
||||
fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, fileLocation, addr, skipBreakpoints);
|
||||
fRunToLineActiveOperation = new RunToLineActiveOperation(dmc, bpId, location, addr, skipBreakpoints);
|
||||
|
||||
resume(dmc, new RequestMonitor(getExecutor(), rm) {
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009 Ericsson and others.
|
||||
* Copyright (c) 2009, 2010 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
|
||||
|
@ -10,9 +10,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.mi.service;
|
||||
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
|
||||
/**
|
||||
* This interface provides methods for RunControl that are not
|
||||
|
@ -27,8 +26,9 @@ public interface IMIRunControl extends IRunControl
|
|||
* If skipBreakpoints is false, any other breakpoint will stop this
|
||||
* command; while if skipBreakpoints is true, the operation will ignore
|
||||
* other breakpoints and continue until the specified location.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
void runToLine(IExecutionDMContext context, String fileName, String lineNo,
|
||||
boolean skipBreakpoints, DataRequestMonitor<MIInfo> rm);
|
||||
void runToLocation(IExecutionDMContext context, String location, boolean skipBreakpoints, RequestMonitor rm);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2010 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
|
||||
|
@ -680,12 +680,9 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
|
|||
}
|
||||
rm.done();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run selected execution thread to a given line number.
|
||||
*/
|
||||
public void runToLine(IExecutionDMContext context, String fileName, String lineNo, boolean skipBreakpoints, final DataRequestMonitor<MIInfo> rm){
|
||||
// Later add support for Address and function.
|
||||
|
||||
/** @since 3.0 */
|
||||
public void runToLocation(IExecutionDMContext context, String location, boolean skipBreakpoints, final RequestMonitor rm){
|
||||
// skipBreakpoints is not used at the moment. Implement later
|
||||
|
||||
assert context != null;
|
||||
|
@ -697,10 +694,10 @@ public class MIRunControl extends AbstractDsfService implements IMIRunControl, I
|
|||
return;
|
||||
}
|
||||
|
||||
if (doCanResume(context)) {
|
||||
if (doCanResume(dmc)) {
|
||||
fResumePending = true;
|
||||
fMICommandCache.setContextAvailable(context, false);
|
||||
fConnection.queueCommand(new MIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$
|
||||
fMICommandCache.setContextAvailable(dmc, false);
|
||||
fConnection.queueCommand(new MIExecUntil(dmc, location),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, NOT_SUPPORTED,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Ericsson and others.
|
||||
* Copyright (c) 2007, 2010 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
|
||||
|
@ -13,18 +13,22 @@ package org.eclipse.cdt.tests.dsf.gdb.tests;
|
|||
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl;
|
||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMData;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IResumedDMEvent;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IStartedDMEvent;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
|
||||
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIRunControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
||||
|
@ -55,10 +59,11 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
private DsfServicesTracker fServicesTracker;
|
||||
|
||||
private IGDBControl fGDBCtrl;
|
||||
private MIRunControl fRunCtrl;
|
||||
private IMIRunControl fRunCtrl;
|
||||
private IMIProcesses fProcService;
|
||||
|
||||
private IContainerDMContext fContainerDmc;
|
||||
private IExecutionDMContext fThreadExecDmc;
|
||||
|
||||
/*
|
||||
* Path to executable
|
||||
|
@ -80,8 +85,10 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
|
||||
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
|
||||
fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
|
||||
|
||||
fRunCtrl = fServicesTracker.getService(MIRunControl.class);
|
||||
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
|
||||
fProcService = fServicesTracker.getService(IMIProcesses.class);
|
||||
}
|
||||
|
||||
|
@ -263,7 +270,7 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||
IContainerDMContext containerDmc = fProcService.createContainerContext(procDmc, pid);
|
||||
fRunCtrl.getExecutionData(fRunCtrl.createMIExecutionContext(containerDmc, 1), rm);
|
||||
fRunCtrl.getExecutionData(((MIRunControl)fRunCtrl).createMIExecutionContext(containerDmc, 1), rm);
|
||||
}
|
||||
});
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
|
@ -518,9 +525,6 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
|
||||
wait.waitReset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void resumeContainerContext() throws InterruptedException{
|
||||
|
@ -573,4 +577,51 @@ public class MIRunControlTest extends BaseTestCase {
|
|||
|
||||
wait.waitReset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runToLine() throws InterruptedException{
|
||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
fRunCtrl.runToLocation(fThreadExecDmc, SOURCE_NAME + ":27", true,
|
||||
new RequestMonitor(fRunCtrl.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
wait.waitReset();
|
||||
|
||||
try {
|
||||
new ServiceEventWaitor<ISuspendedDMEvent>(
|
||||
getGDBLaunch().getSession(),
|
||||
ISuspendedDMEvent.class).waitForEvent(ServiceEventWaitor.WAIT_FOREVER);
|
||||
} catch (Exception e) {
|
||||
Assert.fail("Exception raised:: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
public void run() {
|
||||
String pid = MIProcesses.UNIQUE_GROUP_ID;
|
||||
IProcessDMContext procDmc = fProcService.createProcessContext(fGDBCtrl.getContext(), pid);
|
||||
IContainerDMContext containerDmc = fProcService.createContainerContext(procDmc, pid);
|
||||
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
}
|
||||
});
|
||||
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
Assert.assertTrue("Target is running. It should have been suspended", (Boolean)wait.getReturnInfo());
|
||||
|
||||
wait.waitReset();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue