Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Tepavich2011-09-16 07:56:50 +0000
committerAnton Leherbauer2011-09-16 07:56:50 +0000
commit9fe6dfee8e88f4ff160c14863f635cf4d8e19816 (patch)
tree4d82c3ff4e9f275090dd63144d65e71240bedd71
parent1f971379691d4b19285fd8ada25959e2c146e4ab (diff)
downloadorg.eclipse.cdt-9fe6dfee8e88f4ff160c14863f635cf4d8e19816.tar.gz
org.eclipse.cdt-9fe6dfee8e88f4ff160c14863f635cf4d8e19816.tar.xz
org.eclipse.cdt-9fe6dfee8e88f4ff160c14863f635cf4d8e19816.zip
Bug 357612 - [disassembly] Missing register tool-tips
-rw-r--r--debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/pom.xml2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java13
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java51
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java37
6 files changed, 91 insertions, 36 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
index 99a17dc184d..f23fbe1a5df 100644
--- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui; singleton:=true
-Bundle-Version: 7.1.0.qualifier
+Bundle-Version: 7.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/debug/org.eclipse.cdt.debug.ui/pom.xml b/debug/org.eclipse.cdt.debug.ui/pom.xml
index 829b9e4aafc..987dbda4231 100644
--- a/debug/org.eclipse.cdt.debug.ui/pom.xml
+++ b/debug/org.eclipse.cdt.debug.ui/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>7.1.0-SNAPSHOT</version>
+ <version>7.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.debug.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java
index a1c266bf5c9..22aa785ba20 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
+ * 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
@@ -29,7 +29,7 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
/**
* Evaluate the expression to an address. This might be the address of a symbol or
* the value of the numeric evaluation depending on the type of the expression.
- *
+ *
* @param expression the expression
* @param suppressError <code>true</code> to suppress error dialogs
* @return the address or <code>null</code> if the expression could not be evaluated
@@ -37,4 +37,13 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
*/
public abstract BigInteger evaluateAddressExpression(String expression, boolean suppressError);
+
+ public String evaluateRegister(String register) {
+ return null;
+ }
+
+ public String getHoverInfoData(AddressRangePosition pos, String ident) {
+ return null;
+ }
+
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java
index ec8b802467b..456733d540e 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 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
@@ -21,8 +21,8 @@ import org.eclipse.jface.text.Position;
* DSF backends. This interface is obtained through IAdaptable. A new instance
* is provided every time the adapter is requested. The caller must invoke
* {@link #dispose()} when it has no further use for the instance.
- *
- * @noimplement This interface is not intended to be implemented by clients.
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
* Clients should extend {@link AbstractDisassemblyBackend}.
*/
public interface IDisassemblyBackend {
@@ -43,16 +43,16 @@ public interface IDisassemblyBackend {
*/
public boolean contextChanged;
}
-
+
/**
- * Called after instantiation
+ * Called after instantiation
* @param callback
*/
void init(IDisassemblyPartCallback callback);
/**
* Indicates whether this backend support the provided debug context,
- *
+ *
* @param context
* the debug context
* @return true if it is supported. Caller should invoke
@@ -60,7 +60,7 @@ public interface IDisassemblyBackend {
* first checking with this method
*/
boolean supportsDebugContext(IAdaptable context);
-
+
/**
* @return whether the backend has a debug context
*/
@@ -70,7 +70,7 @@ public interface IDisassemblyBackend {
* Called by the view when there has been a change to the active debug
* context. Should be called only if
* {@link #supportsDebugContext(IAdaptable)} first returns true.
- *
+ *
* @param context
* the active debug context; must not be null
* @return information about the new context
@@ -84,8 +84,8 @@ public interface IDisassemblyBackend {
/**
* The implementation should end up calling DisassemblyPart.gotoFrame() if
- * targetFrame > 0, or DisassemblyPart.gotoPC() otherwise.
- *
+ * targetFrame > 0, or DisassemblyPart.gotoPC() otherwise.
+ *
* @param targetFrame
* the frame level to retrieve. Level 0 is the topmost frame
* (where the PC is)
@@ -94,7 +94,7 @@ public interface IDisassemblyBackend {
/**
* Get the frame of the current context
- *
+ *
* @return the frame's level; 0 is the topmost frame (i.e., where the PC
* is). -1 if no frame context has been set.
*/
@@ -104,7 +104,7 @@ public interface IDisassemblyBackend {
* Indicates whether the current context is suspended.
*/
boolean isSuspended();
-
+
/**
* Indicates whether the current context is a frame.
*/
@@ -128,7 +128,7 @@ public interface IDisassemblyBackend {
* Retrieves disassembly based on either (a) start and end address range, or
* (b) file, line number, and line count. If the caller specifies both sets
* of information, the implementation should honor (b) and ignore (a).
- *
+ *
* @param startAddress
* @param endAddress
* @param file
@@ -149,7 +149,7 @@ public interface IDisassemblyBackend {
* Retrieves disassembly of the code generated by a source file, starting at
* the first line. Caller specifies the maximum number of disassembly lines
* that should result and a maximum address.
- *
+ *
* @param file
* @param lines
* @param endAddress
@@ -161,13 +161,32 @@ public interface IDisassemblyBackend {
/**
* Evaluate an expression for text hover
- *
+ *
* @param expression
* the expression to be evaluated
* @return the result, or "" if it doesn't resolve, for whatever reason
*/
String evaluateExpression(String expression);
-
+
+ /**
+ * Evaluate a register for text hover
+ *
+ * @param register The register to be evaluated
+ * @return The result, or "" if it doesn't resolve, for whatever reason
+ * @since 7.2
+ */
+ String evaluateRegister(String register);
+
+ /**
+ * Evaluate a position for text hover
+ *
+ * @param pos Disassembly position to evaluate.
+ * @param ident The string found at the given position.
+ * @return the result, or "" if it doesn't resolve, for whatever reason
+ * @since 7.2
+ */
+ String getHoverInfoData(AddressRangePosition pos, String ident);
+
/**
* Called when the Disassembly view has no further use for this backend.
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
index be6f7110962..efe6dcaeadd 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Wind River Systems and others.
+ * Copyright (c) 2007, 2011 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
@@ -3021,6 +3021,26 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
/**
+ * A pass through to process the text to populate into a text hover.
+ */
+ public String getHoverInfoData(AddressRangePosition pos, String ident) {
+ if (fBackend != null ) {
+ return fBackend.getHoverInfoData(pos, ident);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * A passthru from the text hover code to the backend.
+ */
+ public String evaluateRegister(String register) {
+ if (fBackend != null) {
+ return fBackend.evaluateRegister(register);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
* A passthru from the text hover code to the backend.
*/
public String evaluateExpression(String expr) {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java
index 463d947eb9b..81b867f58d4 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Wind River Systems and others.
+ * Copyright (c) 2007, 2011 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
@@ -58,21 +58,29 @@ public class DisassemblyTextHover implements ITextHover {
String ident = doc.get(offset, hoverRegion.getLength());
String value = null;
pos = doc.getModelPosition(offset);
- if (pos instanceof SourcePosition) {
- value = evaluateExpression(ident);
- } else if (pos instanceof LabelPosition) {
- value = evaluateExpression(ident);
- } else if (pos instanceof DisassemblyPosition) {
- // first, try to evaluate as register
- value = evaluateRegister(ident);
- if (value == null) {
- // if this fails, try expression
+
+ value = fDisassemblyPart.getHoverInfoData(pos, ident);
+
+ // If returns null (or empty string), not implemented or something went wrong.
+ if (value == null || value.length() == 0) {
+ if (pos instanceof SourcePosition) {
+ value = evaluateExpression(ident);
+ } else if (pos instanceof LabelPosition) {
value = evaluateExpression(ident);
+ } else if (pos instanceof DisassemblyPosition) {
+ // first, try to evaluate as register
+ value = evaluateRegister(ident);
+ if (value == null) {
+ // if this fails, try expression
+ value = evaluateExpression(ident);
+ }
+ }
+ if (value != null) {
+ return ident + " = " + value; //$NON-NLS-1$
}
}
- if (value != null) {
- return ident + " = " + value; //$NON-NLS-1$
- }
+ else
+ return value;
} catch (BadLocationException e) {
if (DsfUIPlugin.getDefault().isDebugging()) {
DsfUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, "Internal Error", e)); //$NON-NLS-1$
@@ -87,8 +95,7 @@ public class DisassemblyTextHover implements ITextHover {
* @return register value or <code>null</code>
*/
private String evaluateRegister(String register) {
- // TLETODO [disassembly] evaluate register
- return null;
+ return fDisassemblyPart.evaluateRegister(register);
}
/**

Back to the top