mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bugzillas 203094 , 205975 , 204927
This commit is contained in:
parent
db9befed96
commit
34314195bd
7 changed files with 168 additions and 101 deletions
|
@ -60,16 +60,13 @@ public class ExpressionColumnPresentation implements IColumnPresentation {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresentation#getInitialColumns()
|
||||
public String[] getInitialColumns() {
|
||||
return new String[] { IDebugVMConstants.COLUMN_ID__EXPRESSION, IDebugVMConstants.COLUMN_ID__VALUE };
|
||||
return new String[] { IDebugVMConstants.COLUMN_ID__NAME, IDebugVMConstants.COLUMN_ID__TYPE, IDebugVMConstants.COLUMN_ID__VALUE };
|
||||
}
|
||||
|
||||
// @see org.eclipse.debug.internal.ui.viewers.provisional.IColumnPresentation#isOptional()
|
||||
public boolean isOptional() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.FormattedValuePreferenceStore;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.IFormattedValuePreferenceStore;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.RegisterBitFieldVMNode;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.RegisterGroupVMNode;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.RegisterVMNode;
|
||||
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register.SyncRegisterDataAccess;
|
||||
|
@ -178,11 +180,13 @@ public class ExpressionVMProvider extends AbstractDMVMProvider
|
|||
}
|
||||
|
||||
/**
|
||||
* Configures the nodes of this provider. This method may be overriden by
|
||||
* Configures the nodes of this provider. This method may be over-ridden by
|
||||
* sub classes to create an alternate configuration in this provider.
|
||||
*/
|
||||
protected void configureLayout() {
|
||||
|
||||
IFormattedValuePreferenceStore prefStore = FormattedValuePreferenceStore.getDefault();
|
||||
|
||||
/*
|
||||
* Allocate the synchronous data providers.
|
||||
*/
|
||||
|
@ -195,7 +199,7 @@ public class ExpressionVMProvider extends AbstractDMVMProvider
|
|||
IRootVMNode rootNode = new RootDMVMNode(this);
|
||||
|
||||
/*
|
||||
* Now the Overarching management node.
|
||||
* Now the Over-arching management node.
|
||||
*/
|
||||
ExpressionManagerVMNode expressionManagerNode = new ExpressionManagerVMNode(this);
|
||||
addChildNodes(rootNode, new IVMNode[] {expressionManagerNode});
|
||||
|
@ -205,20 +209,25 @@ public class ExpressionVMProvider extends AbstractDMVMProvider
|
|||
*/
|
||||
IExpressionVMNode registerGroupNode = new RegisterGroupVMNode(this, getSession(), syncRegDataAccess);
|
||||
|
||||
IExpressionVMNode registerNode = new RegisterVMNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), syncRegDataAccess);
|
||||
IExpressionVMNode registerNode = new RegisterVMNode(prefStore, this, getSession(), syncRegDataAccess);
|
||||
addChildNodes(registerGroupNode, new IExpressionVMNode[] {registerNode});
|
||||
|
||||
/*
|
||||
* Create the next level which is the bit-field level.
|
||||
*/
|
||||
IVMNode bitFieldNode = new RegisterBitFieldVMNode(prefStore, this, getSession(), syncRegDataAccess);
|
||||
addChildNodes(registerNode, new IVMNode[] { bitFieldNode });
|
||||
|
||||
/*
|
||||
* Create the support for the SubExpressions. Anything which is brought into the expressions
|
||||
* view comes in as a fully qualified expression so we go directly to the SubExpression layout
|
||||
* node.
|
||||
*/
|
||||
IExpressionVMNode variableNode =
|
||||
new VariableVMNode(FormattedValuePreferenceStore.getDefault(), this, getSession(), syncvarDataAccess);
|
||||
IExpressionVMNode variableNode = new VariableVMNode(prefStore, this, getSession(), syncvarDataAccess);
|
||||
addChildNodes(variableNode, new IExpressionVMNode[] {variableNode});
|
||||
|
||||
/*
|
||||
* Tell the expression node which subnodes it will directly support. It is very important
|
||||
* Tell the expression node which sub-nodes it will directly support. It is very important
|
||||
* that the variables node be the last in this chain. The model assumes that there is some
|
||||
* form of metalanguage expression syntax which each of the nodes evaluates and decides if
|
||||
* they are dealing with it or not. The variables node assumes that the expression is fully
|
||||
|
|
|
@ -117,6 +117,9 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
|
|||
return element instanceof BitFieldVMC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected format: GRP( GroupName ).REG( RegisterName ).BFLD( BitFieldname )
|
||||
*/
|
||||
public String createWatchExpression(Object element) throws CoreException {
|
||||
IRegisterGroupDMData groupData = fDataAccess.getRegisterGroupDMData(element);
|
||||
IRegisterDMData registerData = fDataAccess.getRegisterDMData(element);
|
||||
|
@ -124,15 +127,14 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
|
|||
|
||||
if (groupData != null && registerData != null && bitFieldData != null) {
|
||||
StringBuffer exprBuf = new StringBuffer();
|
||||
exprBuf.append("$$\""); //$NON-NLS-1$
|
||||
exprBuf.append(groupData.getName());
|
||||
exprBuf.append('"');
|
||||
exprBuf.append('$');
|
||||
exprBuf.append(registerData.getName());
|
||||
exprBuf.append('.');
|
||||
exprBuf.append(bitFieldData.getName());
|
||||
|
||||
exprBuf.append("GRP( "); exprBuf.append(groupData.getName()); exprBuf.append(" )"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
exprBuf.append(".REG( "); exprBuf.append(registerData.getName()); exprBuf.append(" )"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
exprBuf.append(".BFLD( "); exprBuf.append(bitFieldData.getName()); exprBuf.append(" )"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
return exprBuf.toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -503,6 +505,61 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected format: GRP( GroupName ).REG( RegisterName ).BFLD( BitFieldname )
|
||||
*/
|
||||
|
||||
public boolean canParseExpression(IExpression expression) {
|
||||
return parseExpressionForBitFieldName(expression.getExpressionText()) != null;
|
||||
}
|
||||
|
||||
private String parseExpressionForBitFieldName(String expression) {
|
||||
|
||||
if (expression.startsWith("GRP(")) { //$NON-NLS-1$
|
||||
|
||||
/*
|
||||
* Get the group portion.
|
||||
*/
|
||||
int startIdx = "GRP(".length(); //$NON-NLS-1$
|
||||
int endIdx = expression.indexOf(')', startIdx);
|
||||
String remaining = expression.substring(endIdx+1);
|
||||
if ( ! remaining.startsWith(".REG(") ) { //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the register portion.
|
||||
*/
|
||||
startIdx = ".REG(".length(); //$NON-NLS-1$
|
||||
endIdx = remaining.indexOf(')', startIdx);
|
||||
remaining = remaining.substring(endIdx+1);
|
||||
|
||||
/*
|
||||
* Get the bit-field portion.
|
||||
*/
|
||||
if ( ! remaining.startsWith(".BFLD(") ) { //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
startIdx = ".BFLD(".length(); //$NON-NLS-1$
|
||||
endIdx = remaining.indexOf(')', startIdx);
|
||||
String bitFieldName = remaining.substring(startIdx, endIdx);
|
||||
|
||||
/*
|
||||
* Make sure there is nothing following. If there is then this
|
||||
* is not a properly formed expression and we do not claim it.
|
||||
*/
|
||||
remaining = remaining.substring( endIdx + 1);
|
||||
|
||||
if ( remaining.length() != 0 ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return bitFieldName.trim();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testElementForExpression(Object element, IExpression expression, final DataRequestMonitor<Boolean> rm) {
|
||||
if (!(element instanceof IDMVMContext)) {
|
||||
|
@ -545,38 +602,6 @@ public class RegisterBitFieldVMNode extends AbstractExpressionVMNode
|
|||
}
|
||||
}
|
||||
|
||||
public boolean canParseExpression(IExpression expression) {
|
||||
return parseExpressionForBitFieldName(expression.getExpressionText()) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected format: $$"Group Name"$Register_Name.Bit_Field_Name
|
||||
*/
|
||||
private String parseExpressionForBitFieldName(String expression) {
|
||||
if (expression.startsWith("$$\"")) { //$NON-NLS-1$
|
||||
int secondQuoteIdx = expression.indexOf('"', "$$\"".length()); //$NON-NLS-1$
|
||||
if (secondQuoteIdx > 0) {
|
||||
String registerSubString = expression.substring(secondQuoteIdx + 1);
|
||||
if (registerSubString.length() != 0 &&
|
||||
registerSubString.charAt(0) == '$' &&
|
||||
Character.isLetterOrDigit(registerSubString.charAt(1)))
|
||||
{
|
||||
int registerEnd = 1;
|
||||
while ( registerEnd < registerSubString.length() &&
|
||||
Character.isLetterOrDigit(registerSubString.charAt(registerEnd)) )
|
||||
{
|
||||
registerEnd++;
|
||||
}
|
||||
if ((registerEnd + 1) < registerSubString.length() && '.' == registerSubString.charAt(registerEnd)) {
|
||||
return registerSubString.substring(registerEnd + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void associateExpression(Object element, IExpression expression) {
|
||||
if (element instanceof BitFieldVMC) {
|
||||
|
|
|
@ -102,13 +102,16 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
|
|||
return element instanceof RegisterGroupVMC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected format: Group(GroupName)
|
||||
*/
|
||||
public String createWatchExpression(Object element) throws CoreException {
|
||||
IRegisterGroupDMData groupData = fSyncRegisterDataAccess.getRegisterGroupDMData(element);
|
||||
if (groupData != null) {
|
||||
StringBuffer exprBuf = new StringBuffer();
|
||||
exprBuf.append("$$\""); //$NON-NLS-1$
|
||||
exprBuf.append("GRP( "); //$NON-NLS-1$
|
||||
exprBuf.append(groupData.getName());
|
||||
exprBuf.append('"');
|
||||
exprBuf.append(" )"); //$NON-NLS-1$
|
||||
return exprBuf.toString();
|
||||
}
|
||||
|
||||
|
@ -275,15 +278,19 @@ public class RegisterGroupVMNode extends AbstractExpressionVMNode
|
|||
}
|
||||
|
||||
/**
|
||||
* Expected format: $$"Group Name"$Register_Name.Bit_Field_Name
|
||||
* Expected format: Group(GroupName)
|
||||
*/
|
||||
private String parseExpressionForGroupName(String expression) {
|
||||
if (expression.startsWith("$$\"")) { //$NON-NLS-1$
|
||||
int secondQuoteIdx = expression.indexOf('"', "$$\"".length()); //$NON-NLS-1$
|
||||
if (secondQuoteIdx > 0) {
|
||||
return expression.substring(3, secondQuoteIdx);
|
||||
}
|
||||
if (expression.startsWith("GRP(")) { //$NON-NLS-1$
|
||||
/*
|
||||
* Extract the group name.
|
||||
*/
|
||||
int startIdx = "GRP(".length(); //$NON-NLS-1$
|
||||
int endIdx = expression.indexOf(')', startIdx);
|
||||
String groupName = expression.substring(startIdx, endIdx);
|
||||
return groupName.trim();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -114,16 +114,19 @@ public class RegisterVMNode extends AbstractExpressionVMNode
|
|||
return element instanceof RegisterVMC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected format: GRP( GroupName ).REG( RegisterName )
|
||||
*/
|
||||
public String createWatchExpression(Object element) throws CoreException {
|
||||
IRegisterGroupDMData groupData = fSyncRegisterDataAccess.getRegisterGroupDMData(element);
|
||||
IRegisterDMData registerData = fSyncRegisterDataAccess.getRegisterDMData(element);
|
||||
|
||||
if (groupData != null && registerData != null) {
|
||||
StringBuffer exprBuf = new StringBuffer();
|
||||
exprBuf.append("$$\""); //$NON-NLS-1$
|
||||
exprBuf.append(groupData.getName());
|
||||
exprBuf.append('"');
|
||||
exprBuf.append('$');
|
||||
exprBuf.append(registerData.getName());
|
||||
StringBuffer exprBuf = new StringBuffer();
|
||||
|
||||
exprBuf.append("GRP( "); exprBuf.append(groupData.getName()); exprBuf.append(" )"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
exprBuf.append(".REG( "); exprBuf.append(registerData.getName()); exprBuf.append(" )"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
return exprBuf.toString();
|
||||
}
|
||||
|
||||
|
@ -380,15 +383,15 @@ public class RegisterVMNode extends AbstractExpressionVMNode
|
|||
}
|
||||
|
||||
public int getDeltaFlags(Object e) {
|
||||
// In theory we want each node to act independently in terms of events. It might be
|
||||
// the case that we would only have elements of this type at the root level. It is
|
||||
// the case that the current layout model always starts with the GROUPS followed by
|
||||
// REGISTERS followed by BITFIELDS. But if we do this when a run-control event has
|
||||
// occured we generate a DELTA for every element, which can create a massive list
|
||||
// of entries all of which say update the entire view. So for now we will just have
|
||||
// the GROUP LAYOUT node do this. Later we need to revisit the logic and make sure
|
||||
// there is a way for the nodes to operate independently and efficiently.
|
||||
//
|
||||
/* In theory we want each node to act independently in terms of events. It might be
|
||||
* the case that we would only have elements of this type at the root level. It is
|
||||
* the case that the current layout model always starts with the GROUPS followed by
|
||||
* REGISTERS followed by BITFIELDS. But if we do this when a run-control event has
|
||||
* occured we generate a DELTA for every element, which can create a massive list
|
||||
* of entries all of which say update the entire view. So for now we will just have
|
||||
* the GROUP LAYOUT node do this. Later we need to revisit the logic and make sure
|
||||
* there is a way for the nodes to operate independently and efficiently.
|
||||
*/
|
||||
if (e instanceof IRunControl.ISuspendedDMEvent) {
|
||||
return IModelDelta.CONTENT;
|
||||
}
|
||||
|
@ -437,35 +440,55 @@ public class RegisterVMNode extends AbstractExpressionVMNode
|
|||
rm.done();
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected format: GRP( GroupName ).REG( RegisterName )
|
||||
* or: $RegisterName
|
||||
*/
|
||||
|
||||
public boolean canParseExpression(IExpression expression) {
|
||||
return parseExpressionForRegisterName(expression.getExpressionText()) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected format: $$"Group Name"$Register_Name.Bit_Field_Name
|
||||
*/
|
||||
private String parseExpressionForRegisterName(String expression) {
|
||||
if (expression.startsWith("$$\"")) { //$NON-NLS-1$
|
||||
int secondQuoteIdx = expression.indexOf('"', "$$\"".length()); //$NON-NLS-1$
|
||||
if (secondQuoteIdx > 0) {
|
||||
String registerSubString = expression.substring(secondQuoteIdx + 1);
|
||||
if (registerSubString.length() != 0 &&
|
||||
registerSubString.charAt(0) == '$' &&
|
||||
Character.isLetterOrDigit(registerSubString.charAt(1)))
|
||||
{
|
||||
int registerEnd = 1;
|
||||
while ( registerEnd < registerSubString.length() &&
|
||||
Character.isLetterOrDigit(registerSubString.charAt(registerEnd)) )
|
||||
{
|
||||
registerEnd++;
|
||||
}
|
||||
return registerSubString.substring(1, registerEnd);
|
||||
}
|
||||
if (expression.startsWith("GRP(")) { //$NON-NLS-1$
|
||||
/*
|
||||
* Get the group portion.
|
||||
*/
|
||||
int startIdx = "GRP(".length(); //$NON-NLS-1$
|
||||
int endIdx = expression.indexOf(')', startIdx);
|
||||
String remaining = expression.substring(endIdx+1);
|
||||
if ( ! remaining.startsWith(".REG(") ) { //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the register portion.
|
||||
*/
|
||||
startIdx = ".REG(".length(); //$NON-NLS-1$
|
||||
endIdx = remaining.indexOf(')', startIdx);
|
||||
String regName = remaining.substring(startIdx,endIdx);
|
||||
return regName.trim();
|
||||
}
|
||||
else if ( expression.startsWith("$") ) { //$NON-NLS-1$
|
||||
/*
|
||||
* At this point I am leaving this code here to represent the register case. To do this
|
||||
* correctly would be to use the findRegister function and upgrade the register service
|
||||
* to deal with registers that do not have a specified group parent context. I do not
|
||||
* have the time for this right now. So by saying we do not handle this the Expression
|
||||
* VM node will take it and pass it to the debug engine as a generic expression. Most
|
||||
* debug engines ( GDB included ) have an inherent knowledge of the core registers as
|
||||
* part of their expression evaluation and will respond with a flat value for the reg.
|
||||
* This is not totally complete in that you should be able to express a register which
|
||||
* has bit fields for example and the bit fields should be expandable in the expression
|
||||
* view. With this method it will just appear to have a single value and no sub-fields.
|
||||
* I will file a defect/enhancement for this to mark it. This comment will act as the
|
||||
* place-holder for the future work.
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void testElementForExpression(Object element, IExpression expression, final DataRequestMonitor<Boolean> rm) {
|
||||
if (!(element instanceof IDMVMContext)) {
|
||||
|
|
|
@ -442,10 +442,16 @@ public class VariableVMNode extends AbstractExpressionVMNode
|
|||
}
|
||||
|
||||
public boolean canParseExpression(IExpression expression) {
|
||||
// Indicate that we can parse any expression that does not start with
|
||||
// the reserved '$' and '#' characters.
|
||||
String expressionText = expression.getExpressionText();
|
||||
return !expressionText.startsWith("$") && !expressionText.startsWith("#");
|
||||
// At this point we are going to say we will allow anything as an expression.
|
||||
// Since the evaluation of VM Node implementations searches in the order of
|
||||
// registration and we always make sure we register the VariableVMNode last,
|
||||
// we know that the other possible handlers have passed the expression by. So
|
||||
// we are going to say OK and let the expression evaluation of whatever debug
|
||||
// backend is connected to decide. This does not allow us to put up any good
|
||||
// diagnostic error message ( instead the error will come from the backend ).
|
||||
// But it does allow for the most flexibility
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail;
|
|||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
class MessagesForNumberFormatDetail extends NLS {
|
||||
private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.detail.messages"; //$NON-NLS-1$
|
||||
private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail.messages"; //$NON-NLS-1$
|
||||
|
||||
public static String NumberFormatDetailPane_name;
|
||||
public static String NumberFormatDetailPane_description;
|
||||
|
|
Loading…
Add table
Reference in a new issue