diff options
Diffstat (limited to 'debug')
8 files changed, 463 insertions, 21 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index aa9a8ac18e6..2a5f1932ad0 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -126,6 +126,21 @@ InstructionsDisplayMode.tooltip = Show disassembly instructions SourceDisplayMode.label = Show Source SourceDisplayMode.tooltip = Show source code +SteppingMode.name=Stepping Mode +SteppingMode.description=Select Stepping Mode + +SteppingModeMenu.label=Stepping Mode +SteppingModeMenu.tooltip=Select Stepping Mode + +ContextSteppingMode.label=Context +ContextSteppingMode.tooltip=Context Dependent Stepping + +SourceSteppingMode.label=Source +SourceSteppingMode.tooltip=Source Level Stepping + +InstructionSteppingMode.label=Instruction +InstructionSteppingMode.tooltip=Instruction Level Stepping + DisassemblyPreferencePage.name = Disassembly # new disassembly (end) diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 6cfc7b4576f..d649e6fa2be 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -1294,9 +1294,11 @@ <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"/> + <!-- Enable after 5.0 <adapter type="org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider"> </adapter> + --> <adapter type="org.eclipse.cdt.debug.ui.disassembly.IDocumentElementContentProvider"> </adapter> @@ -1502,12 +1504,14 @@ id="org.eclipse.cdt.debug.ui.breakpointactions.ActionsPreferencePage" category="org.eclipse.cdt.debug.ui.CDebugPreferencePage"> </page> + <!-- Enable after 5.0 <page category="org.eclipse.debug.ui.DebugPreferencePage" class="org.eclipse.cdt.debug.internal.ui.preferences.DisassemblyPreferencePage" id="org.eclipse.cdt.debug.ui.disassemblyPreferencePge" name="%DisassemblyPreferencePage.name"> </page> + --> </extension> <extension diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIPreferenceInitializer.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIPreferenceInitializer.java index 3981bedbb8f..eb66a574ccb 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIPreferenceInitializer.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIPreferenceInitializer.java @@ -14,7 +14,6 @@ import org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage; import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.jface.preference.IPreferenceStore; /** @@ -36,7 +35,8 @@ public class CDebugUIPreferenceInitializer extends AbstractPreferenceInitializer public void initializeDefaultPreferences() { IPreferenceStore pstore = CDebugUIPlugin.getDefault().getPreferenceStore(); CDebugPreferencePage.initDefaults( pstore ); - pstore.setDefault( ICDebugPreferenceConstants.PREF_OPEN_DISASSEMBLY_MODE, MessageDialogWithToggle.PROMPT ); + pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_OPEN_NO_SOURCE_INFO, true ); + pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_OPEN_SOURCE_NOT_FOUND, false ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS, true ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE, true ); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/commands/SetSteppingModeHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/commands/SetSteppingModeHandler.java new file mode 100644 index 00000000000..9aabb8dfa09 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/commands/SetSteppingModeHandler.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * 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.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDebugConstants; +import org.eclipse.cdt.debug.core.model.ISteppingModeTarget; +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.core.runtime.IAdaptable; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.menus.UIElement; + +/** + * org.eclipse.cdt.debug.internal.ui.disassembly.commands.SetSteppingModeHandler: + * //TODO Add description. + */ +public class SetSteppingModeHandler extends AbstractHandler implements IElementUpdater { + + private static final String ID_PARAMETER_MODE = "com.arm.eclipse.rvd.ui.command.steppingMode.parameterMode"; //$NON-NLS-1$ + + private String fCurrentValue = null; + + public SetSteppingModeHandler() { + super(); + fCurrentValue = CDebugCorePlugin.getDefault().getPluginPreferences().getString( ICDebugConstants.PREF_STEP_MODE ); + } + + /* (non-Javadoc) + * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute( ExecutionEvent event ) throws ExecutionException { + String param = event.getParameter( ID_PARAMETER_MODE ); + if ( param == null || param.equals( fCurrentValue ) ) + return null; + + fCurrentValue = param; + CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_STEP_MODE, fCurrentValue ); + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked( event ); + ICommandService service = (ICommandService)window.getService( ICommandService.class ); + service.refreshElements( event.getCommand().getId(), null ); + + 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 ( param != null ) { + element.setChecked( ( fCurrentValue != null && fCurrentValue.equals( param ) ) ); + } + } + + /* (non-Javadoc) + * @see org.eclipse.core.commands.AbstractHandler#isEnabled() + */ + @Override + public boolean isEnabled() { + IWorkbenchWindow window = CDebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); + return ( window != null && getSteppingModeTarget( window ) != null ); + } + + /* (non-Javadoc) + * @see org.eclipse.core.commands.AbstractHandler#isHandled() + */ + @Override + public boolean isHandled() { + IWorkbenchWindow window = CDebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); + return ( window != null && getSteppingModeTarget( window ) != null ); + } + + private ISteppingModeTarget getSteppingModeTarget( IWorkbenchWindow window ) { + ISelection selection = DebugUITools.getDebugContextManager().getContextService( window ).getActiveContext(); + if ( selection instanceof IStructuredSelection ) { + Object element = ((IStructuredSelection)selection).getFirstElement(); + if ( element instanceof IAdaptable ) + return (ISteppingModeTarget)((IAdaptable)element).getAdapter( ISteppingModeTarget.class ); + } + return null; + } +} 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 d2c2bdd3a51..cd0392f9964 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 @@ -23,6 +23,7 @@ import org.eclipse.cdt.debug.core.model.IDisassemblyLine; import org.eclipse.cdt.debug.core.model.IModuleRetrieval; import org.eclipse.cdt.debug.internal.core.CDisassemblyContextProvider; import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval; +import org.eclipse.cdt.debug.internal.ui.sourcelookup.SourceDisplayAdapter; import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleContentProvider; import org.eclipse.cdt.debug.internal.ui.views.modules.ModuleMementoProvider; import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementAnnotationProvider; @@ -33,6 +34,7 @@ import org.eclipse.core.runtime.IAdapterFactory; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider; import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory; +import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; public class CDebugElementAdapterFactory implements IAdapterFactory { @@ -51,6 +53,7 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { private static IDocumentElementLabelProvider fgDisassemblyLabelProvider = new DisassemblyElementLabelProvider(); private static IDocumentElementAnnotationProvider fgDisassemblyAnnotationProvider = new DisassemblyElementAnnotationProvider(); private static IElementToggleBreakpointAdapter fgDisassemblyToggleBreakpointAdapter = new DisassemblyToggleBreakpointAdapter(); + private static ISourceDisplay fgSourceDisplayAdapter = new SourceDisplayAdapter(); /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) @@ -128,6 +131,11 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { return fgDisassemblyToggleBreakpointAdapter; } } + if ( adapterType.equals( ISourceDisplay.class ) ) { + if ( adaptableObject instanceof ICStackFrame ) { + return fgSourceDisplayAdapter; + } + } return null; } @@ -144,6 +152,7 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { IDocumentElementLabelProvider.class, IDocumentElementAnnotationProvider.class, IElementToggleBreakpointAdapter.class, + ISourceDisplay.class, }; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DisassemblyPreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DisassemblyPreferencePage.java index 684a6552671..d76ce57380f 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DisassemblyPreferencePage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/DisassemblyPreferencePage.java @@ -36,23 +36,27 @@ public class DisassemblyPreferencePage extends FieldEditorPreferencePage impleme */ @Override protected void createFieldEditors() { -/* - addField( new RadioGroupFieldEditor( - ICDebugPreferenceConstants.PREF_OPEN_DISASSEMBLY_MODE, - "Open disassembly if source is not available", - 3, - new String[][] { - { "Always", MessageDialogWithToggle.ALWAYS }, - { "Never", MessageDialogWithToggle.NEVER }, - { "Prompt", MessageDialogWithToggle.PROMPT }, - }, - getFieldEditorParent(), - true ) ); -*/ - Group group = ControlFactory.createGroup( getFieldEditorParent(), "Display settings", 1 ); + Group group = ControlFactory.createGroup( getFieldEditorParent(), "Open disassembly options", 1 ); Composite spacer = ControlFactory.createComposite( group, 1 ); - FieldEditor edit = new BooleanFieldEditor( + ICDebugPreferenceConstants.PREF_DISASM_OPEN_NO_SOURCE_INFO, + "Source information is not available", + spacer ); + edit.fillIntoGrid( spacer, 2 ); + addField( edit ); + + edit = new BooleanFieldEditor( + ICDebugPreferenceConstants.PREF_DISASM_OPEN_SOURCE_NOT_FOUND, + "Source file not found", + spacer ); + edit.fillIntoGrid( spacer, 2 ); + addField( edit ); + + + group = ControlFactory.createGroup( getFieldEditorParent(), "Display settings", 1 ); + spacer = ControlFactory.createComposite( group, 1 ); + + edit = new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS, "Show instructions", spacer ); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java index 832caebfaac..6894fb0af81 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java @@ -27,21 +27,32 @@ public interface ICDebugPreferenceConstants { public static final String PREF_SHOW_FULL_PATHS = ICDebugUIConstants.PLUGIN_ID + ".cDebug.show_full_paths"; //$NON-NLS-1$ /** - * Boolean preference controlling whether primitive types types display hexidecimal values. + * Boolean preference controlling whether primitive types display hexadecimal values. */ public static final String PREF_SHOW_HEX_VALUES = ICDebugUIConstants.PLUGIN_ID + ".cDebug.showHexValues"; //$NON-NLS-1$ /** - * Boolean preference controlling whether primitive types types display char values. + * Boolean preference controlling whether primitive types display char values. */ public static final String PREF_SHOW_CHAR_VALUES = ICDebugUIConstants.PLUGIN_ID + ".cDebug.showCharValues"; //$NON-NLS-1$ + /** + * Boolean preference controlling whether the disassembly instructions is to be shown in the disassembly window. + */ public static final String PREF_DISASM_SHOW_INSTRUCTIONS = ICDebugUIConstants.PLUGIN_ID + ".disassembly.showInstructions"; //$NON-NLS-1$ + /** + * Boolean preference controlling whether the source lines is to be shown in the disassembly window. + */ public static final String PREF_DISASM_SHOW_SOURCE = ICDebugUIConstants.PLUGIN_ID + ".disassembly.showSource"; //$NON-NLS-1$ /** - * Specifies the conditions under which the disassembly editor will be activated + * Boolean preference controlling whether the disassembly editor is be activated if the source information is not available. + */ + public static final String PREF_DISASM_OPEN_NO_SOURCE_INFO = ICDebugUIConstants.PLUGIN_ID + ".disassembly.openNoSourceInfo"; //$NON-NLS-1$ + + /** + * Boolean preference controlling whether the disassembly editor is be activated if the source file can't be found. */ - public static final String PREF_OPEN_DISASSEMBLY_MODE = ICDebugUIConstants.PLUGIN_ID + ".openDisassemblyMode"; //$NON-NLS-1$ + public static final String PREF_DISASM_OPEN_SOURCE_NOT_FOUND = ICDebugUIConstants.PLUGIN_ID + ".disassembly.openSourceNotFound"; //$NON-NLS-1$ } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceDisplayAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceDisplayAdapter.java new file mode 100644 index 00000000000..f0b6a5ba31c --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceDisplayAdapter.java @@ -0,0 +1,295 @@ +/******************************************************************************* + * 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.sourcelookup; + +import org.eclipse.cdt.debug.core.model.ICStackFrame; +import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorManager; +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.model.IDebugTarget; +import org.eclipse.debug.core.model.IRegisterGroup; +import org.eclipse.debug.core.model.IStackFrame; +import org.eclipse.debug.core.model.IThread; +import org.eclipse.debug.core.model.IVariable; +import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.progress.UIJob; + +public class SourceDisplayAdapter implements ISourceDisplay { + + class DelegatingStackFrame implements IStackFrame { + + private ICStackFrame fDelegate; + + DelegatingStackFrame( ICStackFrame delegate ) { + super(); + fDelegate = delegate; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() + */ + public int getCharEnd() throws DebugException { + return fDelegate.getCharEnd(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getCharStart() + */ + public int getCharStart() throws DebugException { + return fDelegate.getCharStart(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() + */ + public int getLineNumber() throws DebugException { + return fDelegate.getLineNumber(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getName() + */ + public String getName() throws DebugException { + return fDelegate.getName(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() + */ + public IRegisterGroup[] getRegisterGroups() throws DebugException { + return fDelegate.getRegisterGroups(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getThread() + */ + public IThread getThread() { + return fDelegate.getThread(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#getVariables() + */ + public IVariable[] getVariables() throws DebugException { + return fDelegate.getVariables(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() + */ + public boolean hasRegisterGroups() throws DebugException { + return fDelegate.hasRegisterGroups(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStackFrame#hasVariables() + */ + public boolean hasVariables() throws DebugException { + return fDelegate.hasVariables(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() + */ + public IDebugTarget getDebugTarget() { + return fDelegate.getDebugTarget(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() + */ + public ILaunch getLaunch() { + return fDelegate.getLaunch(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() + */ + public String getModelIdentifier() { + return fDelegate.getModelIdentifier(); + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) + */ + @SuppressWarnings("unchecked") + public Object getAdapter( Class adapter ) { + if ( ICStackFrame.class.equals( adapter ) ) + return fDelegate; + return fDelegate.getAdapter( adapter ); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#canStepInto() + */ + public boolean canStepInto() { + return fDelegate.canStepInto(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#canStepOver() + */ + public boolean canStepOver() { + return fDelegate.canStepOver(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#canStepReturn() + */ + public boolean canStepReturn() { + return fDelegate.canStepReturn(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#isStepping() + */ + public boolean isStepping() { + return fDelegate.isStepping(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#stepInto() + */ + public void stepInto() throws DebugException { + fDelegate.stepInto(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#stepOver() + */ + public void stepOver() throws DebugException { + fDelegate.stepOver(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.IStep#stepReturn() + */ + public void stepReturn() throws DebugException { + fDelegate.stepReturn(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#canResume() + */ + public boolean canResume() { + return fDelegate.canResume(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() + */ + public boolean canSuspend() { + return fDelegate.canSuspend(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() + */ + public boolean isSuspended() { + return fDelegate.isSuspended(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#resume() + */ + public void resume() throws DebugException { + fDelegate.resume(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ISuspendResume#suspend() + */ + public void suspend() throws DebugException { + fDelegate.suspend(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ITerminate#canTerminate() + */ + public boolean canTerminate() { + return fDelegate.canTerminate(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ITerminate#isTerminated() + */ + public boolean isTerminated() { + return fDelegate.isTerminated(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.model.ITerminate#terminate() + */ + public void terminate() throws DebugException { + fDelegate.terminate(); + } + + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.sourcelookup.ISourceDisplay#displaySource(java.lang.Object, org.eclipse.ui.IWorkbenchPage, boolean) + */ + public void displaySource( Object element, IWorkbenchPage page, boolean forceSourceLookup ) { + if ( element instanceof ICStackFrame ) { + ICStackFrame frame = (ICStackFrame)element; + if ( isDisplayDisassembly( frame, page ) ) { + displayDisassembly( page, frame ); + } + else { + DelegatingStackFrame delegatingFrame = new DelegatingStackFrame( (ICStackFrame)element ); + ISourceDisplay sd = (ISourceDisplay)Platform.getAdapterManager().getAdapter( delegatingFrame, ISourceDisplay.class ); + if ( sd != null ) + sd.displaySource( element, page, forceSourceLookup ); + } + } + } + + private boolean isDisplayDisassembly( ICStackFrame frame, IWorkbenchPage page ) { + // always go to the disassembly window if it is already open + IEditorPart editor = getDisassemblyEditorManager().findEditor( page, frame ); + return ( editor != null ); + } + + protected DisassemblyEditorManager getDisassemblyEditorManager() { + return CDebugUIPlugin.getDefault().getDisassemblyEditorManager(); + } + + private void displayDisassembly( final IWorkbenchPage page, final Object debugContext ) { + Job uijob = new UIJob( "Display Disassembly Job" ) { //$NON-NLS-1$ + + /* (non-Javadoc) + * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public IStatus runInUIThread( IProgressMonitor monitor ) { + try { + getDisassemblyEditorManager().openEditor( page, debugContext ); + } + catch( DebugException e ) { + return e.getStatus(); + } + return Status.OK_STATUS; + } + + }; + uijob.setSystem( true ); + uijob.schedule(); + } +} |