Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2008-05-03 00:44:46 +0000
committereutarass2008-05-03 00:44:46 +0000
commita9183acf706be3c4a0f41a5572382acf9d0f0e28 (patch)
tree4f457b5620074c3344cf18aedc1adb433849d8b8 /plugins/org.eclipse.tm.tcf.debug.ui
parentfeb497a50df2b2edc4a139fb52e39b394fbf05e1 (diff)
downloadorg.eclipse.tcf-a9183acf706be3c4a0f41a5572382acf9d0f0e28.tar.gz
org.eclipse.tcf-a9183acf706be3c4a0f41a5572382acf9d0f0e28.tar.xz
org.eclipse.tcf-a9183acf706be3c4a0f41a5572382acf9d0f0e28.zip
1. Bug 225555: [tcf] Migrate to DSF 1.0M6
2. Since DSF 1.0 requires it, migrated to Eclipse 3.4M6 and CDT 5.0M6 3. Since DSF is not fast enough to keep up with rapid target state changes when TCF diagnostic is running, reworked TCF flow control logic and added TCF API for client congestion monitoring, which is used to monitor DSF UI event queue.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildren.java1
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java1
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDataCache.java178
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java8
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java4
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java7
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeLaunch.java6
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java1
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java10
9 files changed, 24 insertions, 192 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildren.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildren.java
index 3a062ec04..8a9b280b6 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildren.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildren.java
@@ -17,6 +17,7 @@ import java.util.Map;
import org.eclipse.tm.tcf.protocol.IChannel;
import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.util.TCFDataCache;
/**
* TCFChildren is a concrete type of TCF data cache that is used to cache a list of children.
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java
index 343edfb29..2a1b609d9 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFChildrenExecContext.java
@@ -18,6 +18,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.tm.tcf.protocol.IToken;
import org.eclipse.tm.tcf.services.IMemory;
import org.eclipse.tm.tcf.services.IRunControl;
+import org.eclipse.tm.tcf.util.TCFDataCache;
/**
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDataCache.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDataCache.java
deleted file mode 100644
index 5584a02ed..000000000
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFDataCache.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems, Inc. 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.tm.internal.tcf.debug.ui.model;
-
-import java.util.HashSet;
-
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.Protocol;
-
-/**
- * Objects of this class are used cache TCF remote data.
- * The cache is asynchronous state machine. The states are:
- * 1. Valid - cache is in sync with remote data, use getError() and getData() to get cached data;
- * 2. Invalid - cache is out out of sync, start data retrieval by calling validate();
- * 3. Pending - cache is waiting result of a command that was sent to remote peer.
- * @param <V> - type of data to be stored in the cache.
- */
-public abstract class TCFDataCache<V> implements Runnable {
-
- private Throwable error;
- private boolean valid;
- private V data;
-
- protected final IChannel channel;
- protected IToken command;
-
- private final HashSet<Runnable> waiting_list = new HashSet<Runnable>();
-
- public TCFDataCache(IChannel channel) {
- assert channel != null;
- this.channel = channel;
- }
-
- /**
- * @return true if cache contains up-to-date data (or data error).
- */
- public boolean isValid() {
- return valid;
- }
-
- /**
- * @return true if data retrieval is in progress.
- */
- public boolean isPending() {
- return command != null;
- }
-
- /**
- * @return error object if data retrieval ended with an error, or null if retrieval was successful.
- * Note: It is prohibited to call this method when cache is not valid.
- */
- public Throwable getError() {
- assert valid;
- return error;
- }
-
- /**
- * @return cached data object.
- * Note: It is prohibited to call this method when cache is not valid.
- */
- public V getData() {
- assert valid;
- return data;
- }
-
- /**
- * Notify waiting clients about cache state change and remove then from wait list.
- * It is responsibility of clients to check if state change was one they are waiting for.
- */
- public void run() {
- if (waiting_list.isEmpty()) return;
- Runnable[] arr = waiting_list.toArray(new Runnable[waiting_list.size()]);
- waiting_list.clear();
- for (Runnable r : arr) r.run();
- }
-
- /**
- * Add a client call-back to cache wait list.
- * @param req
- */
- public void wait(Runnable cb) {
- assert !valid;
- if (cb != null) waiting_list.add(cb);
- }
-
- /**
- * Initiate data retrieval if the cache is not valid.
- * @return
- */
- public boolean validate() {
- assert Protocol.isDispatchThread();
- if (channel.getState() != IChannel.STATE_OPEN) {
- error = null;
- command = null;
- valid = true;
- data = null;
- }
- else {
- if (command != null) return false;
- if (!valid && !startDataRetrieval()) return false;
- }
- assert valid;
- assert command == null;
- run();
- return true;
- }
-
- /**
- * End cache pending state.
- * @param token - pending command handle.
- * @param error - data retrieval error or null
- * @param data - up-to-date data object
- */
- public void set(IToken token, Throwable error, V data) {
- assert Protocol.isDispatchThread();
- if (command != token) return;
- command = null;
- if (channel.getState() != IChannel.STATE_OPEN) data = null;
- this.error = error;
- this.data = data;
- valid = true;
- run();
- }
-
- /**
- * Force cache to become valid, cancel pending data retrieval if any.
- * @param data - up-to-date data object
- */
- public void reset(V data) {
- if (command != null) {
- command.cancel();
- command = null;
- }
- this.data = data;
- error = null;
- valid = true;
- run();
- }
-
- /**
- * Invalidate the cache. If retrieval is in progress - let it continue.
- */
- public void reset() {
- error = null;
- valid = false;
- data = null;
- run();
- }
-
- /**
- * Force cache to invalid state, cancel pending data retrieval if any.
- */
- public void cancel() {
- if (command != null) {
- command.cancel();
- command = null;
- }
- error = null;
- valid = false;
- data = null;
- run();
- }
-
- /**
- * Sub-classes should override this method to implement actual data retrieval logic.
- * @return true is all done, false if retrieval is in progress.
- */
- protected abstract boolean startDataRetrieval();
-}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
index c6281fc05..f48adea2b 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java
@@ -303,8 +303,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
if (run != null) run.addListener(run_listener);
IRegisters reg = launch.getService(IRegisters.class);
if (reg != null) reg.addListener(reg_listener);
- launch_node.makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT);
- fireModelChanged();
+ launchChanged();
}
void onDisconnected() {
@@ -313,10 +312,7 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider,
for (int i = 0; i < a.length; i++) {
if (!a[i].isDisposed()) a[i].dispose();
}
- if (launch_node != null) {
- launch_node.makeModelDelta(IModelDelta.STATE | IModelDelta.CONTENT);
- fireModelChanged();
- }
+ launchChanged();
}
void onProxyInstalled(final TCFModelProxy p) {
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java
index 861e91057..3895affa7 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNode.java
@@ -151,6 +151,7 @@ public abstract class TCFNode extends PlatformObject implements Comparable<TCFNo
final void update(final IChildrenCountUpdate result) {
new TCFRunnable(model.getDisplay(), result) {
public void run() {
+ if (result.isCanceled()) return;
IChannel channel = model.getLaunch().getChannel();
if (!disposed && channel.getState() == IChannel.STATE_OPEN) {
if (!validateNode(this)) return;
@@ -172,6 +173,7 @@ public abstract class TCFNode extends PlatformObject implements Comparable<TCFNo
final void update(final IChildrenUpdate result) {
new TCFRunnable(model.getDisplay(), result) {
public void run() {
+ if (result.isCanceled()) return;
IChannel channel = model.getLaunch().getChannel();
if (!disposed && channel.getState() == IChannel.STATE_OPEN) {
if (!validateNode(this)) return;
@@ -190,6 +192,7 @@ public abstract class TCFNode extends PlatformObject implements Comparable<TCFNo
final void update(final IHasChildrenUpdate result) {
new TCFRunnable(model.getDisplay(), result) {
public void run() {
+ if (result.isCanceled()) return;
IChannel channel = model.getLaunch().getChannel();
if (!disposed && channel.getState() == IChannel.STATE_OPEN) {
if (!validateNode(this)) return;
@@ -211,6 +214,7 @@ public abstract class TCFNode extends PlatformObject implements Comparable<TCFNo
final void update(final ILabelUpdate result) {
new TCFRunnable(model.getDisplay(), result) {
public void run() {
+ if (result.isCanceled()) return;
IChannel channel = model.getLaunch().getChannel();
if (!disposed && channel.getState() == IChannel.STATE_OPEN) {
if (!validateNode(this)) return;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
index 6303b1558..119665057 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeExecContext.java
@@ -28,6 +28,7 @@ import org.eclipse.tm.tcf.protocol.IToken;
import org.eclipse.tm.tcf.protocol.Protocol;
import org.eclipse.tm.tcf.services.IMemory;
import org.eclipse.tm.tcf.services.IRunControl;
+import org.eclipse.tm.tcf.util.TCFDataCache;
@SuppressWarnings("serial")
@@ -218,7 +219,6 @@ public class TCFNodeExecContext extends TCFNode {
@Override
protected void getData(IChildrenUpdate result) {
- int offset = 0;
TCFNode[] arr = null;
IRunControl.RunControlContext ctx = run_context.getData();
if (ctx != null && ctx.hasState()) {
@@ -233,8 +233,11 @@ public class TCFNodeExecContext extends TCFNode {
arr = children_exec.toArray();
}
Arrays.sort(arr);
+ int offset = 0;
+ int r_offset = result.getOffset();
+ int r_length = result.getLength();
for (TCFNode n : arr) {
- if (offset >= result.getOffset() && offset < result.getOffset() + result.getLength()) {
+ if (offset >= r_offset && offset < r_offset + r_length) {
result.setChild(n, offset);
}
offset++;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeLaunch.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeLaunch.java
index 6b767821d..84cf9df0b 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeLaunch.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeLaunch.java
@@ -49,11 +49,13 @@ public class TCFNodeLaunch extends TCFNode {
@Override
protected void getData(IChildrenUpdate result) {
- int offset = 0;
TCFNode[] arr = children.toArray();
Arrays.sort(arr);
+ int offset = 0;
+ int r_offset = result.getOffset();
+ int r_length = result.getLength();
for (TCFNode n : arr) {
- if (offset >= result.getOffset() && offset < result.getOffset() + result.getLength()) {
+ if (offset >= r_offset && offset < r_offset + r_length) {
result.setChild(n, offset);
}
offset++;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
index 50a3e44e5..6fc559085 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeRegister.java
@@ -22,6 +22,7 @@ import org.eclipse.tm.internal.tcf.debug.ui.ImageCache;
import org.eclipse.tm.tcf.protocol.IChannel;
import org.eclipse.tm.tcf.protocol.IToken;
import org.eclipse.tm.tcf.services.IRegisters;
+import org.eclipse.tm.tcf.util.TCFDataCache;
//TODO: hierarchical registers
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java
index 71c037ed2..84efbc5d6 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFNodeStackFrame.java
@@ -30,8 +30,8 @@ import org.eclipse.tm.tcf.services.IMemory;
import org.eclipse.tm.tcf.services.IRunControl;
import org.eclipse.tm.tcf.services.IStackTrace;
import org.eclipse.tm.tcf.services.ILineNumbers.CodeArea;
+import org.eclipse.tm.tcf.util.TCFDataCache;
-@SuppressWarnings("serial")
public class TCFNodeStackFrame extends TCFNode {
private int frame_no;
@@ -56,7 +56,7 @@ public class TCFNodeStackFrame extends TCFNode {
IStackTrace st = model.getLaunch().getService(IStackTrace.class);
command = st.getContext(new String[]{ id }, new IStackTrace.DoneGetContext() {
public void doneGetContext(IToken token, Exception error, IStackTrace.StackTraceContext[] context) {
- set(token, error, context[0]);
+ set(token, error, context == null || context.length == 0 ? null : context[0]);
}
});
return false;
@@ -190,7 +190,6 @@ public class TCFNodeStackFrame extends TCFNode {
@Override
protected void getData(IChildrenUpdate result) {
- int offset = 0;
TCFNode[] arr = null;
if (IDebugUIConstants.ID_REGISTER_VIEW.equals(result.getPresentationContext().getId())) {
arr = children_regs.toArray();
@@ -200,8 +199,11 @@ public class TCFNodeStackFrame extends TCFNode {
}
if (arr != null) {
Arrays.sort(arr);
+ int offset = 0;
+ int r_offset = result.getOffset();
+ int r_length = result.getLength();
for (TCFNode n : arr) {
- if (offset >= result.getOffset() && offset < result.getOffset() + result.getLength()) {
+ if (offset >= r_offset && offset < r_offset + r_length) {
result.setChild(n, offset);
}
offset++;

Back to the top