1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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.
This commit is contained in:
Randy Rohrbach 2007-04-19 14:31:31 +00:00
parent 3de10f8d2b
commit 4c76a8df1e
4 changed files with 159 additions and 22 deletions

View file

@ -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<IRegisterGroupDMData> {
@ -66,4 +71,27 @@ public class RegisterGroupLayoutNode extends AbstractDMVMLayoutNode<IRegisterGro
update.setLabel(dmData.getDescription(), idx);
}
}
@Override
protected int getNodeDeltaFlagsForDMEvent(IDMEvent<?> 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);
}
}

View file

@ -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<IRegisterDMData> {
public IVMContext[] fCachedRegisterVMCs;
public RegisterLayoutNode(AbstractVMProvider provider, DsfSession session) {
super(provider, session, IRegisters.IRegisterDMContext.class);
}
@ -70,16 +67,7 @@ public class RegisterLayoutNode extends AbstractDMVMLayoutNode<IRegisterDMData>
} 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<IRegisterDMData>
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<IRegisterDMData>
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);
}
}

View file

@ -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<V extends IDMData> extends IDMContext<V> {}
/**
* 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<IValueDMData>
{
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<String[]> 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);
}

View file

@ -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<IRunControl.IExecutionDMContext> {}
/** Register group context */
public interface IRegisterGroupDMContext extends IDMContext<IRegisterGroupDMData> {}
/** Event indicating registers in a group have changed. */
public interface IRegistersChangedDMEvent extends IDMEvent<IRegisterGroupDMContext> {}
/**
* 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<IBitFieldDMData> {}
/** Event indicating register value changed. */
public interface IBitFieldChangedDMEvent extends IDMEvent<IBitFieldDMContext> {}
/**
* 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<IRegisterGroupDMContext[]> 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<IRegisterGroupDMContext[]> 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<IRegisterDMContext[]> 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<IBitFieldDMContext[]> 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);
}