From 4c76a8df1e1e4fa976f4b9488b899e0d11b306e6 Mon Sep 17 00:00:00 2001 From: Randy Rohrbach Date: Thu, 19 Apr 2007 14:31:31 +0000 Subject: [PATCH] Created the initial formatting interface for Bugzilla 179778. Updated the IRegisters interface for Bugzilla 183188 and added required interface methods to the MI Register implementation ( all indicated not yet implemented ) which are now required by the updated IRegiisters interface. Also updated the Register View VM to handle the new events which were also added in IRegisters. --- .../register/RegisterGroupLayoutNode.java | 28 ++++++++ .../register/RegisterLayoutNode.java | 23 ++---- .../dsf/debug/service/IFormattedValues.java | 72 +++++++++++++++++++ .../dd/dsf/debug/service/IRegisters.java | 58 +++++++++++++-- 4 files changed, 159 insertions(+), 22 deletions(-) create mode 100644 plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IFormattedValues.java diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterGroupLayoutNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterGroupLayoutNode.java index 3b95f6a8e81..384e5fd7b69 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterGroupLayoutNode.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterGroupLayoutNode.java @@ -11,16 +11,21 @@ package org.eclipse.dd.dsf.debug.ui.viewmodel.register; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; +import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.datamodel.IDMContext; +import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.debug.service.IRegisters; +import org.eclipse.dd.dsf.debug.service.IRunControl; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterGroupDMContext; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterGroupDMData; import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider; +import org.eclipse.dd.dsf.ui.viewmodel.VMDelta; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; +import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; @SuppressWarnings("restriction") public class RegisterGroupLayoutNode extends AbstractDMVMLayoutNode { @@ -66,4 +71,27 @@ public class RegisterGroupLayoutNode extends AbstractDMVMLayoutNode e) { + if (e instanceof IRunControl.ISuspendedDMEvent) { + return IModelDelta.CONTENT; + }else if (e instanceof IRegisters.IRegistersChangedDMEvent) { + return IModelDelta.CONTENT; + } + return IModelDelta.NO_CHANGE; + } + + @Override + protected void buildDeltaForDMEvent(IDMEvent e, VMDelta parent, int nodeOffset, RequestMonitor rm) { + if (e instanceof IRunControl.ISuspendedDMEvent) { + // Create a delta that the whole register group has changed. + parent.addFlags(IModelDelta.CONTENT); + } + if (e instanceof IRegisters.IRegistersChangedDMEvent) { + parent.addNode( new DMVMContext(((IRegisters.IRegistersChangedDMEvent)e).getDMContext()), IModelDelta.STATE ); + } + + super.buildDeltaForDMEvent(e, parent, nodeOffset, rm); + } } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutNode.java index f2a628d042f..5021006acdc 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutNode.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/ui/viewmodel/register/RegisterLayoutNode.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.dd.dsf.debug.ui.viewmodel.register; -import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; +import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMEvent; import org.eclipse.dd.dsf.debug.service.IRegisters; @@ -21,7 +21,6 @@ import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMData; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterGroupDMContext; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.AbstractVMProvider; -import org.eclipse.dd.dsf.ui.viewmodel.IVMContext; import org.eclipse.dd.dsf.ui.viewmodel.VMDelta; import org.eclipse.dd.dsf.ui.viewmodel.dm.AbstractDMVMLayoutNode; import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; @@ -31,8 +30,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; @SuppressWarnings("restriction") public class RegisterLayoutNode extends AbstractDMVMLayoutNode { - public IVMContext[] fCachedRegisterVMCs; - public RegisterLayoutNode(AbstractVMProvider provider, DsfSession session) { super(provider, session, IRegisters.IRegisterDMContext.class); } @@ -70,16 +67,7 @@ public class RegisterLayoutNode extends AbstractDMVMLayoutNode } else if (RegisterColumnPresentation.COL_VALUE.equals(columnId)) { update.setLabel(dmData.getHexValue(), idx); } else if (RegisterColumnPresentation.COL_DESCRIPTION.equals(columnId)) { - String size = dmData.getDescription(); - String value = dmData.getHexValue(); - if ("".equals(size)) { //$NON-NLS-1$ - if ( value.contains( "uint64" ) ) { //$NON-NLS-1$ - size = "64 bit register" ; //$NON-NLS-1$ - } else if ( value.contains( "v4_float" ) ) { //$NON-NLS-1$ - size = "128 bit register" ; //$NON-NLS-1$ - } - } - update.setLabel(size, idx); + update.setLabel(dmData.getDescription(), idx); } } @@ -89,12 +77,12 @@ public class RegisterLayoutNode extends AbstractDMVMLayoutNode return IModelDelta.CONTENT; } else if (e instanceof IRegisters.IRegisterChangedDMEvent) { return IModelDelta.STATE; - } + } return IModelDelta.NO_CHANGE; } @Override - protected void buildDeltaForDMEvent(IDMEvent e, VMDelta parent, int nodeOffset, RequestMonitor requestMonitor) { + protected void buildDeltaForDMEvent(IDMEvent e, VMDelta parent, int nodeOffset, RequestMonitor rm) { if (e instanceof IRunControl.ISuspendedDMEvent) { // Create a delta that the whole register group has changed. parent.addFlags(IModelDelta.CONTENT); @@ -102,6 +90,7 @@ public class RegisterLayoutNode extends AbstractDMVMLayoutNode if (e instanceof IRegisters.IRegisterChangedDMEvent) { parent.addNode( new DMVMContext(((IRegisters.IRegisterChangedDMEvent)e).getDMContext()), IModelDelta.STATE ); } - super.buildDeltaForDMEvent(e, parent, nodeOffset, requestMonitor); + + super.buildDeltaForDMEvent(e, parent, nodeOffset, rm); } } diff --git a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IFormattedValues.java b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IFormattedValues.java new file mode 100644 index 00000000000..80fc136846b --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IFormattedValues.java @@ -0,0 +1,72 @@ +/* + * IFormattedValuesService.java + * Created on Apr 16, 2007 + * + * Copyright 2007 Wind River Systems Inc. All rights reserved. +*/ +package org.eclipse.dd.dsf.debug.service; + +import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; +import org.eclipse.dd.dsf.datamodel.IDMContext; +import org.eclipse.dd.dsf.datamodel.IDMData; +import org.eclipse.dd.dsf.datamodel.IDMService; + +public interface IFormattedValues extends IDMService { + + /** Marker interface for a DMC that has a formatted value. */ + public interface IDataDMContext extends IDMContext {} + + /** + * These strings represent the standard known formats for any bit stream + * which needs to be formatted. These ID's as well as others which may be + * specifically available from the backend are what is returned from the + * getID() method. + */ + public final static String HEX_FORMAT = "HEX.Format" ; //$NON-NLS-1$ + public final static String OCTAL_FORMAT = "OCTAL.Format" ; //$NON-NLS-1$ + public final static String BINARY_FORMAT = "BINARY.Format" ; //$NON-NLS-1$ + public final static String NATURAL_FORMAT = "NATURAL.Format" ; //$NON-NLS-1$ + + /** + * DMC that represents a value with specific format. The format ID can be + * persisted and used for comparison. + */ + public interface IValueDMContext extends IDMContext + { + public String getID(); + } + + /** + * DM Data returned when a formatted value DMC is evaluated. It contains + * only the properly formatted string. + * + * @param includePrefix Should the resulting formatted string contain the + * typical prefix ( if any exists for this format - e.g. 0x, 0b, 0 ). + * @param leadingZeros Should the resulting formatted string contain leading 0's. + */ + public interface IValueDMData extends IDMData { + String getFormattedValue(); + } + + /** + * Retrieves the available formats that the given data is available in. + * This method is asynchronous because the service may need to retrieve + * information from the back end in order to determine what formats are + * available for the given data context. + * + * @param dmc Context for which to retrieve available formatted values. + * @param formatIDs Currently supported format IDs. + */ + public void getAvailableFormattedValues(IDataDMContext dmc, DataRequestMonitor formatIDs); + + /** + * Retrieves the available formats that the given data is available in. + * This method is asynchronous because the service may need to retrieve + * information from the back end in order to determine what formats are + * available for the given data context. + * + * @param dmc Context for which to retrieve a IValueDMContext. + * @param formatId Defines format to be supplied from the returned context. + */ + public IValueDMContext getFormattedValue(IDataDMContext dmc, String formatId); +} \ No newline at end of file diff --git a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRegisters.java b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRegisters.java index ffe2bee47b5..7113a38c512 100644 --- a/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRegisters.java +++ b/plugins/org.eclipse.dd.dsf.debug/src/org/eclipse/dd/dsf/debug/service/IRegisters.java @@ -11,6 +11,7 @@ package org.eclipse.dd.dsf.debug.service; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; +import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMData; import org.eclipse.dd.dsf.datamodel.IDMEvent; @@ -20,13 +21,19 @@ import org.eclipse.dd.dsf.datamodel.IDMService; * Service for accessing register data. */ public interface IRegisters extends IDMService { + + /** Event indicating groups have changed. */ + public interface IGroupsChangedDMEvent extends IDMEvent {} /** Register group context */ public interface IRegisterGroupDMContext extends IDMContext {} + /** Event indicating registers in a group have changed. */ + public interface IRegistersChangedDMEvent extends IDMEvent {} + /** - * Register groups only have a name. Sub groups and registers are retrieved - * through the service interface. + * Register groups only have a name and description. Sub groups and registers are + * retrieved through the service interface. */ public interface IRegisterGroupDMData extends IDMData { public String getName(); @@ -55,6 +62,9 @@ public interface IRegisters extends IDMService { /** Bit field context */ public interface IBitFieldDMContext extends IDMContext {} + /** Event indicating register value changed. */ + public interface IBitFieldChangedDMEvent extends IDMEvent {} + /** * Bitfield data, big groups and mnemonics are retrieved at the same * time as rest of bit field data @@ -104,12 +114,50 @@ public interface IRegisters extends IDMService { */ void getRegisterGroups(IRunControl.IExecutionDMContext execCtx, IStack.IFrameDMContext frameCtx, DataRequestMonitor rm); - /** Retrieves list of sub-groups of given register group. */ + /** + * Retrieves list of sub-groups of given register group. + * @param groupCtx Group DMC, this is required. + * @param rm Request completion monitor. + */ void getRegisterSubGroups(IRegisterGroupDMContext groupCtx, DataRequestMonitor rm); - /** Retrieves registers in given register group. */ + /** + * Retrieves registers in given register group. + * @param groupCtx Group DMC, this is required. + * @param rm Request completion monitor. + */ void getRegisters(IRegisterGroupDMContext groupCtx, DataRequestMonitor rm); - /** Retrieves bit fields for given register */ + /** + * Retrieves bit fields for given register + * @param regCtx Register DMC, this is required. + * @param rm Request completion monitor. + */ void getBitFields(IRegisterDMContext regCtx, DataRequestMonitor rm); + + /** + * Writes a register value for a given register to the target + * @param regCtx Register DMC, this is required. + * @param regValue Value of the register to be written. + * @param formatId Format of the value to be written. + * @param rm Request completion monitor. + */ + void writeRegister(IRegisterDMContext regCtx, String regValue, String formatId, RequestMonitor rm); + + /** + * Writes a bit field value for a given bit field to the target + * @param bitFieldCtx Bit field DMC, this is required. + * @param bitFieldValue Value of the bit field to be written. + * @param formatId Format of the value to be written. + * @param rm Request completion monitor. + */ + void writeBitField(IBitFieldDMContext bitFieldCtx, String bitFieldValue, String formatId, RequestMonitor rm); + + /** + * Writes a bit field value for a given bit field to the target + * @param bitFieldCtx Bit field DMC, this is required. + * @param mnemonic Mnemonic which represents the value to be written. + * @param rm Request completion monitor. + */ + void writeBitField(IBitFieldDMContext bitFieldCtx, IMnemonic mnemonic, RequestMonitor rm); }