diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index bb0673c7307..08f658070fc 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,7 @@ +2002-10-15 Mikhail Khodjaiants + * ICDebugConstants.java: New interface that contains the constant definitions for C/C++ debug plug-in. + * CSourceManager.java: Implementation of the 'Automatically switch to disassembly mode' preference. + 2002-10-15 Mikhail Khodjaiants * CThread.java: The previous fix should be done only when switching between frames of the same thread. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java new file mode 100644 index 00000000000..972d3c35b72 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConstants.java @@ -0,0 +1,28 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ +package org.eclipse.cdt.debug.core; + +/** + * + * Constant definitions for C/C++ debug plug-in. + * + * @since: Oct 15, 2002 + */ +public interface ICDebugConstants +{ + /** + * C/C++ debug plug-in identifier (value "org.eclipse.cdt.debug.core"). + */ + public static final String PLUGIN_ID = CDebugCorePlugin.getDefault().getDescriptor().getUniqueIdentifier(); + + /** + * Boolean preference controlling whether the debugger automatically + * switchs to disassembly mode when can not find the source file . + * When true the debugger will automatically switch to + * disassembly mode. + */ + public static final String PREF_AUTO_DISASSEMBLY = PLUGIN_ID + "cDebug.auto_disassembly"; //$NON-NLS-1$ +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java index 12acf92e662..be8137b4ddd 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java @@ -6,6 +6,8 @@ package org.eclipse.cdt.debug.internal.core.sourcelookup; +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.IStackFrameInfo; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; @@ -136,11 +138,15 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable public Object getSourceElement( IStackFrame stackFrame ) { Object result = null; + boolean autoDisassembly = CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ); + if ( getMode() == ISourceMode.MODE_SOURCE && getSourceLocator() != null ) { result = getSourceLocator().getSourceElement( stackFrame ); } - if ( result == null && getDisassemblyManager() != null ) + if ( result == null && + ( autoDisassembly || getMode() == ISourceMode.MODE_DISASSEMBLY ) && + getDisassemblyManager() != null ) { setRealMode( ISourceMode.MODE_DISASSEMBLY ); result = getDisassemblyManager().getSourceElement( stackFrame ); diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index ecc3d13cea8..adf8c175c70 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,6 @@ +2002-10-15 Mikhail Khodjaiants + * CDebugPreferencePage.java: Implementation of the 'Automatically switch to disassembly mode' preference. + 2002-10-14 Mikhail Khodjaiants * CDebugUIPlugin.java: In the 'selectionChanged' method check if the thread of the new frame is current. If not make it current. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java index 2af3f6e8b6b..235a86a0481 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java @@ -5,6 +5,8 @@ */ package org.eclipse.cdt.debug.internal.ui.preferences; +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.ICDebugUIConstants; @@ -47,6 +49,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr // View setting widgets private Button fPathsButton; + // Disassembly setting widgets + private Button fAutoDisassemblyButton; + private PropertyChangeListener fPropertyChangeListener; protected class PropertyChangeListener implements IPropertyChangeListener @@ -105,6 +110,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr createPrimitiveDisplayPreferences( composite ); createSpacer( composite, 1 ); createViewSettingPreferences( composite ); + createSpacer( composite, 1 ); + createDisassemblySettingPreferences( composite ); setValues(); return composite; @@ -144,6 +151,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr fHexButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) ); fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) ); + fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) ); } /* (non-Javadoc) @@ -169,6 +177,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr { store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false ); store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, true ); + CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_AUTO_DISASSEMBLY, false ); } /** @@ -198,6 +207,15 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr fPathsButton = createCheckButton( comp, "Show full &paths" ); } + /** + * Create the disassembly setting preferences composite widget + */ + private void createDisassemblySettingPreferences( Composite parent ) + { + Composite comp = createGroupComposite( parent, 1, "Disassembly options" ); + fAutoDisassemblyButton = createCheckButton( comp, "Automatically switch to &disassembly mode" ); + } + /** * Creates a button with the given label and sets the default * configuration data. @@ -232,6 +250,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr refreshViews(); } CDebugUIPlugin.getDefault().savePluginPreferences(); + CDebugCorePlugin.getDefault().savePluginPreferences(); return true; } @@ -291,6 +310,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr IPreferenceStore store = getPreferenceStore(); store.setValue( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, fHexButton.getSelection() ); store.setValue( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, fPathsButton.getSelection() ); + CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_AUTO_DISASSEMBLY, fAutoDisassemblyButton.getSelection() ); } /** @@ -307,5 +327,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr { IPreferenceStore store = getPreferenceStore(); fHexButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES ) ); + fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) ); } }