diff options
author | Mikhail Khodjaiants | 2008-04-04 16:39:42 +0000 |
---|---|---|
committer | Mikhail Khodjaiants | 2008-04-04 16:39:42 +0000 |
commit | af3f69afb9ed7804041fdb5d405c411ac22cfd4e (patch) | |
tree | f43ce5066078b8f315f86c24aca7a5be54cf5aad /debug | |
parent | 5297a903b036d28bc5cef4227a0013dab1793093 (diff) | |
download | org.eclipse.cdt-af3f69afb9ed7804041fdb5d405c411ac22cfd4e.tar.gz org.eclipse.cdt-af3f69afb9ed7804041fdb5d405c411ac22cfd4e.tar.xz org.eclipse.cdt-af3f69afb9ed7804041fdb5d405c411ac22cfd4e.zip |
Contributing new disassembly.
Diffstat (limited to 'debug')
8 files changed, 220 insertions, 16 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index fc3e783e1e8..ad3b46faef5 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -107,6 +107,17 @@ DisassemblySourceLineColor.description=The color used in the Disassembly view fo DisassemblyFontDefinition.label=Disassembly View Text Font DisassemblyFontDefinition.description=The text font used in the Disassembly view. +# new disassembly +DisassemblyCategory.name = Disassembly +DisassemblyCategory.description = Category for disassembly commands +OpenDisassembly.name = Open Disassembly +OpenDisassembly.description = Open disassembly window +OpenDisassembly.label = Open Disassembly +OpenDisassembly.tooltip = Open disassembly window +DisassemblyEditor.name = Disassembly +DisassemblyRendering.name = Disassembly +# new disassembly (end) + DebugTextHover.label=Debugger DebugTextHover.description=Shows the value of the expression selected in the debug perspective. diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index fefe0c25d0c..14eaf08422a 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -1274,6 +1274,9 @@ <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider"/> <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory"/> <adapter type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider"/> + <adapter + type="org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider"> + </adapter> </factory> <factory adaptableType="org.eclipse.cdt.debug.core.model.ICModule" @@ -1376,11 +1379,16 @@ <renderingBindings defaultIds="org.eclipse.debug.ui.rendering.raw_memory" primaryId="org.eclipse.debug.ui.rendering.raw_memory" - renderingIds="org.eclipse.debug.ui.rendering.raw_memory,org.eclipse.debug.ui.rendering.ascii,org.eclipse.debug.ui.rendering.signedint,org.eclipse.debug.ui.rendering.unsignedint"> + renderingIds="org.eclipse.debug.ui.rendering.raw_memory,org.eclipse.debug.ui.rendering.ascii,org.eclipse.debug.ui.rendering.signedint,org.eclipse.debug.ui.rendering.unsignedint,org.eclipse.cdt.debug.ui.rendering.disassembly"> <enablement> <instanceof value="org.eclipse.cdt.debug.internal.core.model.CMemoryBlockExtension"/> </enablement> </renderingBindings> + <renderingType + class="org.eclipse.cdt.debug.internal.ui.disassembly.rendering.DisassemblyRenderingTypeDelegate" + id="org.eclipse.cdt.debug.ui.rendering.disassembly" + name="%DisassemblyRendering.name"> + </renderingType> </extension> <extension point="org.eclipse.debug.ui.sourceContainerPresentations"> @@ -1434,6 +1442,13 @@ class="org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditor" id="org.eclipse.cdt.debug.ui.SourceNotFoundEditor"> </editor> + <editor + class="org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor" + default="false" + icon="icons/obj16/disassembly_obj.gif" + id="org.eclipse.cdt.debug.ui.disassemblyEditor" + name="%DisassemblyEditor.name"> + </editor> </extension> <!-- Breakpoint Action UI --> <extension @@ -1530,5 +1545,45 @@ </enablement> </detailFactories> </extension> + <extension + point="org.eclipse.ui.commands"> + <category + description="%DisassemblyCategory.description" + id="org.eclipse.cdt.debug.ui.category.disassembly" + name="%DisassemblyCategory.name"> + </category> + <command + categoryId="org.eclipse.cdt.debug.ui.category.disassembly" + defaultHandler="org.eclipse.cdt.debug.internal.ui.disassembly.commands.OpenDisassemblyHandler" + description="%OpenDisassembly.description" + helpContextId="open_disassembly_context" + id="org.eclipse.cdt.debug.ui.command.openDisassembly" + name="%OpenDisassembly.name"> + </command> + </extension> + <extension + point="org.eclipse.ui.menus"> + <menuContribution + locationURI="popup:org.eclipse.debug.ui.DebugView?after=launchGroup"> + <command + commandId="org.eclipse.cdt.debug.ui.command.openDisassembly" + disabledIcon="icons/dlcl16/disassembly.gif" + hoverIcon="icons/elcl16/disassembly.gif" + icon="icons/elcl16/disassembly.gif" + id="org.eclipse.cdt.debug.ui.menu.openDisassembly" + label="%OpenDisassembly.label" + style="push" + tooltip="%OpenDisassembly.tooltip"> + <visibleWhen + checkEnabled="false"> + <iterate> + <adapt + type="org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider"> + </adapt> + </iterate> + </visibleWhen> + </command> + </menuContribution> + </extension> </plugin> diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorManager.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorManager.java index 8aa0179866f..c10d3159185 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorManager.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorManager.java @@ -45,7 +45,7 @@ import org.eclipse.ui.progress.UIJob; public class DisassemblyEditorManager implements IWindowListener, IDisassemblyContextListener, IPartListener2 { - private static final String DEFAULT_EDITOR_ID = "com.arm.eclipse.rvd.ui.disassemblyEditor"; //$NON-NLS-1$ + private static final String DEFAULT_EDITOR_ID = "org.eclipse.cdt.debug.ui.disassemblyEditor"; //$NON-NLS-1$ private Map<Object, IEditorPart> fEditorParts; private Map<Object, String> fOpenDisassemblyPolicy; private Map<Object, ISteppingModeTarget> fSteppingModePolicy; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java new file mode 100644 index 00000000000..5a575bcca02 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java @@ -0,0 +1,102 @@ +/******************************************************************************* + * Copyright (c) 2008 ARM Limited 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: + * ARM Limited - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; + +import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider; +import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane; +import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument; +import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualSourceViewer; +import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyAnnotationModel; +import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.debug.core.model.IMemoryBlock; +import org.eclipse.debug.ui.memory.AbstractMemoryRendering; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class DisassemblyMemoryRendering extends AbstractMemoryRendering { + + protected SashForm fSashForm; + protected DisassemblyPane fDisassemblyPane; + + public DisassemblyMemoryRendering( String renderingId ) { + super( renderingId ); + fDisassemblyPane = new DisassemblyPane(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite) + */ + public Control createControl( Composite parent ) { + Composite composite = new Composite( parent, SWT.BORDER ); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + composite.setLayout( layout ); + composite.setLayoutData( new GridData( GridData.FILL_BOTH ) ); + createViewer( composite ); + return composite; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.memory.IMemoryRendering#getControl() + */ + public Control getControl() { + return fDisassemblyPane.getControl(); + } + + protected VirtualSourceViewer getViewer() { + return fDisassemblyPane.getViewer(); + } + + protected void createViewer( final Composite parent ) { + fSashForm = new SashForm( parent, SWT.VERTICAL ); + fSashForm.setLayoutData( new GridData( GridData.FILL_BOTH ) ); + + fDisassemblyPane.create( fSashForm ); + +// createGoToAddressComposite( fSashForm ); +// hideGotoAddressComposite(); + + IMemoryBlock memoryBlock = getMemoryBlock(); + IDisassemblyContextProvider contextProvider = getDisassemblyContextProvider( memoryBlock ); + Object disassemblyContext = null; + if ( contextProvider != null ) { + disassemblyContext = contextProvider.getDisassemblyContext( memoryBlock ); + } + DisassemblyAnnotationModel annotationModel = new DisassemblyAnnotationModel(); + VirtualDocument document = new VirtualDocument( annotationModel, getDocumentPresentationContext(), disassemblyContext ); + getViewer().setDocument( document ); + document.getContentProvider().changeInput( getViewer(), document.getPresentationContext(), null, getMemoryBlock(), document.getCurrentOffset() ); + } + + private IDocumentPresentation getDocumentPresentationContext() { + return null; + } + + private IDisassemblyContextProvider getDisassemblyContextProvider( Object element ) { + IDisassemblyContextProvider adapter = null; + if ( element instanceof IDisassemblyContextProvider ) { + adapter = (IDisassemblyContextProvider)element; + } + else if ( element instanceof IAdaptable ) { + IAdaptable adaptable = (IAdaptable)element; + adapter = (IDisassemblyContextProvider)adaptable.getAdapter( IDisassemblyContextProvider.class ); + } + return adapter; + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java new file mode 100644 index 00000000000..d37e296d582 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyRenderingTypeDelegate.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2008 ARM Limited 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: + * ARM Limited - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.ui.memory.IMemoryRendering; +import org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate; + +public class DisassemblyRenderingTypeDelegate implements IMemoryRenderingTypeDelegate { + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate#createRendering(java.lang.String) + */ + public IMemoryRendering createRendering( String id ) throws CoreException { + return new DisassemblyMemoryRendering( id ); + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/DisassemblyDocumentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/DisassemblyDocumentProvider.java index 894e64e2172..db98e12835c 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/DisassemblyDocumentProvider.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/DisassemblyDocumentProvider.java @@ -210,7 +210,7 @@ public class DisassemblyDocumentProvider implements IDocumentProvider { } private VirtualDocument createDocument( Object disassemblyContext, IDocumentPresentation presentationContext, IAnnotationModel annotationModel ) { - return null; + return new VirtualDocument( annotationModel, presentationContext, disassemblyContext ); } private IDocumentPresentation createDocumentPresentation( Object context ) { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/VirtualDocument.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/VirtualDocument.java index ab1f129788b..0bc9ed808a5 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/VirtualDocument.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/viewer/VirtualDocument.java @@ -16,21 +16,21 @@ import java.util.Properties; import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.AnnotationModel; +import org.eclipse.jface.text.source.IAnnotationModel; /** * Converts the model elements into the text content */ -abstract public class VirtualDocument extends Document { +public class VirtualDocument extends Document { private Object fRoot; private int fCurrentOffset = 0; private IDocumentPresentation fPresentationContext; - private AnnotationModel fAnnotationModel; + private IAnnotationModel fAnnotationModel; private DocumentContentProvider fContentProvider; - public VirtualDocument( AnnotationModel annotationModel, IDocumentPresentation presentationContext, Object root ) { + public VirtualDocument( IAnnotationModel annotationModel, IDocumentPresentation presentationContext, Object root ) { super(); fRoot = root; fPresentationContext = presentationContext; @@ -47,7 +47,7 @@ abstract public class VirtualDocument extends Document { return fPresentationContext; } - public AnnotationModel getAnnotationModel() { + public IAnnotationModel getAnnotationModel() { return fAnnotationModel; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java index 352ce28eba9..92246dfaa58 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java @@ -14,11 +14,13 @@ package org.eclipse.cdt.debug.internal.ui.elements.adapters; import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider; import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICModule; import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICThread; import org.eclipse.cdt.debug.core.model.IModuleRetrieval; +import org.eclipse.cdt.debug.internal.core.CDisassemblyContextProvider; import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider; import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider; import org.eclipse.core.runtime.IAdapterFactory; @@ -38,6 +40,8 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { private static IElementMementoProvider fgStackFrameMementoProvider = new CStackFrameMementoProvider(); private static IElementMementoProvider fgModuleMementoProvider = new ModuleMementoProvider(); + private static IDisassemblyContextProvider fgDisassemblyContextProvider = new CDisassemblyContextProvider(); + /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) */ @@ -80,14 +84,19 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { if ( adaptableObject instanceof ICStackFrame ) { return fgStackFrameMementoProvider; } - if ( adaptableObject instanceof IModuleRetrieval || - adaptableObject instanceof ICThread || - adaptableObject instanceof ICModule || - adaptableObject instanceof ICElement) - { - return fgModuleMementoProvider; - } - } + if ( adaptableObject instanceof IModuleRetrieval || + adaptableObject instanceof ICThread || + adaptableObject instanceof ICModule || + adaptableObject instanceof ICElement) + { + return fgModuleMementoProvider; + } + } + if ( adapterType.equals( IDisassemblyContextProvider.class ) ) { + if ( adaptableObject instanceof ICStackFrame ) { + return fgDisassemblyContextProvider; + } + } return null; } @@ -99,6 +108,7 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { IElementContentProvider.class, IModelProxyFactory.class, IElementMementoProvider.class, + IDisassemblyContextProvider.class, }; } } |