From d20c71ba18b6e49380f7e3e4a109743dda3572b9 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Fri, 10 Sep 2004 00:39:17 +0000 Subject: [PATCH] 2004-09-09 Alain Magloire Introduction of new classes in the CDI interface ICDIExecuteStep ICDIExecuteStepReturn ICDIExecuteResume ICDISuspend ICDIThreadGroup The code is adjust to the new demands. --- debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 9 + .../cdt/debug/mi/core/cdi/EventManager.java | 8 +- .../cdt/debug/mi/core/cdi/model/CObject.java | 2 +- .../cdt/debug/mi/core/cdi/model/Signal.java | 2 +- .../debug/mi/core/cdi/model/StackFrame.java | 70 +++++ .../cdt/debug/mi/core/cdi/model/Target.java | 263 +++++++++--------- .../cdt/debug/mi/core/cdi/model/Thread.java | 192 ++++++++----- .../debug/mi/core/command/CommandFactory.java | 25 +- .../cdt/debug/mi/core/command/MIExecNext.java | 4 + .../core/command/MIExecNextInstruction.java | 4 + .../debug/mi/core/command/MIExecReturn.java | 7 +- .../cdt/debug/mi/core/command/MIExecStep.java | 4 + .../core/command/MIExecStepInstruction.java | 4 + 13 files changed, 372 insertions(+), 222 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index c5f34925a25..d15fac5fde8 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,12 @@ +2004-09-09 Alain Magloire + Introduction of new classes in the CDI interface + ICDIExecuteStep + ICDIExecuteStepReturn + ICDIExecuteResume + ICDISuspend + ICDIThreadGroup + The code is adjust to the new demands. + 2004-09-07 Alain Magloire Remove ICDIBreakpointManager class diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java index 143c03f982c..1859d4c19cc 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java @@ -386,16 +386,16 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs if (lastUserCommand == null) { switch (type) { case MIRunningEvent.NEXT: - lastUserCommand = factory.createMIExecNext(); + lastUserCommand = factory.createMIExecNext(1); break; case MIRunningEvent.NEXTI: - lastUserCommand = factory.createMIExecNextInstruction(); + lastUserCommand = factory.createMIExecNextInstruction(1); break; case MIRunningEvent.STEP: - lastUserCommand = factory.createMIExecStep(); + lastUserCommand = factory.createMIExecStep(1); break; case MIRunningEvent.STEPI: - lastUserCommand = factory.createMIExecStepInstruction(); + lastUserCommand = factory.createMIExecStepInstruction(1); break; case MIRunningEvent.FINISH: lastUserCommand = factory.createMIExecFinish(); diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CObject.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CObject.java index 21f29c4691d..1e62d466d96 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CObject.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/CObject.java @@ -17,7 +17,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; */ public class CObject implements ICDIObject { - private Target fTarget; + protected Target fTarget; public CObject(Target t) { fTarget = t; diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java index d30b8ce169b..e51c0d18d27 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Signal.java @@ -74,6 +74,6 @@ public class Signal extends CObject implements ICDISignal { * Continue program giving it signal specified by the argument. */ public void signal() throws CDIException { - getTarget().signal(this); + getTarget().resume(this); } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java index 415779c9fe3..3e27456dc3c 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java @@ -16,12 +16,21 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; +import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; +import org.eclipse.cdt.debug.mi.core.MIException; +import org.eclipse.cdt.debug.mi.core.MISession; +import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; +import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.Location; import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; +import org.eclipse.cdt.debug.mi.core.command.CommandFactory; +import org.eclipse.cdt.debug.mi.core.command.MIExecFinish; +import org.eclipse.cdt.debug.mi.core.command.MIExecReturn; import org.eclipse.cdt.debug.mi.core.output.MIFrame; +import org.eclipse.cdt.debug.mi.core.output.MIInfo; /** */ @@ -148,4 +157,65 @@ public class StackFrame extends CObject implements ICDIStackFrame { return super.equals(stackframe); } + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStepReturn#stepReturn() + */ + public void stepReturn() throws CDIException { + finish(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStepReturn#stepReturn(org.eclipse.cdt.debug.core.cdi.model.ICDIValue) + */ + public void stepReturn(ICDIValue value) throws CDIException { + execReturn(value.toString()); + } + + /** + */ + protected void finish() throws CDIException { + + ((Thread)getThread()).setCurrentStackFrame(this, false); + + Target target = (Target)getTarget(); + MISession miSession = target.getMISession(); + CommandFactory factory = miSession.getCommandFactory(); + MIExecFinish finish = factory.createMIExecFinish(); + try { + miSession.postCommand(finish); + MIInfo info = finish.getMIInfo(); + if (info == null) { + throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ + } + } catch (MIException e) { + throw new MI2CDIException(e); + } + } + + /** + */ + protected void execReturn(String value) throws CDIException { + + ((Thread)getThread()).setCurrentStackFrame(this, false); + + Target target = (Target)getTarget(); + MISession miSession = target.getMISession(); + CommandFactory factory = miSession.getCommandFactory(); + MIExecReturn ret; + if (value == null) { + ret = factory.createMIExecReturn(); + } else { + ret = factory.createMIExecReturn(value); + } + try { + miSession.postCommand(ret); + MIInfo info = ret.getMIInfo(); + if (info == null) { + throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ + } + } catch (MIException e) { + throw new MI2CDIException(e); + } + } + } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java index f1b810134ad..5400e2e875a 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java @@ -30,14 +30,11 @@ import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.VariableManager; -import org.eclipse.cdt.debug.mi.core.command.Command; import org.eclipse.cdt.debug.mi.core.command.CommandFactory; import org.eclipse.cdt.debug.mi.core.command.MIDataEvaluateExpression; 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.MIExecNext; 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.MIExecStep; import org.eclipse.cdt.debug.mi.core.command.MIExecStepInstruction; @@ -66,7 +63,6 @@ public class Target implements ICDITarget { Thread[] noThreads = new Thread[0]; Thread[] currentThreads; int currentThreadId; - Command lastExecutionCommand; public Target(Session s, MISession mi) { session = s; @@ -74,10 +70,6 @@ public class Target implements ICDITarget { currentThreads = noThreads; } - public Command getLastExecutionCommand() { - return lastExecutionCommand; - } - public MISession getMISession() { return miSession; } @@ -154,12 +146,10 @@ public class Target implements ICDITarget { // some variables like Register. Call an update() // To generate changeEvents. if (doUpdate) { - // TODO: only our Process RegisterManager regMgr = (RegisterManager)session.getRegisterManager(); if (regMgr.isAutoUpdate()) { regMgr.update(this); } - // TODO: only our Process VariableManager varMgr = (VariableManager)session.getVariableManager(); if (varMgr.isAutoUpdate()) { varMgr.update(this); @@ -341,7 +331,6 @@ public class Target implements ICDITarget { public void restart() throws CDIException { CommandFactory factory = miSession.getCommandFactory(); MIExecRun run = factory.createMIExecRun(new String[0]); - lastExecutionCommand = run; try { miSession.postCommand(run); MIInfo info = run.getMIInfo(); @@ -353,39 +342,19 @@ public class Target implements ICDITarget { } } - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#resume() - */ - public void resume() throws CDIException { - if (miSession.getMIInferior().isRunning()) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Inferior_already_running")); //$NON-NLS-1$ - } else if (miSession.getMIInferior().isSuspended()) { - CommandFactory factory = miSession.getCommandFactory(); - MIExecContinue cont = factory.createMIExecContinue(); - lastExecutionCommand = cont; - try { - miSession.postCommand(cont); - MIInfo info = cont.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } else if (miSession.getMIInferior().isTerminated()) { - restart(); - } else { - restart(); - } - } - /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepInto() */ public void stepInto() throws CDIException { + stepInto(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int) + */ + public void stepInto(int count) throws CDIException { CommandFactory factory = miSession.getCommandFactory(); - MIExecStep step = factory.createMIExecStep(); - lastExecutionCommand = step; + MIExecStep step = factory.createMIExecStep(count); try { miSession.postCommand(step); MIInfo info = step.getMIInfo(); @@ -394,16 +363,23 @@ public class Target implements ICDITarget { } } catch (MIException e) { throw new MI2CDIException(e); - } + } } + /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepIntoInstruction() */ public void stepIntoInstruction() throws CDIException { + stepIntoInstruction(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int) + */ + public void stepIntoInstruction(int count) throws CDIException { CommandFactory factory = miSession.getCommandFactory(); - MIExecStepInstruction stepi = factory.createMIExecStepInstruction(); - lastExecutionCommand = stepi; + MIExecStepInstruction stepi = factory.createMIExecStepInstruction(count); try { miSession.postCommand(stepi); MIInfo info = stepi.getMIInfo(); @@ -413,15 +389,22 @@ public class Target implements ICDITarget { } catch (MIException e) { throw new MI2CDIException(e); } + } /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepOver() */ public void stepOver() throws CDIException { + stepOver(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int) + */ + public void stepOver(int count) throws CDIException { CommandFactory factory = miSession.getCommandFactory(); - MIExecNext next = factory.createMIExecNext(); - lastExecutionCommand = next; + MIExecNext next = factory.createMIExecNext(count); try { miSession.postCommand(next); MIInfo info = next.getMIInfo(); @@ -430,16 +413,22 @@ public class Target implements ICDITarget { } } catch (MIException e) { throw new MI2CDIException(e); - } + } } /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepOverInstruction() */ public void stepOverInstruction() throws CDIException { + stepOverInstruction(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int) + */ + public void stepOverInstruction(int count) throws CDIException { CommandFactory factory = miSession.getCommandFactory(); - MIExecNextInstruction nexti = factory.createMIExecNextInstruction(); - lastExecutionCommand = nexti; + MIExecNextInstruction nexti = factory.createMIExecNextInstruction(count); try { miSession.postCommand(nexti); MIInfo info = nexti.getMIInfo(); @@ -455,52 +444,39 @@ public class Target implements ICDITarget { * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn() */ public void stepReturn() throws CDIException { - stepReturn(true); + ((Thread)getCurrentThread()).getCurrentStackFrame().stepReturn(); } /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#stepReturn(boolean) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation) */ - public void stepReturn(boolean execute) throws CDIException { - if (execute) { - finish(); - } else { - execReturn(); - } + public void runUntil(ICDILocation location) throws CDIException { + stepUntil(location); } - /** + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation) */ - protected void finish() throws CDIException { + public void stepUntil(ICDILocation location) throws CDIException { CommandFactory factory = miSession.getCommandFactory(); - MIExecFinish finish = factory.createMIExecFinish(); - lastExecutionCommand = finish; + String loc = ""; //$NON-NLS-1$ + if (location.getFile() != null && location.getFile().length() > 0) { + loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ + } else if (location.getFunction() != null && location.getFunction().length() > 0) { + loc = location.getFunction(); + } else if (location.getAddress() != 0) { + loc = "*" + location.getAddress(); //$NON-NLS-1$ + } + MIExecUntil until = factory.createMIExecUntil(loc); try { - miSession.postCommand(finish); - MIInfo info = finish.getMIInfo(); + miSession.postCommand(until); + MIInfo info = until.getMIInfo(); if (info == null) { throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ } } catch (MIException e) { throw new MI2CDIException(e); - } - } - - /** - */ - protected void execReturn() throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MIExecReturn ret = factory.createMIExecReturn(); - lastExecutionCommand = ret; - try { - miSession.postCommand(ret); - MIInfo info = ret.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } + } } /** @@ -536,30 +512,57 @@ public class Target implements ICDITarget { } /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#runUntil(ICDILocation) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#resume() */ - public void runUntil(ICDILocation location) throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - String loc = ""; //$NON-NLS-1$ - if (location.getFile() != null && location.getFile().length() > 0) { - loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ - } else if (location.getFunction() != null && location.getFunction().length() > 0) { - loc = location.getFunction(); - } else if (location.getAddress() != 0) { - loc = "*" + location.getAddress(); //$NON-NLS-1$ + public void resume() throws CDIException { + resume(false); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation) + */ + public void resume(ICDILocation location) throws CDIException { + jump(location); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal) + */ + public void resume(ICDISignal signal) throws CDIException { + signal(signal); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(boolean) + */ + public void resume(boolean passSignal) throws CDIException { + if (miSession.getMIInferior().isRunning()) { + throw new CDIException(CdiResources.getString("cdi.model.Target.Inferior_already_running")); //$NON-NLS-1$ + } else if (miSession.getMIInferior().isSuspended()) { + if (passSignal) { + signal(); + } else { + continuation(); + } + } else if (miSession.getMIInferior().isTerminated()) { + restart(); + } else { + restart(); } - MIExecUntil until = factory.createMIExecUntil(loc); - lastExecutionCommand = until; + } + + public void continuation() throws CDIException { + CommandFactory factory = miSession.getCommandFactory(); + MIExecContinue cont = factory.createMIExecContinue(); try { - miSession.postCommand(until); - MIInfo info = until.getMIInfo(); + miSession.postCommand(cont); + MIInfo info = cont.getMIInfo(); if (info == null) { throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ } } catch (MIException e) { throw new MI2CDIException(e); - } - + } } /** @@ -576,7 +579,6 @@ public class Target implements ICDITarget { loc = "*" + location.getAddress(); //$NON-NLS-1$ } MIJump jump = factory.createMIJump(loc); - lastExecutionCommand = jump; try { miSession.postCommand(jump); MIInfo info = jump.getMIInfo(); @@ -588,6 +590,40 @@ public class Target implements ICDITarget { } } + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal() + */ + public void signal() throws CDIException { + CommandFactory factory = miSession.getCommandFactory(); + MISignal signal = factory.createMISignal("0"); //$NON-NLS-1$ + try { + miSession.postCommand(signal); + MIInfo info = signal.getMIInfo(); + if (info == null) { + throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ + } + } 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 { + CommandFactory factory = miSession.getCommandFactory(); + MISignal sig = factory.createMISignal(signal.getName()); + try { + miSession.postCommand(sig); + MIInfo info = sig.getMIInfo(); + if (info == null) { + throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ + } + } catch (MIException e) { + throw new MI2CDIException(e); + } + } + /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#evaluateExpressionToString(String) */ @@ -654,40 +690,6 @@ public class Target implements ICDITarget { return miSession.getMIInferior(); } - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#signal() - */ - public void signal() throws CDIException { - CommandFactory factory = miSession.getCommandFactory(); - MISignal signal = factory.createMISignal("0"); //$NON-NLS-1$ - try { - miSession.postCommand(signal); - MIInfo info = signal.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } 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 { - CommandFactory factory = miSession.getCommandFactory(); - MISignal sig = factory.createMISignal(signal.getName()); - try { - miSession.postCommand(sig); - MIInfo info = sig.getMIInfo(); - if (info == null) { - throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ - } - } catch (MIException e) { - throw new MI2CDIException(e); - } - } - // Implementaton of ICDIBreapointManagement. @@ -747,4 +749,5 @@ public class Target implements ICDITarget { return bMgr.createLocation(address); } + } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java index 3da8503ddd1..2cfea8a0bbe 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Thread.java @@ -305,6 +305,89 @@ public class Thread extends CObject implements ICDIThread { } } + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepInto() + */ + public void stepInto() throws CDIException { + stepInto(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int) + */ + public void stepInto(int count) throws CDIException { + ((Target)getTarget()).setCurrentThread(this); + getTarget().stepInto(count); + } + + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepIntoInstruction() + */ + public void stepIntoInstruction() throws CDIException { + stepIntoInstruction(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int) + */ + public void stepIntoInstruction(int count) throws CDIException { + ((Target)getTarget()).setCurrentThread(this); + getTarget().stepIntoInstruction(count); + } + + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOver() + */ + public void stepOver() throws CDIException { + stepOver(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int) + */ + public void stepOver(int count) throws CDIException { + ((Target)getTarget()).setCurrentThread(this); + getTarget().stepOver(count); + + } + + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOverInstruction() + */ + public void stepOverInstruction() throws CDIException { + stepOverInstruction(1); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int) + */ + public void stepOverInstruction(int count) throws CDIException { + ((Target)getTarget()).setCurrentThread(this); + getTarget().stepOverInstruction(count); + } + + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn() + */ + public void stepReturn() throws CDIException { + getCurrentStackFrame().stepReturn(); + } + + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#runUntil(ICDILocation) + */ + public void runUntil(ICDILocation location) throws CDIException { + stepUntil(location); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation) + */ + public void stepUntil(ICDILocation location) throws CDIException { + ((Target)getTarget()).setCurrentThread(this); + getTarget().stepUntil(location); + } + /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isSuspended() */ @@ -312,102 +395,69 @@ public class Thread extends CObject implements ICDIThread { return getTarget().isSuspended(); } - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume() - */ - public void resume() throws CDIException { - getTarget().setCurrentThread(this); - getTarget().resume(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepInto() - */ - public void stepInto() throws CDIException { - getTarget().setCurrentThread(this); - getTarget().stepInto(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepIntoInstruction() - */ - public void stepIntoInstruction() throws CDIException { - getTarget().setCurrentThread(this); - getTarget().stepIntoInstruction(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOver() - */ - public void stepOver() throws CDIException { - getTarget().setCurrentThread(this); - getTarget().stepOver(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOverInstruction() - */ - public void stepOverInstruction() throws CDIException { - getTarget().setCurrentThread(this); - getTarget().stepOverInstruction(); - } - - /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn() - */ - public void stepReturn() throws CDIException { - getTarget().setCurrentThread(this); - 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) - */ - public void runUntil(ICDILocation location) throws CDIException { - getTarget().setCurrentThread(this); - getTarget().runUntil(location); - } - /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#suspend() */ public void suspend() throws CDIException { getTarget().suspend(); - getTarget().setCurrentThread(this); + } + + /** + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#resume() + */ + public void resume() throws CDIException { + resume(false); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(boolean) + */ + + public void resume(boolean passSignal) throws CDIException { + ((Target)getTarget()).setCurrentThread(this); + getTarget().resume(passSignal); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation) + */ + public void resume(ICDILocation location) throws CDIException { + // TODO Auto-generated method stub + ((Target)getTarget()).setCurrentThread(this); + getTarget().resume(location); + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal) + */ + public void resume(ICDISignal signal) throws CDIException { + ((Target)getTarget()).setCurrentThread(this); + getTarget().resume(signal); + } /** * @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); + resume(location); } /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#signal() */ public void signal() throws CDIException { - getTarget().setCurrentThread(this); - getTarget().signal(); + resume(false); } /** * @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); + resume(signal); } + /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#equals(ICDIThread) */ diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java index 0bb60f666ee..bd4ca9936c4 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java @@ -36,11 +36,6 @@ public class CommandFactory { return new MIBreakEnable(brknum); } -// public MIBreakInsert createMIBreakInsert(boolean isTemporary, boolean isHardware, -// String condition, int ignoreCount, String line) { -// return new MIBreakInsert(isTemporary, isHardware, condition, ignoreCount, line, 0); -// } - public MIBreakInsert createMIBreakInsert(boolean isTemporary, boolean isHardware, String condition, int ignoreCount, String line, int tid) { return new MIBreakInsert(isTemporary, isHardware, condition, ignoreCount, line, tid); @@ -147,28 +142,32 @@ public class CommandFactory { return null; } - public MIExecNext createMIExecNext() { - return new MIExecNext(); + public MIExecNext createMIExecNext(int count) { + return new MIExecNext(count); } - public MIExecNextInstruction createMIExecNextInstruction() { - return new MIExecNextInstruction(); + public MIExecNextInstruction createMIExecNextInstruction(int count) { + return new MIExecNextInstruction(count); } public MIExecReturn createMIExecReturn() { return new MIExecReturn(); } + public MIExecReturn createMIExecReturn(String arg) { + return new MIExecReturn(arg); + } + public MIExecRun createMIExecRun(String[] args) { return new MIExecRun(args); } - public MIExecStep createMIExecStep() { - return new MIExecStep(); + public MIExecStep createMIExecStep(int count) { + return new MIExecStep(count); } - public MIExecStepInstruction createMIExecStepInstruction() { - return new MIExecStepInstruction(); + public MIExecStepInstruction createMIExecStepInstruction(int count) { + return new MIExecStepInstruction(count); } public MIExecUntil createMIExecUntil(String location) { diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNext.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNext.java index 33c3983797e..4fdae15014c 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNext.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNext.java @@ -24,4 +24,8 @@ public class MIExecNext extends MICommand public MIExecNext() { super("-exec-next"); //$NON-NLS-1$ } + + public MIExecNext(int count) { + super("-exec-next", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNextInstruction.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNextInstruction.java index 85dd3b2109a..6568b5533fa 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNextInstruction.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecNextInstruction.java @@ -26,4 +26,8 @@ public class MIExecNextInstruction extends MICommand public MIExecNextInstruction() { super("-exec-next-instruction"); //$NON-NLS-1$ } + + public MIExecNextInstruction(int count) { + super("-exec-next-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecReturn.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecReturn.java index a9db4aa7f62..bd2038eb5dd 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecReturn.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecReturn.java @@ -11,8 +11,6 @@ package org.eclipse.cdt.debug.mi.core.command; - - /** * * -exec-return @@ -26,4 +24,9 @@ public class MIExecReturn extends MICommand public MIExecReturn() { super("-exec-return"); //$NON-NLS-1$ } + + public MIExecReturn(String arg) { + super("-exec-run", new String[] { arg }); //$NON-NLS-1$ + } + } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStep.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStep.java index ca0c02e894a..0eb2b6ab00e 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStep.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStep.java @@ -26,4 +26,8 @@ public class MIExecStep extends MICommand public MIExecStep() { super("-exec-step"); //$NON-NLS-1$ } + + public MIExecStep(int count) { + super("-exec-step", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStepInstruction.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStepInstruction.java index 06b62c05c59..876ea879930 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStepInstruction.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIExecStepInstruction.java @@ -29,4 +29,8 @@ public class MIExecStepInstruction extends MICommand public MIExecStepInstruction() { super("-exec-step-instruction"); //$NON-NLS-1$ } + + public MIExecStepInstruction(int count) { + super("-exec-step-instruction", new String[] { Integer.toString(count) }); //$NON-NLS-1$ + } }