Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2009-02-05 13:59:55 -0500
committerAlena Laskavaia2009-02-05 13:59:55 -0500
commit2315c4b531e0f7ab7dd767d46f617a3e9a8b18b5 (patch)
tree377d13e3879f74a7c451cb06dcdc3432aa266860
parent95c8bc95e15b475f2027deb2cb58cb1616c7a004 (diff)
downloadorg.eclipse.cdt-2315c4b531e0f7ab7dd767d46f617a3e9a8b18b5.tar.gz
org.eclipse.cdt-2315c4b531e0f7ab7dd767d46f617a3e9a8b18b5.tar.xz
org.eclipse.cdt-2315c4b531e0f7ab7dd767d46f617a3e9a8b18b5.zip
- extensibility for disassemblyv200902060802
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java40
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java10
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java2
3 files changed, 51 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java
index 316f72135f..23fc5c7dc9 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java
@@ -97,6 +97,46 @@ public class Disassembly extends CDebugElement implements IDisassembly, ICDIEven
}
return null;
}
+
+ public IDisassemblyBlock getDisassemblyBlock( IAddress address ) throws DebugException {
+ fBlocks[0] = createBlock( address, null);
+ return fBlocks[0];
+ }
+
+ public IDisassemblyBlock getDisassemblyBlock( IAddress startAddress, IAddress endAddress ) throws DebugException {
+ fBlocks[0] = createBlock( startAddress, endAddress );
+ return fBlocks[0];
+ }
+
+ private DisassemblyBlock createBlock( IAddress startAddress, IAddress endAddress) throws DebugException {
+ ICDITarget target = (ICDITarget)getDebugTarget().getAdapter( ICDITarget.class );
+ if ( target != null ) {
+ ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0];
+ if ( mixedInstrs.length == 0 ||
+ !containsAddress( mixedInstrs, startAddress ) ) {
+ try {
+ BigInteger startAddr = new BigInteger( startAddress.toString() );
+ BigInteger endAddr = null;
+ if (endAddress != null) {
+ endAddr = new BigInteger( endAddress.toString() );
+ } else {
+ endAddr = startAddr.add( BigInteger.valueOf(
+ CDebugCorePlugin.getDefault().getPluginPreferences().getInt(ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS)));
+ }
+ mixedInstrs = target.getMixedInstructions( startAddr, endAddr);
+ return DisassemblyBlock.create( this, mixedInstrs );
+ }
+ catch( CDIException e ) {
+ targetRequestFailed( e.getMessage(), e );
+ }
+ }
+ else {
+ return DisassemblyBlock.create( this, mixedInstrs );
+ }
+ }
+ return null;
+ }
+
private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) {
for( int i = 0; i < mi.length; ++i ) {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java
index 35f50d391c..8688250eac 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java
@@ -226,6 +226,9 @@ public class DisassemblyEditorInput implements IEditorInput {
return input;
}
+ public static DisassemblyEditorInput create( IDisassemblyBlock block) throws DebugException {
+ return new DisassemblyEditorInput(block);
+ }
private void createContents() {
fSourceRegions = new IRegion[0];
StringBuffer lines = new StringBuffer();
@@ -320,6 +323,13 @@ public class DisassemblyEditorInput implements IEditorInput {
return ( fBlock != null ) ? fBlock.getDisassembly() : null;
}
+ /**
+ * @return the disassembly block
+ */
+ public IDisassemblyBlock getDisassemblyBlock() {
+ return fBlock;
+ }
+
public ICLineBreakpoint breakpointExists( IAddress address ) throws CoreException {
Assert.isTrue( address != null );
IDisassembly dis = getDisassembly();
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java
index e3e31cf5e8..0327f4dfea 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java
@@ -438,7 +438,7 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
resetViewerInput();
}
- protected void setViewerInput( IEditorInput input ) {
+ public void setViewerInput( IEditorInput input ) {
SourceViewer viewer = getSourceViewer();
if ( viewer == null )
return;

Back to the top