1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Implementation of the 'Automatically switch to disassembly mode' preference.

This commit is contained in:
Mikhail Khodjaiants 2002-10-15 18:29:04 +00:00
parent 5d2345079c
commit 46a86c5d94
5 changed files with 63 additions and 1 deletions

View file

@ -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.

View file

@ -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 <code>"org.eclipse.cdt.debug.core"</code>).
*/
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 <code>true</code> the debugger will automatically switch to
* disassembly mode.
*/
public static final String PREF_AUTO_DISASSEMBLY = PLUGIN_ID + "cDebug.auto_disassembly"; //$NON-NLS-1$
}

View file

@ -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 );

View file

@ -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.

View file

@ -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 ) );
}
}