Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java68
2 files changed, 73 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java
index 31e4a7095..c5c476f56 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerModelProperties.java
@@ -111,4 +111,9 @@ public interface IPeerModelProperties {
* Property: Last selected simulator type
*/
public static final String PROP_SIM_TYPE = "SimulatorType"; //$NON-NLS-1$
+
+ /**
+ * Property: Auto-start the debugger after the agent launch.
+ */
+ public static final String PROP_AUTO_START_DEBUGGER = "autoStartDebugger"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java
new file mode 100644
index 000000000..2ab3d672c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/services/AbstractSimulatorService.java
@@ -0,0 +1,68 @@
+/**
+ * AbstractSimulatorService.java
+ * Created on Mar 22, 2013
+ *
+ * Copyright (c) 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.tcf.locator.services;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.callback.Callback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.services.AbstractService;
+import org.eclipse.tcf.te.runtime.services.ServiceManager;
+import org.eclipse.tcf.te.runtime.services.interfaces.IDebugService;
+import org.eclipse.tcf.te.runtime.services.interfaces.ISimulatorService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProperties;
+
+/**
+ * Abstract simulator service implementation.
+ */
+public abstract class AbstractSimulatorService extends AbstractService implements ISimulatorService {
+
+ public static final String CALLBACK_SIMULATOR_EXIT_VALUE = "simulatorExitValue"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see com.windriver.te.tcf.core.interfaces.agents.IAgentService#autoStartDebugger(org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void autoStartDebugger(final IPeerModel peerModel, final IProgressMonitor monitor) {
+ Assert.isNotNull(peerModel);
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ String value = peerModel.getPeer().getAttributes().get(IPeerModelProperties.PROP_AUTO_START_DEBUGGER);
+ boolean autoStartDbg = value != null ? Boolean.parseBoolean(value) : false;
+
+ // Auto-start the debugger now, if requested
+ if (autoStartDbg) {
+ // If the peer model is in state WAITING_FOR_READY, the debugger
+ // launch needs to be delayed until the state is reseted.
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ IDebugService dbgService = ServiceManager.getInstance().getService(peerModel, IDebugService.class, false);
+ if (dbgService != null) {
+ // Attach the debugger and all cores (OCDDevices)
+ IPropertiesContainer props = new PropertiesContainer();
+ dbgService.attach(peerModel, props, new Callback());
+ }
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ }
+ }
+ };
+
+ Protocol.invokeLater(runnable);
+ }
+}

Back to the top