diff options
author | Pawel Piech | 2009-09-11 18:54:31 +0000 |
---|---|---|
committer | Pawel Piech | 2009-09-11 18:54:31 +0000 |
commit | c4038c98424e7972ac934c397f48eabf6f9222d6 (patch) | |
tree | 8e0ca2c7e562dfba64f66e49a471bd3ef98aa993 /org.eclipse.debug.examples.core | |
parent | b4a5f63c927fcca911789d0a42a6695eb017a5fd (diff) | |
download | eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.tar.gz eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.tar.xz eclipse.platform.debug-c4038c98424e7972ac934c397f48eabf6f9222d6.zip |
Bug 286256 - Request to move Restart icon to core debug framework
Diffstat (limited to 'org.eclipse.debug.examples.core')
4 files changed, 68 insertions, 3 deletions
diff --git a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF index 63456da11..7e1ec2ad8 100644 --- a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Example Debug Core Plug-in Bundle-SymbolicName: org.eclipse.debug.examples.core;singleton:=true -Bundle-Version: 1.1.0 +Bundle-Version: 1.2.0 Bundle-Activator: org.eclipse.debug.examples.core.pda.DebugCorePlugin Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources, diff --git a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java index 98a56ddc3..e140e1085 100644 --- a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java +++ b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java @@ -454,7 +454,7 @@ public class PDAVirtualMachine { fSuspendVM = "client"; } - + void run() { int id = fNextThreadId++; sendDebugEvent("vmstarted", false); @@ -687,6 +687,7 @@ public class PDAVirtualMachine { else if ("popdata".equals(command)) debugPopData(args); else if ("pushdata".equals(command)) debugPushData(args); else if ("registers".equals(command)) debugRegisters(args); + else if ("restart".equals(command)) debugRestart(args); else if ("resume".equals(command)) debugResume(args); else if ("set".equals(command)) debugSetBreakpoint(args); else if ("setdata".equals(command)) debugSetData(args); @@ -944,7 +945,25 @@ public class PDAVirtualMachine { response.append('\n'); sendCommandResponse(response.toString()); } - + + void debugRestart(Args args) { + fSuspendVM = "restart"; + + for (Iterator itr = fThreads.keySet().iterator(); itr.hasNext();) { + Integer id = (Integer)itr.next(); + sendDebugEvent("exited " + id, false); + } + fThreads.clear(); + + int id = fNextThreadId++; + fThreads.put(new Integer(id), new PDAThread(id, "main", 0)); + sendDebugEvent("started " + id, false); + + fRegisters.clear(); + + sendCommandResponse("ok\n"); + } + void debugResume(Args args) { PDAThread thread = args.getThreadArg(); if (thread == null) { diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java index 3705decea..92a5a9955 100644 --- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java @@ -52,6 +52,7 @@ import org.eclipse.debug.examples.core.pda.protocol.PDACommandResult; import org.eclipse.debug.examples.core.pda.protocol.PDAEvent; import org.eclipse.debug.examples.core.pda.protocol.PDAEventStopCommand; import org.eclipse.debug.examples.core.pda.protocol.PDAExitedEvent; +import org.eclipse.debug.examples.core.pda.protocol.PDARestartCommand; import org.eclipse.debug.examples.core.pda.protocol.PDAStartedEvent; import org.eclipse.debug.examples.core.pda.protocol.PDATerminateCommand; import org.eclipse.debug.examples.core.pda.protocol.PDAVMResumeCommand; @@ -568,4 +569,14 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr } return null; } + + /** + * Restarts the current debug session + * + * @throws DebugException + */ + public void restart() throws DebugException { + sendCommand(new PDARestartCommand()); + } + } diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java new file mode 100644 index 000000000..21e58c430 --- /dev/null +++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2008, 2009 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 + *******************************************************************************/ +package org.eclipse.debug.examples.core.pda.protocol; + + +/** + * Restarts the debug session. All threads exit and the main threads starts + * + * <pre> + * C: restart + * E: exited 0 + * E: started 1 + * R: ok + * </pre> + */ + +public class PDARestartCommand extends PDACommand { + + public PDARestartCommand() { + super("restart"); + } + + + public PDACommandResult createResult(String resultText) { + return new PDACommandResult(resultText); + } +} |