Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanimir Agovic2018-12-28 14:55:23 +0000
committerSanimir Agovic2018-12-28 16:09:58 +0000
commitf50b35a8148b61d2fcb7f7a29eb671fdbcd1c581 (patch)
tree57d327751591ad795713887c94937266d329fbc8 /plugins
parent6e6dc03e79785816bf0847a90f86936402639684 (diff)
downloadorg.eclipse.tcf-f50b35a8148b61d2fcb7f7a29eb671fdbcd1c581.tar.gz
org.eclipse.tcf-f50b35a8148b61d2fcb7f7a29eb671fdbcd1c581.tar.xz
org.eclipse.tcf-f50b35a8148b61d2fcb7f7a29eb671fdbcd1c581.zip
TCF Core: new TCF service interface: ContextReset
The service provides context reset capabilities and allows simulators, gdb clients, and on chip debuggers to reset the target under debug. Change-Id: I0f20c605dee0bc4527403d979fe363775994fac3 Signed-off-by: Sanimir Agovic <sanimir@subpath.org>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextResetProxy.java62
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextReset.java87
2 files changed, 149 insertions, 0 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextResetProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextResetProxy.java
new file mode 100644
index 000000000..18f3f8c2f
--- /dev/null
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ContextResetProxy.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2019.
+ * 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
+ *******************************************************************************/
+package org.eclipse.tcf.internal.services.remote;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.tcf.core.Command;
+import org.eclipse.tcf.protocol.IChannel;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IContextReset;
+import org.eclipse.tcf.services.IDisassembly.IDisassemblyLine;
+
+public class ContextResetProxy implements IContextReset {
+
+ private IChannel channel;
+
+ public ContextResetProxy(IChannel channel) {
+ this.channel = channel;
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public IToken getCapabilities(String context_id, final DoneGetCapabilities done) {
+ return new Command(channel, this, "getCapabilities", new Object[] { context_id }) {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void done(Exception error, Object[] args) {
+ Collection<Map<String, Object>> map = null;
+ if (error == null) {
+ assert args.length == 2;
+ error = toError(args[0]);
+ map = (Collection<Map<String, Object>>) args[1];
+ }
+ done.doneGetCapabilities(token, error, map);
+ }
+ }.token;
+ }
+
+ @Override
+ public IToken reset(String context_id, String reset_type, Map<String, Object> params, final DoneReset done) {
+ return new Command(channel, this, "reset", new Object[] { context_id, reset_type, params }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ if (error == null) {
+ assert args.length == 1;
+ error = toError(args[0]);
+ }
+ done.doneReset(token, error);
+ }
+ }.token;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextReset.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextReset.java
new file mode 100644
index 000000000..28bd87be6
--- /dev/null
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IContextReset.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2019.
+ * 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
+ *******************************************************************************/
+package org.eclipse.tcf.services;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.tcf.protocol.IService;
+import org.eclipse.tcf.protocol.IToken;
+
+/**
+ * TCF Context Reset service interface.
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+
+public interface IContextReset extends IService {
+
+ /**
+ * Service name.
+ */
+ static final String NAME = "ContextReset";
+
+ /** The name of the reset type, String. */
+ static final String CAPABILITY_TYPE = "Type";
+
+ /** Brief description of the reset type, String. */
+ static final String CAPABILITY_DESCRIPTION = "Description";
+
+ /**
+ * Report context reset service capabilities to clients so they can adjust
+ * to different implementations of the service.
+ *
+ * @param ctx - a context ID.
+ * @param done - command result call back object.
+ * @return - pending command handle.
+ */
+ IToken getCapabilities(String context_id, DoneGetCapabilities done);
+
+ /**
+ * Call back interface for 'getCapabilities' command.
+ */
+ interface DoneGetCapabilities {
+ /**
+ * Called when 'getCapabilities' command is done.
+ *
+ * @param token - command handle.
+ * @param error - error object or null.
+ * @param capabilities - context reset service capabilities description.
+ */
+ void doneGetCapabilities(IToken token, Exception error, Collection<Map<String, Object>> capabilities);
+ }
+
+ /**
+ * If true, context gets suspended after reset, Boolean.
+ */
+ static final String PARAM_SUSPEND = "Suspend";
+
+ /**
+ * Reset a specified context.
+ *
+ * @param context_id - a context ID, usually one returned by Run Control or Memory services.
+ * @param type - name of the reset type.
+ * @param params - parameters to control the context reset.
+ * @param done - command result call back object.
+ * @return - pending command handle.
+ */
+ IToken reset(String context_id, String reset_type, Map<String, Object> params, DoneReset done);
+
+ /**
+ * Call back interface for 'reset' command.
+ */
+ interface DoneReset {
+ /**
+ * Called when reset is done.
+ *
+ * @param token - command handle.
+ * @param error - error object or null.
+ */
+ void doneReset(IToken token, Exception error);
+ }
+}

Back to the top