mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Contributing new disassembly.
This commit is contained in:
parent
b20ba9eac9
commit
35dfb7a9a9
12 changed files with 215 additions and 13 deletions
|
@ -116,6 +116,13 @@ OpenDisassembly.label = Open Disassembly
|
||||||
OpenDisassembly.tooltip = Open disassembly window
|
OpenDisassembly.tooltip = Open disassembly window
|
||||||
DisassemblyEditor.name = Disassembly
|
DisassemblyEditor.name = Disassembly
|
||||||
DisassemblyRendering.name = Disassembly
|
DisassemblyRendering.name = Disassembly
|
||||||
|
|
||||||
|
DisassemblyDisplayMode.name = Disassembly Display Mode
|
||||||
|
DisassemblyDisplayMode.description = Disassembly display mode
|
||||||
|
InstructionsDisplayMode.label = Show Instructions
|
||||||
|
InstructionsDisplayMode.tooltip = Show disassembly instructions
|
||||||
|
SourceDisplayMode.label = Show Source
|
||||||
|
SourceDisplayMode.tooltip = Show source code
|
||||||
# new disassembly (end)
|
# new disassembly (end)
|
||||||
|
|
||||||
DebugTextHover.label=Debugger
|
DebugTextHover.label=Debugger
|
||||||
|
|
|
@ -1560,6 +1560,19 @@
|
||||||
id="org.eclipse.cdt.debug.ui.command.openDisassembly"
|
id="org.eclipse.cdt.debug.ui.command.openDisassembly"
|
||||||
name="%OpenDisassembly.name">
|
name="%OpenDisassembly.name">
|
||||||
</command>
|
</command>
|
||||||
|
<command
|
||||||
|
categoryId="org.eclipse.cdt.debug.ui.category.disassembly"
|
||||||
|
defaultHandler="org.eclipse.cdt.debug.internal.ui.disassembly.commands.DisassemblyDisplayModeHandler"
|
||||||
|
description="%DisassemblyDisplayMode.description"
|
||||||
|
helpContextId="disassembly_display_mode_command_context"
|
||||||
|
id="org.eclipse.cdt.debug.command.disassemblyDisplayMode"
|
||||||
|
name="%DisassemblyDisplayMode.name">
|
||||||
|
<commandParameter
|
||||||
|
id="org.eclipse.cdt.debug.command.disassemblyDisplayMode.parameterMode"
|
||||||
|
name="displayMode"
|
||||||
|
optional="false">
|
||||||
|
</commandParameter>
|
||||||
|
</command>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.menus">
|
point="org.eclipse.ui.menus">
|
||||||
|
@ -1584,6 +1597,33 @@
|
||||||
</visibleWhen>
|
</visibleWhen>
|
||||||
</command>
|
</command>
|
||||||
</menuContribution>
|
</menuContribution>
|
||||||
|
<menuContribution
|
||||||
|
locationURI="popup:#DisassemblyEditorContext?after=additions">
|
||||||
|
<command
|
||||||
|
commandId="org.eclipse.cdt.debug.command.disassemblyDisplayMode"
|
||||||
|
helpContextId="instructions_display_mode_menu_context"
|
||||||
|
id="org.eclipse.cdt.debug.menu.command.disassemblyDisplayMode.instructions"
|
||||||
|
label="%InstructionsDisplayMode.label"
|
||||||
|
style="toggle"
|
||||||
|
tooltip="%InstructionsDisplayMode.tooltip">
|
||||||
|
<parameter
|
||||||
|
name="org.eclipse.cdt.debug.command.disassemblyDisplayMode.parameterMode"
|
||||||
|
value="instructions">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="org.eclipse.cdt.debug.command.disassemblyDisplayMode"
|
||||||
|
helpContextId="source_display_mode_menu_context"
|
||||||
|
id="org.eclipse.cdt.debug.menu.command.disassemblyDisplayMode.source"
|
||||||
|
label="%SourceDisplayMode.label"
|
||||||
|
style="toggle"
|
||||||
|
tooltip="%SourceDisplayMode.tooltip">
|
||||||
|
<parameter
|
||||||
|
name="org.eclipse.cdt.debug.command.disassemblyDisplayMode.parameterMode"
|
||||||
|
value="source">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -73,4 +73,11 @@ public interface IInternalCDebugUIConstants {
|
||||||
* Status code indicating an unexpected internal error.
|
* Status code indicating an unexpected internal error.
|
||||||
*/
|
*/
|
||||||
public static final int INTERNAL_ERROR = 150;
|
public static final int INTERNAL_ERROR = 150;
|
||||||
|
|
||||||
|
// new disassembly (start)
|
||||||
|
|
||||||
|
public static final String DISASM_DISPLAY_MODE_INSTRUCTIONS = "instructions"; //$NON-NLS-1$
|
||||||
|
public static final String DISASM_DISPLAY_MODE_SOURCE = "source"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// new disassembly (end)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.commands;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorInput;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorPresentation;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.ui.commands.IElementUpdater;
|
||||||
|
import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
|
import org.eclipse.ui.menus.UIElement;
|
||||||
|
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||||
|
|
||||||
|
public class DisassemblyDisplayModeHandler extends AbstractHandler implements IElementUpdater {
|
||||||
|
|
||||||
|
private static final String ID_PARAMETER_MODE = "org.eclipse.cdt.debug.command.disassemblyDisplayMode.parameterMode"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private boolean fShowInstructions = false;
|
||||||
|
private boolean fShowSource = false;
|
||||||
|
|
||||||
|
public DisassemblyDisplayModeHandler() {
|
||||||
|
super();
|
||||||
|
fShowInstructions = CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS );
|
||||||
|
fShowSource = CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Object execute( ExecutionEvent event ) throws ExecutionException {
|
||||||
|
DisassemblyEditorPresentation presentation = getEditorPresentation( event );
|
||||||
|
if ( presentation != null ) {
|
||||||
|
String param = event.getParameter( ID_PARAMETER_MODE );
|
||||||
|
if ( IInternalCDebugUIConstants.DISASM_DISPLAY_MODE_INSTRUCTIONS.equals( param ) ) {
|
||||||
|
fShowInstructions = !fShowInstructions;
|
||||||
|
presentation.setShowIntstructions( fShowInstructions );
|
||||||
|
}
|
||||||
|
else if ( IInternalCDebugUIConstants.DISASM_DISPLAY_MODE_SOURCE.equals( param ) ) {
|
||||||
|
fShowSource = !fShowSource;
|
||||||
|
presentation.setShowSource( fShowSource );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.commands.IElementUpdater#updateElement(org.eclipse.ui.menus.UIElement, java.util.Map)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void updateElement( UIElement element, Map parameters ) {
|
||||||
|
String param = (String)parameters.get( ID_PARAMETER_MODE );
|
||||||
|
if ( IInternalCDebugUIConstants.DISASM_DISPLAY_MODE_INSTRUCTIONS.equals( param ) ) {
|
||||||
|
element.setChecked( fShowInstructions );
|
||||||
|
}
|
||||||
|
else if ( IInternalCDebugUIConstants.DISASM_DISPLAY_MODE_SOURCE.equals( param ) ) {
|
||||||
|
element.setChecked( fShowSource );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DisassemblyEditorPresentation getEditorPresentation( ExecutionEvent event ) throws ExecutionException {
|
||||||
|
ISelection s = HandlerUtil.getActiveMenuEditorInputChecked( event );
|
||||||
|
if ( s instanceof IStructuredSelection ) {
|
||||||
|
Object o = ((IStructuredSelection)s).getFirstElement();
|
||||||
|
if ( o instanceof DisassemblyEditorInput ) {
|
||||||
|
IDocumentProvider dp = CDebugUIPlugin.getDefault().getDisassemblyEditorManager().getDocumentProvider();
|
||||||
|
if ( dp instanceof DisassemblyDocumentProvider ) {
|
||||||
|
return (DisassemblyEditorPresentation)((DisassemblyDocumentProvider)dp).getDocumentPresentation( o );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -49,7 +49,7 @@ public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusa
|
||||||
|
|
||||||
public DisassemblyEditor() {
|
public DisassemblyEditor() {
|
||||||
super();
|
super();
|
||||||
fDisassemblyPane = new DisassemblyPane();
|
fDisassemblyPane = new DisassemblyPane( "#DisassemblyEditorContext", "#DisassemblyEditorRulerContext" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
|
||||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -45,7 +46,6 @@ import org.eclipse.ui.progress.UIJob;
|
||||||
|
|
||||||
public class DisassemblyEditorManager implements IWindowListener, IDisassemblyContextListener, IPartListener2 {
|
public class DisassemblyEditorManager implements IWindowListener, IDisassemblyContextListener, IPartListener2 {
|
||||||
|
|
||||||
private static final String DEFAULT_EDITOR_ID = "org.eclipse.cdt.debug.ui.disassemblyEditor"; //$NON-NLS-1$
|
|
||||||
private Map<Object, IEditorPart> fEditorParts;
|
private Map<Object, IEditorPart> fEditorParts;
|
||||||
private Map<Object, String> fOpenDisassemblyPolicy;
|
private Map<Object, String> fOpenDisassemblyPolicy;
|
||||||
private Map<Object, ISteppingModeTarget> fSteppingModePolicy;
|
private Map<Object, ISteppingModeTarget> fSteppingModePolicy;
|
||||||
|
@ -278,7 +278,7 @@ public class DisassemblyEditorManager implements IWindowListener, IDisassemblyCo
|
||||||
|
|
||||||
private boolean isDisassemblyEditorPart( IWorkbenchPartReference partRef ) {
|
private boolean isDisassemblyEditorPart( IWorkbenchPartReference partRef ) {
|
||||||
// TODO: check all editors contributed via the extension point
|
// TODO: check all editors contributed via the extension point
|
||||||
return ( partRef.getId().equals( DEFAULT_EDITOR_ID ) );
|
return ( partRef.getId().equals( ICDebugUIConstants.ID_DEFAULT_DISASSEMBLY_EDITOR ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISourcePresentation getSourcePresentation() {
|
private ISourcePresentation getSourcePresentation() {
|
||||||
|
@ -291,7 +291,7 @@ public class DisassemblyEditorManager implements IWindowListener, IDisassemblyCo
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEditorId( IEditorInput input, Object element ) {
|
public String getEditorId( IEditorInput input, Object element ) {
|
||||||
return DEFAULT_EDITOR_ID;
|
return ICDebugUIConstants.ID_DEFAULT_DISASSEMBLY_EDITOR;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.editor;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
||||||
|
import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation;
|
||||||
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyEditorPresentation:
|
||||||
|
* //TODO Add description.
|
||||||
|
*/
|
||||||
|
public class DisassemblyEditorPresentation extends PresentationContext implements IDocumentPresentation {
|
||||||
|
|
||||||
|
private boolean fShowIntstructions = true;
|
||||||
|
private boolean fShowSource = false;
|
||||||
|
|
||||||
|
public DisassemblyEditorPresentation() {
|
||||||
|
super( ICDebugUIConstants.ID_DEFAULT_DISASSEMBLY_EDITOR );
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showIntstructions() {
|
||||||
|
return fShowIntstructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowIntstructions( boolean showIntstructions ) {
|
||||||
|
fShowIntstructions = showIntstructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showSource() {
|
||||||
|
return fShowSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowSource( boolean showSource ) {
|
||||||
|
fShowSource = showSource;
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ public class DisassemblyMemoryRendering extends AbstractMemoryRendering {
|
||||||
|
|
||||||
public DisassemblyMemoryRendering( String renderingId ) {
|
public DisassemblyMemoryRendering( String renderingId ) {
|
||||||
super( renderingId );
|
super( renderingId );
|
||||||
fDisassemblyPane = new DisassemblyPane();
|
fDisassemblyPane = new DisassemblyPane( "#DisassemblyRenderingContext", "#DisassemblyRenderingRulerContext" ); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorInput;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorInput;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorPresentation;
|
||||||
import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation;
|
import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
@ -214,6 +215,6 @@ public class DisassemblyDocumentProvider implements IDocumentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDocumentPresentation createDocumentPresentation( Object context ) {
|
private IDocumentPresentation createDocumentPresentation( Object context ) {
|
||||||
return null;
|
return new DisassemblyEditorPresentation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,10 +89,10 @@ public class DisassemblyPane implements IPropertyChangeListener {
|
||||||
|
|
||||||
private Map<String, IAction> fActions = new HashMap<String, IAction>( 10 );
|
private Map<String, IAction> fActions = new HashMap<String, IAction>( 10 );
|
||||||
|
|
||||||
public DisassemblyPane() {
|
public DisassemblyPane( String contextMenuId, String rulerMenuId ) {
|
||||||
fAnnotationPreferences = new MarkerAnnotationPreferences();
|
fAnnotationPreferences = new MarkerAnnotationPreferences();
|
||||||
setViewContextMenuId( "#DisassemblyViewContext" ); //$NON-NLS-1$
|
setViewContextMenuId( contextMenuId );
|
||||||
setRulerContextMenuId( "#DisassemblyEditorRulerContext" ); //$NON-NLS-1$
|
setRulerContextMenuId( rulerMenuId );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create( Composite parent ) {
|
public void create( Composite parent ) {
|
||||||
|
|
|
@ -35,4 +35,8 @@ public interface ICDebugPreferenceConstants {
|
||||||
* Boolean preference controlling whether primitive types types display char values.
|
* Boolean preference controlling whether primitive types types display char values.
|
||||||
*/
|
*/
|
||||||
public static final String PREF_SHOW_CHAR_VALUES = ICDebugUIConstants.PLUGIN_ID + ".cDebug.showCharValues"; //$NON-NLS-1$
|
public static final String PREF_SHOW_CHAR_VALUES = ICDebugUIConstants.PLUGIN_ID + ".cDebug.showCharValues"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final String PREF_DISASM_SHOW_INSTRUCTIONS = ICDebugUIConstants.PLUGIN_ID + ".disassembly.showInstructions"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public static final String PREF_DISASM_SHOW_SOURCE = ICDebugUIConstants.PLUGIN_ID + ".disassembly.showSource"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,15 @@ public interface ICDebugUIConstants {
|
||||||
*/
|
*/
|
||||||
public static final String ID_EXECUTABLES_VIEW = PREFIX + "executablesView"; //$NON-NLS-1$
|
public static final String ID_EXECUTABLES_VIEW = PREFIX + "executablesView"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disassembly view identifier (value <code>"org.eclipse.cdt.debug.ui.DisassemblyView"</code>).
|
* Disassembly view identifier (value <code>"org.eclipse.cdt.debug.ui.DisassemblyView"</code>).
|
||||||
*/
|
*/
|
||||||
public static final String ID_DISASSEMBLY_VIEW = PREFIX + "DisassemblyView"; //$NON-NLS-1$
|
public static final String ID_DISASSEMBLY_VIEW = PREFIX + "DisassemblyView"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deafult disassembly editor identifier (value <code>"org.eclipse.cdt.debug.ui.disassemblyEditor"</code>).
|
||||||
|
*/
|
||||||
|
public static final String ID_DEFAULT_DISASSEMBLY_EDITOR = PREFIX + "disassemblyEditor"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Id for the popup menu associated with the detail (text viewer) part of the Modules view
|
* Id for the popup menu associated with the detail (text viewer) part of the Modules view
|
||||||
|
|
Loading…
Add table
Reference in a new issue