Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Chuong2012-01-05 16:23:02 +0000
committerPatrick Chuong2012-01-05 16:23:02 +0000
commit11995a20bec093f7023d756a4115f84b1517229c (patch)
treeb4068e5f7a4fa920cbefad46cb10bcb9c46b2e08
parent545ae7e7f93755193100fad2995449e80573776b (diff)
downloadorg.eclipse.cdt-11995a20bec093f7023d756a4115f84b1517229c.tar.gz
org.eclipse.cdt-11995a20bec093f7023d756a4115f84b1517229c.tar.xz
org.eclipse.cdt-11995a20bec093f7023d756a4115f84b1517229c.zip
Bug 364405 - [disassembly] Multiple instruction pointers
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/AbstractDisassemblyBackend.java10
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyBackend.java9
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyDocument.java7
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java37
4 files changed, 55 insertions, 8 deletions
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 8efc39bfd21..f4e3e396585 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) 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2011, 2012 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
@@ -10,6 +10,7 @@
* Freescale Semiconductor - refactoring
* Patrick Chuong (Texas Instruments) - Bug 329682
* Patrick Chuong (Texas Instruments) - Bug 353351
+ * Patrick Chuong (Texas Instruments) - Bug 364405
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
@@ -17,6 +18,7 @@ import java.math.BigInteger;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.text.source.IAnnotationModel;
public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend {
@@ -63,4 +65,10 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
}
});
}
+
+ /**
+ * Do nothing, sub-class can override to update PC annotation.
+ */
+ public void updateExtendedPCAnnotation(IAnnotationModel model) {
+ }
}
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 456733d540e..d89e3f57012 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, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2012 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
@@ -8,6 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
* Freescale Semiconductor - refactoring
+ * Patrick Chuong (Texas Instruments) - Bug 364405
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
@@ -15,6 +16,7 @@ import java.math.BigInteger;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.IAnnotationModel;
/**
* This is the main interface that connects the DSF Disassembly view to CDI and
@@ -191,4 +193,9 @@ public interface IDisassemblyBackend {
* Called when the Disassembly view has no further use for this backend.
*/
void dispose();
+
+ /**
+ * Update the extended PC annotation.
+ */
+ void updateExtendedPCAnnotation(IAnnotationModel model);
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyDocument.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyDocument.java
index 3266ccb8469..b8913cb33db 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyDocument.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyDocument.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2010, 2012 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
@@ -8,6 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
* Freescale Semiconductor - refactoring
+ * Patrick Chuong (Texas Instruments) - Bug 364405
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
@@ -35,4 +36,8 @@ public interface IDisassemblyDocument {
BigInteger address, int length, String functionOffset, BigInteger opcode,
String instruction, String compilationPath, int lineNumber)
throws BadLocationException;
+
+ AddressRangePosition getDisassemblyPosition(BigInteger address);
+ BigInteger getAddressOfLine(int line);
+ int getNumberOfLines();
}
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 275588b02d8..086a186bff3 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, 2011 Wind River Systems and others.
+ * Copyright (c) 2007, 2012 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
@@ -7,10 +7,11 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * Patrick Chuong (Texas Instruments) - Bug fix (326670)
- * Patrick Chuong (Texas Instruments) - Bug fix (329682)
- * Patrick Chuong (Texas Instruments) - bug fix (330259)
+ * Patrick Chuong (Texas Instruments) - Bug 326670
+ * Patrick Chuong (Texas Instruments) - Bug 329682
+ * Patrick Chuong (Texas Instruments) - bug 330259
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
+ * Patrick Chuong (Texas Instruments) - Bug 364405
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
@@ -56,6 +57,7 @@ import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocume
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.SourceFileInfo;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation.DisassemblyIPAnnotation;
+import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyAnnotationModel;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyViewer;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblyPart;
@@ -196,6 +198,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* Annotation model attachment key for breakpoint annotations.
*/
private final static String BREAKPOINT_ANNOTATIONS= "breakpoints"; //$NON-NLS-1$
+
+ /**
+ * Annotation model attachment key for extended PC annotations.
+ */
+ private final static String EXTENDED_PC_ANNOTATIONS = "ExtendedPCAnnotations"; //$NON-NLS-1$
private final static BigInteger PC_UNKNOWN = BigInteger.valueOf(-1);
private final static BigInteger PC_RUNNING = BigInteger.valueOf(-2);
@@ -354,6 +361,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private Action fJumpToAddressAction = new JumpToAddressAction(this);
private IDebugContextListener fDebugContextListener;
+ private DisassemblyAnnotationModel fExtPCAnnotationModel;
private IColumnSupport fColumnSupport;
@@ -1849,7 +1857,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fDebugSessionId = null;
boolean needUpdate = false;
if (context != null) {
- if (prevBackend != null && prevBackend.supportsDebugContext(context)) {
+ IDisassemblyBackend contextBackend = (IDisassemblyBackend)context.getAdapter(IDisassemblyBackend.class);
+ // Need to compare the backend classes to prevent reusing the same backend object.
+ // sub class can overwrite the standard disassembly backend to provide its own customization.
+ if ((prevBackend != null) && (contextBackend != null) && prevBackend.getClass().equals(contextBackend.getClass()) && prevBackend.supportsDebugContext(context)) {
newBackend = prevBackend;
} else {
needUpdate = true;
@@ -1957,6 +1968,15 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
firePropertyChange(PROP_SUSPENDED);
}
+ private void attachExtendedPCAnnotationModel() {
+ IAnnotationModel annotationModel = fViewer.getAnnotationModel();
+ if (annotationModel instanceof IAnnotationModelExtension) {
+ IAnnotationModelExtension ame= (IAnnotationModelExtension) annotationModel;
+ fExtPCAnnotationModel = new DisassemblyAnnotationModel();
+ ame.addAnnotationModel(EXTENDED_PC_ANNOTATIONS, fExtPCAnnotationModel);
+ }
+ }
+
private void attachBreakpointsAnnotationModel() {
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
if (annotationModel instanceof IAnnotationModelExtension) {
@@ -2030,6 +2050,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private void resetViewer() {
// clear all state and cache
+ fExtPCAnnotationModel = null;
fPCAnnotationUpdatePending = false;
fGotoFramePending = false;
fPCAddress = fFrameAddress = PC_RUNNING;
@@ -2044,6 +2065,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fViewer.setDocument(fDocument, new AnnotationModel());
if (fDebugSessionId != null) {
attachBreakpointsAnnotationModel();
+ attachExtendedPCAnnotationModel();
fDocument.insertInvalidAddressRange(0, 0, fStartAddress, fEndAddress);
}
}
@@ -2457,6 +2479,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
pos = updateAddressAnnotation(fSecondaryPCAnnotation, fFrameAddress);
}
fPCAnnotationUpdatePending = pos == null && fFrameAddress.compareTo(BigInteger.ZERO) >= 0;
+
+ if (fExtPCAnnotationModel != null) {
+ fBackend.updateExtendedPCAnnotation(fExtPCAnnotationModel);
+ }
+
return pos;
}

Back to the top