Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2011-10-25 20:18:21 +0000
committerEugene Tarassov2011-10-25 20:18:21 +0000
commite17435b5ec772877dd33ecbad9465bd02d689dfc (patch)
tree0b94b0f99dc8995310ab3cea993dea3f5fd62f06 /plugins
parentd6c4bcd4ffc0668bcb97fb2afb4378498c4b718c (diff)
downloadorg.eclipse.tcf-e17435b5ec772877dd33ecbad9465bd02d689dfc.tar.gz
org.eclipse.tcf-e17435b5ec772877dd33ecbad9465bd02d689dfc.tar.xz
org.eclipse.tcf-e17435b5ec772877dd33ecbad9465bd02d689dfc.zip
TCF Debugger: added Refresh command and update policies menu in the Memory view.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml35
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java41
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshHandler.java47
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/UpdatePolicyMenu.java10
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ViewMemoryCommand.java8
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFMemoryBlockRetrieval.java22
-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.java23
8 files changed, 149 insertions, 41 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml
index b6c6de4fe..3927a0dc4 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/plugin.xml
@@ -549,6 +549,41 @@
class="org.eclipse.tm.internal.tcf.debug.ui.commands.UpdatePolicyMenu"/>
</menu>
</menuContribution>
+ <!-- Memory View -->
+ <menuContribution
+ locationURI="toolbar:org.eclipse.debug.ui.MemoryView?after=additions">
+ <command
+ commandId="org.eclipse.tm.tcf.debug.ui.commands.refresh"
+ icon="icons/refresh.gif"
+ id="org.eclipse.tm.tcf.debug.ui.commands.refresh.memory"
+ label="%Refresh.label"
+ style="push">
+ <visibleWhen checkEnabled="false">
+ <with variable="activeContexts">
+ <iterate ifEmpty="false" operator="or">
+ <equals value="org.eclipse.tm.tcf.debug.ui.debugging"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="menu:org.eclipse.debug.ui.MemoryView?after=additions">
+ <menu
+ label="%UpdatePolicy.label"
+ id="org.eclipse.tm.tcf.debug.ui.commands.update.policy.memory">
+ <visibleWhen checkEnabled="false">
+ <with variable="activeContexts">
+ <iterate ifEmpty="false" operator="or">
+ <equals value="org.eclipse.tm.tcf.debug.ui.debugging"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ <dynamic
+ id="org.eclipse.tm.tcf.debug.ui.commands.update.policy.memory.menu"
+ class="org.eclipse.tm.internal.tcf.debug.ui.commands.UpdatePolicyMenu"/>
+ </menu>
+ </menuContribution>
</extension>
<extension
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
index 783d660c1..ac52e4fa2 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshCommand.java
@@ -10,9 +10,16 @@
*******************************************************************************/
package org.eclipse.tm.internal.tcf.debug.ui.commands;
+import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
+import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPartSite;
@@ -26,14 +33,28 @@ public class RefreshCommand extends AbstractActionDelegate {
@Override
protected void run() {
- final TCFNode n = getRootNode();
- if (n == null) return;
- new TCFTask<Object>(n.getChannel()) {
+ final TCFNode node = getRootNode();
+ if (node == null) return;
+ new TCFTask<Object>(node.getChannel()) {
public void run() {
IViewPart part = getView();
- n.refresh(part);
- if (n.getModel().clearLock(part)) {
- n.getModel().setLock(part);
+ TCFModel model = node.getModel();
+ TCFNode ref_node = node;
+ if (part instanceof IMemoryRenderingSite) {
+ // Search memory node
+ TCFDataCache<TCFNodeExecContext> mem_cache = model.searchMemoryContext(node);
+ if (mem_cache == null) {
+ done(null);
+ return;
+ }
+ if (!mem_cache.validate(this)) return;
+ ref_node = mem_cache.getData();
+ }
+ if (ref_node != null) {
+ ref_node.refresh(part);
+ if (model.clearLock(part)) {
+ model.setLock(part);
+ }
}
done(null);
}
@@ -49,6 +70,14 @@ public class RefreshCommand extends AbstractActionDelegate {
if (n == null) return null;
return n.getModel().getRootNode();
}
+ if (site != null && IDebugUIConstants.ID_MEMORY_VIEW.equals(site.getId())) {
+ ISelection selection = DebugUITools.getDebugContextManager().getContextService(
+ site.getWorkbenchWindow()).getActiveContext();
+ if (selection instanceof IStructuredSelection) {
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if (obj instanceof TCFNode) return (TCFNode)obj;
+ }
+ }
if (view instanceof IDebugView) {
Object input = ((IDebugView)view).getViewer().getInput();
if (input instanceof TCFNode) return (TCFNode)input;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshHandler.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshHandler.java
index 389e06b97..6658ec5da 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshHandler.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/RefreshHandler.java
@@ -1,13 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
+import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
@@ -18,7 +33,17 @@ public class RefreshHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
Object input = null;
final IWorkbenchPart part = HandlerUtil.getActivePart(event);
- if (part instanceof IDebugView) {
+ if (part instanceof IMemoryRenderingSite) {
+ IWorkbenchPartSite site = part.getSite();
+ if (site != null) {
+ ISelection selection = DebugUITools.getDebugContextManager().getContextService(
+ site.getWorkbenchWindow()).getActiveContext();
+ if (selection instanceof IStructuredSelection) {
+ input = ((IStructuredSelection)selection).getFirstElement();
+ }
+ }
+ }
+ else if (part instanceof IDebugView) {
IWorkbenchPartSite site = part.getSite();
if (site != null && IDebugUIConstants.ID_DEBUG_VIEW.equals(site.getId())) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
@@ -35,9 +60,23 @@ public class RefreshHandler extends AbstractHandler {
final TCFNode node = (TCFNode)input;
return new TCFTask<Object>(node.getChannel()) {
public void run() {
- node.refresh(part);
- if (node.getModel().clearLock(part)) {
- node.getModel().setLock(part);
+ TCFModel model = node.getModel();
+ TCFNode ref_node = node;
+ if (part instanceof IMemoryRenderingSite) {
+ // Search memory node
+ TCFDataCache<TCFNodeExecContext> mem_cache = model.searchMemoryContext(node);
+ if (mem_cache == null) {
+ done(null);
+ return;
+ }
+ if (!mem_cache.validate(this)) return;
+ ref_node = mem_cache.getData();
+ }
+ if (ref_node != null) {
+ ref_node.refresh(part);
+ if (model.clearLock(part)) {
+ model.setLock(part);
+ }
}
done(null);
}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/UpdatePolicyMenu.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/UpdatePolicyMenu.java
index dc79798e1..80a1d8a78 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/UpdatePolicyMenu.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/UpdatePolicyMenu.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.commands;
import org.eclipse.debug.ui.IDebugUIConstants;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ViewMemoryCommand.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ViewMemoryCommand.java
index f8fba229f..aa189e831 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ViewMemoryCommand.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/ViewMemoryCommand.java
@@ -19,6 +19,7 @@ import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.tm.internal.tcf.debug.ui.Activator;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExpression;
+import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNumberFormat;
import org.eclipse.tm.tcf.services.IExpressions;
import org.eclipse.tm.tcf.util.TCFDataCache;
import org.eclipse.tm.tcf.util.TCFTask;
@@ -56,6 +57,13 @@ public class ViewMemoryCommand extends AbstractActionDelegate {
byte[] bytes = val_data.getValue();
if (bytes != null) size = bytes.length;
}
+ else if (val_data.getRegisterID() != null) {
+ byte[] bytes = val_data.getValue();
+ if (bytes != null) {
+ addr = TCFNumberFormat.toBigInteger(bytes, 0, bytes.length,
+ val_data.isBigEndian(), false);
+ }
+ }
}
}
Block b = null;
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFMemoryBlockRetrieval.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFMemoryBlockRetrieval.java
index 2f89912af..81e523edd 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFMemoryBlockRetrieval.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFMemoryBlockRetrieval.java
@@ -198,26 +198,6 @@ class TCFMemoryBlockRetrieval implements IMemoryBlockRetrievalExtension {
return 1;
}
- private BigInteger toBigInteger(byte[] data, boolean big_endian, boolean sign_extension) {
- byte[] temp = null;
- if (sign_extension) {
- temp = new byte[data.length];
- }
- else {
- temp = new byte[data.length + 1];
- temp[0] = 0; // Extra byte to avoid sign extension by BigInteger
- }
- if (big_endian) {
- System.arraycopy(data, 0, temp, sign_extension ? 0 : 1, data.length);
- }
- else {
- for (int i = 0; i < data.length; i++) {
- temp[temp.length - i - 1] = data[i];
- }
- }
- return new BigInteger(temp);
- }
-
public BigInteger getBigBaseAddress() throws DebugException {
return new TCFDebugTask<BigInteger>(exec_ctx.getChannel()) {
public void run() {
@@ -245,7 +225,7 @@ class TCFMemoryBlockRetrieval implements IMemoryBlockRetrievalExtension {
else {
ISymbols.Symbol type = expression_type.getData();
boolean signed = type != null && type.getTypeClass() == ISymbols.TypeClass.integer;
- done(toBigInteger(data, value.isBigEndian(), signed));
+ done(TCFNumberFormat.toBigInteger(data, 0, data.length, value.isBigEndian(), signed));
}
}
}
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 fec9f971a..846933802 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
@@ -450,10 +450,10 @@ public abstract class TCFNode extends PlatformObject implements Comparable<TCFNo
/*--------------------------------------------------------------------------------------*/
/* Misc */
- public void refresh(IWorkbenchPart view) {
+ public void refresh(IWorkbenchPart part) {
model.flushAllCaches();
for (TCFModelProxy p : model.getModelProxies()) {
- if (p.getPresentationContext().getPart() != view) continue;
+ if (p.getPresentationContext().getPart() != part) continue;
p.addDelta(this, IModelDelta.STATE | IModelDelta.CONTENT);
}
}
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 81e04b2df..6f35b4668 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
@@ -27,6 +27,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
@@ -44,7 +45,7 @@ import org.eclipse.tm.tcf.services.IProcesses;
import org.eclipse.tm.tcf.services.IRunControl;
import org.eclipse.tm.tcf.services.ISymbols;
import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
@@ -1114,13 +1115,19 @@ public class TCFNodeExecContext extends TCFNode implements ISymbolOwner {
return true;
}
- public void refresh(IViewPart view) {
- last_children_list = null;
- last_children_state_info = null;
- last_stack_trace = null;
- last_label = null;
- last_image = null;
- super.refresh(view);
+ @Override
+ public void refresh(IWorkbenchPart part) {
+ if (part instanceof IMemoryRenderingSite) {
+ model.onMemoryChanged(id, false);
+ }
+ else {
+ last_children_list = null;
+ last_children_state_info = null;
+ last_stack_trace = null;
+ last_label = null;
+ last_image = null;
+ super.refresh(part);
+ }
}
void postAllChangedDelta() {

Back to the top