1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Added the launch configuration preference for the register bookkeeping.

This commit is contained in:
Mikhail Khodjaiants 2004-10-11 20:24:15 +00:00
parent 06b4f414c0
commit acf19e50fa
9 changed files with 77 additions and 25 deletions

View file

@ -1,3 +1,11 @@
2004-10-08 Mikhail Khodjaiants
Added the launch configuration preference for the register bookkeeping.
* ICDTLaunchConfigurationConstants.java
* CExpression.java
* CRegister.java
* CRegisterGroup.java
* CVariable.java
2004-10-08 Mikhail Khodjaiants
Added the bookkeeping of registers and register groups.
* ICVariable.java

View file

@ -102,6 +102,11 @@ public interface ICDTLaunchConfigurationConstants {
*/
public static final String ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING = CDT_LAUNCH_ID + ".ENABLE_VARIABLE_BOOKKEEPING"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a boolean specifying whether to enable register bookkeeping.
*/
public static final String ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING = CDT_LAUNCH_ID + ".ENABLE_REGISTER_BOOKKEEPING"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a global variables' memento.
*/

View file

@ -100,4 +100,11 @@ public class CExpression extends CVariable implements IExpression {
public boolean canEnableDisable() {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.CVariable#isBookkeepingEnabled()
*/
protected boolean isBookkeepingEnabled() {
return false;
}
}

View file

@ -11,10 +11,12 @@
package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegister;
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject;
import org.eclipse.cdt.debug.core.model.CVariableFormat;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IRegister;
import org.eclipse.debug.core.model.IRegisterGroup;
@ -46,4 +48,17 @@ public class CRegister extends CGlobalVariable implements IRegister {
public IRegisterGroup getRegisterGroup() throws DebugException {
return (IRegisterGroup)getParent();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.core.model.CVariable#isBookkeepingEnabled()
*/
protected boolean isBookkeepingEnabled() {
boolean result = false;
try {
result = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false );
}
catch( CoreException e ) {
}
return result;
}
}

View file

@ -61,7 +61,9 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup, IEn
catch( DebugException e ) {
fRegisters[i] = new CRegister( this, fRegisterObjects[i], e.getMessage() );
}
((CRegister)fRegisters[i]).setEnabled( isEnabled() );
if ( ((CRegister)fRegisters[i]).isEnabled() ) {
((CRegister)fRegisters[i]).setEnabled( isEnabled() );
}
}
}
return fRegisters;

View file

@ -707,7 +707,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener {
fShadow = shadow;
}
private boolean isBookkeepingEnabled() {
protected boolean isBookkeepingEnabled() {
boolean result = false;
try {
result = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false );

View file

@ -1,3 +1,8 @@
2004-10-08 Mikhail Khodjaiants
Added the launch configuration preference for the register bookkeeping.
* LaunchUIPluginResources.properties
* CDebuggerTab.java
2004-08-23 Mikhail Khodjaiants
Changes in the "Debugger" tab of the launch configuration dialog.
Replaced the "Run in debugger/Attach to running process" radio button by

View file

@ -93,10 +93,12 @@ CMainTab.Choose_program_to_run_from_NAME=Choose a program to run from {0}:
CDebuggerTab.Attach_to_running_process=Attach to running process
CDebuggerTab.Advanced_Options_Dialog_Title=Advanced Options
CDebuggerTab.Stop_at_main_on_startup=Stop at main() on startup
CDebuggerTab.Automatically_track_values_of_variables=Automatically track the values of variables.
CDebuggerTab.Automatically_track_values_of=Automatically track the values of
CDebuggerTab.Debugger_Options=Debugger Options
CDebuggerTab.Mode_not_supported=Mode ''{0}'' is not supported by selected debugger
CDebuggerTab.Advanced=Advanced...
CDebuggerTab.Variables=Variables
CDebuggerTab.Registers=Registers
CDebuggerTab.No_debugger_available=No debugger available
CDebuggerTab.CPU_is_not_supported=The CPU is not supported by selected debugger.

View file

@ -50,14 +50,13 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
private Button fVarBookKeeping;
private Map fAttributes;
private Button fRegBookKeeping;
/**
* Constructor for AdvancedDebuggerOptionsDialog.
/**
* Constructor for AdvancedDebuggerOptionsDialog.
*/
public AdvancedDebuggerOptionsDialog( Shell parentShell, Map attributes ) {
protected AdvancedDebuggerOptionsDialog( Shell parentShell ) {
super( parentShell );
fAttributes = attributes;
}
/* (non-Javadoc)
@ -65,31 +64,38 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
*/
protected Control createDialogArea( Composite parent ) {
Composite composite = (Composite)super.createDialogArea( parent );
fVarBookKeeping = new Button( composite, SWT.CHECK );
fVarBookKeeping.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Automatically_track_values_of_variables" ) ); //$NON-NLS-1$
Group group = new Group( composite, SWT.NONE );
group.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Automatically_track_values_of" ) ); //$NON-NLS-1$
GridLayout layout = new GridLayout();
group.setLayout( layout );
group.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
fVarBookKeeping = new Button( group, SWT.CHECK );
fVarBookKeeping.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Variables" ) ); //$NON-NLS-1$
fRegBookKeeping = new Button( group, SWT.CHECK );
fRegBookKeeping.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Registers" ) ); //$NON-NLS-1$
initialize();
return composite;
}
private Map getAttributes() {
return fAttributes;
}
protected void okPressed() {
saveValues();
super.okPressed();
}
private void initialize() {
Map attr = getAttributes();
Map attr = getAdvancedAttributes();
Object varBookkeeping = attr.get( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING );
fVarBookKeeping.setSelection( ( varBookkeeping instanceof Boolean ) ? !((Boolean)varBookkeeping).booleanValue() : true );
Object regBookkeeping = attr.get( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING );
fRegBookKeeping.setSelection( ( regBookkeeping instanceof Boolean ) ? !((Boolean)regBookkeeping).booleanValue() : true );
}
private void saveValues() {
Map attr = getAttributes();
Map attr = getAdvancedAttributes();
Boolean varBookkeeping = ( fVarBookKeeping.getSelection() ) ? Boolean.FALSE : Boolean.TRUE;
attr.put( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, varBookkeeping );
Boolean regBookkeeping = ( fRegBookKeeping.getSelection() ) ? Boolean.FALSE : Boolean.TRUE;
attr.put( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, regBookkeeping );
updateLaunchConfigurationDialog();
}
@ -100,14 +106,6 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
super.configureShell( newShell );
newShell.setText( LaunchUIPlugin.getResourceString( "CDebuggerTab.Advanced_Options_Dialog_Title" ) ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#close()
*/
public boolean close() {
fAttributes.clear();
return super.close();
}
}
protected Combo fDCombo;
@ -191,6 +189,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
super.setDefaults( config );
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT );
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false );
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false );
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );
}
@ -349,7 +348,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
fAdvancedButton.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
Dialog dialog = new AdvancedDebuggerOptionsDialog( getShell(), getAdvancedAttributes() );
Dialog dialog = new AdvancedDebuggerOptionsDialog( getShell() );
dialog.open();
}
} );
@ -381,6 +380,12 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
}
catch( CoreException e ) {
}
try {
Boolean regBookkeeping = ( config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false ) ) ? Boolean.TRUE : Boolean.FALSE;
attr.put( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, regBookkeeping );
}
catch( CoreException e ) {
}
}
private void applyAdvancedAttributes( ILaunchConfigurationWorkingCopy config ) {
@ -388,6 +393,9 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
Object varBookkeeping = attr.get( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING );
if ( varBookkeeping instanceof Boolean )
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, ((Boolean)varBookkeeping).booleanValue() );
Object regBookkeeping = attr.get( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING );
if ( regBookkeeping instanceof Boolean )
config.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, ((Boolean)regBookkeeping).booleanValue() );
}
protected Shell getShell() {