mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added methods signal()/jump()/stepReturn(boolean)
This commit is contained in:
parent
9fc080c259
commit
5af637019d
4 changed files with 202 additions and 46 deletions
|
@ -146,13 +146,21 @@ public interface ICDITarget extends ICDIObject {
|
||||||
void suspend() throws CDIException;
|
void suspend() throws CDIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps to the next return statement in the current scope. Can
|
* Equivalent to stepReturn(true)
|
||||||
* only be called when the associated thread is suspended.
|
|
||||||
*
|
|
||||||
* @throws CDIException if this method fails. Reasons include:
|
* @throws CDIException if this method fails. Reasons include:
|
||||||
*/
|
*/
|
||||||
void stepReturn() throws CDIException;
|
void stepReturn() throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If execute is true, continue running until just after function. if
|
||||||
|
* If execute is false, cancel execution of the function and stop the
|
||||||
|
* program after the function.
|
||||||
|
* Can only be called when the associated target is suspended.
|
||||||
|
*
|
||||||
|
* @throws CDIException if this method fails. Reasons include:
|
||||||
|
*/
|
||||||
|
void stepReturn(boolean execute) throws CDIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps over the current source line. Can only be called
|
* Steps over the current source line. Can only be called
|
||||||
* when the associated target is suspended.
|
* when the associated target is suspended.
|
||||||
|
@ -185,15 +193,6 @@ public interface ICDITarget extends ICDIObject {
|
||||||
*/
|
*/
|
||||||
void stepIntoInstruction() throws CDIException;
|
void stepIntoInstruction() throws CDIException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Continues running until just after function in the current
|
|
||||||
* stack frame returns. Can only be called when the associated
|
|
||||||
* target is suspended.
|
|
||||||
*
|
|
||||||
* @throws CDIException if this method fails. Reasons include:
|
|
||||||
*/
|
|
||||||
void finish() throws CDIException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Continues running until location is reached. Can only be called when the associated
|
* Continues running until location is reached. Can only be called when the associated
|
||||||
* target is suspended.
|
* target is suspended.
|
||||||
|
@ -202,6 +201,30 @@ public interface ICDITarget extends ICDIObject {
|
||||||
*/
|
*/
|
||||||
void runUntil(ICDILocation location) throws CDIException;
|
void runUntil(ICDILocation location) throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resume execution at location. Note the jump() does not change stackframe.
|
||||||
|
* The result is undefined if jump outside of the stacframe i.e function.
|
||||||
|
* Can only be called when the associated target is suspended.
|
||||||
|
*
|
||||||
|
* @throws CDIException if this method fails. Reasons include:
|
||||||
|
*/
|
||||||
|
void jump(ICDILocation location) throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method signal, resume execution without giving a signal.
|
||||||
|
* @throws CDIException
|
||||||
|
*/
|
||||||
|
void signal() throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resume execution where the program stopped but immediately give the
|
||||||
|
* signal.
|
||||||
|
*
|
||||||
|
* @param signal
|
||||||
|
* @throws CDIException
|
||||||
|
*/
|
||||||
|
void signal(ICDISignal signal) throws CDIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the currently selected thread.
|
* Returns the currently selected thread.
|
||||||
*
|
*
|
||||||
|
|
|
@ -91,13 +91,21 @@ public interface ICDIThread extends ICDIObject {
|
||||||
void suspend() throws CDIException;
|
void suspend() throws CDIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps to the next return statement in the current scope. Can
|
* Equivalent to stepReturn(true)
|
||||||
* only be called when the associated thread is suspended.
|
|
||||||
*
|
|
||||||
* @throws CDIException if this method fails. Reasons include:
|
* @throws CDIException if this method fails. Reasons include:
|
||||||
*/
|
*/
|
||||||
void stepReturn() throws CDIException;
|
void stepReturn() throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If execute is true, continue running until just after function. if
|
||||||
|
* If execute is false, cancel execution of the function and stop the
|
||||||
|
* program after the function.
|
||||||
|
* Can only be called when the associated target is suspended.
|
||||||
|
*
|
||||||
|
* @throws CDIException if this method fails. Reasons include:
|
||||||
|
*/
|
||||||
|
void stepReturn(boolean execute) throws CDIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Steps over the current source line. Can only be called
|
* Steps over the current source line. Can only be called
|
||||||
* when the associated thread is suspended.
|
* when the associated thread is suspended.
|
||||||
|
@ -139,13 +147,28 @@ public interface ICDIThread extends ICDIObject {
|
||||||
void runUntil(ICDILocation location) throws CDIException;
|
void runUntil(ICDILocation location) throws CDIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Continues running until just after function in the current
|
* Resume execution at location. Note the jump() does not change stackframe.
|
||||||
* stack frame returns. Can only be called when the associated
|
* The result is undefined if jump outside of the stacframe i.e function.
|
||||||
* thread is suspended.
|
* Can only be called when the associated target is suspended.
|
||||||
*
|
*
|
||||||
* @throws CDIException if this method fails. Reasons include:
|
* @throws CDIException if this method fails. Reasons include:
|
||||||
*/
|
*/
|
||||||
void finish() throws CDIException;
|
void jump(ICDILocation location) throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method signal, resume execution without giving a signal.
|
||||||
|
* @throws CDIException
|
||||||
|
*/
|
||||||
|
void signal() throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resume execution where the program stopped but immediately give the
|
||||||
|
* signal.
|
||||||
|
*
|
||||||
|
* @param signal
|
||||||
|
* @throws CDIException
|
||||||
|
*/
|
||||||
|
void signal(ICDISignal signal) throws CDIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the threads are the same.
|
* Returns true if the threads are the same.
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||||
|
@ -28,11 +29,14 @@ import org.eclipse.cdt.debug.mi.core.command.MIExecContinue;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecFinish;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecFinish;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecNext;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecNext;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecNextInstruction;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIExecReturn;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecRun;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecRun;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecStep;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecStep;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIExecUntil;
|
import org.eclipse.cdt.debug.mi.core.command.MIExecUntil;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIInfoThreads;
|
import org.eclipse.cdt.debug.mi.core.command.MIInfoThreads;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MIJump;
|
||||||
|
import org.eclipse.cdt.debug.mi.core.command.MISignal;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MITargetDetach;
|
import org.eclipse.cdt.debug.mi.core.command.MITargetDetach;
|
||||||
import org.eclipse.cdt.debug.mi.core.command.MIThreadSelect;
|
import org.eclipse.cdt.debug.mi.core.command.MIThreadSelect;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent;
|
||||||
|
@ -420,6 +424,23 @@ public class Target implements ICDITarget {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn()
|
||||||
*/
|
*/
|
||||||
public void stepReturn() throws CDIException {
|
public void stepReturn() throws CDIException {
|
||||||
|
stepReturn(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn(boolean)
|
||||||
|
*/
|
||||||
|
public void stepReturn(boolean execute) throws CDIException {
|
||||||
|
if (execute) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
execReturn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
protected void finish() throws CDIException {
|
||||||
MISession mi = session.getMISession();
|
MISession mi = session.getMISession();
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
MIExecFinish finish = factory.createMIExecFinish();
|
MIExecFinish finish = factory.createMIExecFinish();
|
||||||
|
@ -435,6 +456,24 @@ public class Target implements ICDITarget {
|
||||||
lastExecutionToken = finish.getToken();
|
lastExecutionToken = finish.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
protected void execReturn() throws CDIException {
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIExecReturn ret = factory.createMIExecReturn();
|
||||||
|
try {
|
||||||
|
mi.postCommand(ret);
|
||||||
|
MIInfo info = ret.getMIInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
}
|
||||||
|
lastExecutionToken = ret.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#suspend()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#suspend()
|
||||||
*/
|
*/
|
||||||
|
@ -471,25 +510,6 @@ public class Target implements ICDITarget {
|
||||||
session.getMISession().getMIInferior().setDisconnected();
|
session.getMISession().getMIInferior().setDisconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#finish()
|
|
||||||
*/
|
|
||||||
public void finish() throws CDIException {
|
|
||||||
MISession mi = session.getMISession();
|
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
|
||||||
MIExecFinish finish = factory.createMIExecFinish();
|
|
||||||
try {
|
|
||||||
mi.postCommand(finish);
|
|
||||||
MIInfo info = finish.getMIInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException("No answer");
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
throw new MI2CDIException(e);
|
|
||||||
}
|
|
||||||
lastExecutionToken = finish.getToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation)
|
||||||
*/
|
*/
|
||||||
|
@ -518,6 +538,33 @@ public class Target implements ICDITarget {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#jump(ICDILocation)
|
||||||
|
*/
|
||||||
|
public void jump(ICDILocation location) throws CDIException {
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
String loc = "";
|
||||||
|
if (location.getFile() != null && location.getFile().length() > 0) {
|
||||||
|
loc = location.getFile() + ":" + location.getLineNumber();
|
||||||
|
} else if (location.getFunction() != null && location.getFunction().length() > 0) {
|
||||||
|
loc = location.getFunction();
|
||||||
|
} else if (location.getAddress() != 0) {
|
||||||
|
loc = "*" + location.getAddress();
|
||||||
|
}
|
||||||
|
MIJump jump = factory.createMIJump(loc);
|
||||||
|
try {
|
||||||
|
mi.postCommand(jump);
|
||||||
|
MIInfo info = jump.getMIInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
}
|
||||||
|
lastExecutionToken = jump.getToken();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpressionToString(String)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpressionToString(String)
|
||||||
*/
|
*/
|
||||||
|
@ -608,4 +655,42 @@ public class Target implements ICDITarget {
|
||||||
return session.getMISession().getMIInferior();
|
return session.getMISession().getMIInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal()
|
||||||
|
*/
|
||||||
|
public void signal() throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MISignal signal = factory.createMISignal("0");
|
||||||
|
try {
|
||||||
|
mi.postCommand(signal);
|
||||||
|
MIInfo info = signal.getMIInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal(ICDISignal)
|
||||||
|
*/
|
||||||
|
public void signal(ICDISignal signal) throws CDIException {
|
||||||
|
Session session = (Session)getSession();
|
||||||
|
MISession mi = session.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MISignal sig = factory.createMISignal(signal.getName());
|
||||||
|
try {
|
||||||
|
mi.postCommand(sig);
|
||||||
|
MIInfo info = sig.getMIInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException("No answer");
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||||
|
@ -230,14 +231,6 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
return getTarget().isSuspended();
|
return getTarget().isSuspended();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish()
|
|
||||||
*/
|
|
||||||
public void finish() throws CDIException {
|
|
||||||
getTarget().setCurrentThread(this);
|
|
||||||
getTarget().finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume()
|
||||||
*/
|
*/
|
||||||
|
@ -286,6 +279,14 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
getTarget().stepReturn();
|
getTarget().stepReturn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn(boolean)
|
||||||
|
*/
|
||||||
|
public void stepReturn(boolean execute) throws CDIException {
|
||||||
|
getTarget().setCurrentThread(this);
|
||||||
|
getTarget().stepReturn(execute);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation)
|
||||||
*/
|
*/
|
||||||
|
@ -302,6 +303,30 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
getTarget().suspend();
|
getTarget().suspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#jump(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
||||||
|
*/
|
||||||
|
public void jump(ICDILocation location) throws CDIException {
|
||||||
|
getTarget().setCurrentThread(this);
|
||||||
|
getTarget().jump(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#signal()
|
||||||
|
*/
|
||||||
|
public void signal() throws CDIException {
|
||||||
|
getTarget().setCurrentThread(this);
|
||||||
|
getTarget().signal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#signal(org.eclipse.cdt.debug.core.cdi.model.ICDISignal)
|
||||||
|
*/
|
||||||
|
public void signal(ICDISignal signal) throws CDIException {
|
||||||
|
getTarget().setCurrentThread(this);
|
||||||
|
getTarget().signal(signal);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#equals(ICDIThread)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#equals(ICDIThread)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue