mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 381868 - CDT debugger 'Display As Array...' does not show elements
of large array. Revert previous fix to simplify. The bug was actually in the handling of casting. Change-Id: Ice96e653d8825567013e1dfda3b3c7e7217ca8d8 Reviewed-on: https://git.eclipse.org/r/6324 Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com> Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
f55fb58cad
commit
cd368cbf94
2 changed files with 12 additions and 71 deletions
|
@ -498,20 +498,6 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CastedIndexedPartitionDMC extends IndexedPartitionDMC implements ICastedExpressionDMContext {
|
|
||||||
|
|
||||||
final private CastInfo fCastInfo;
|
|
||||||
|
|
||||||
private CastedIndexedPartitionDMC(MIExpressionDMC exprDmc, int index, int length, CastInfo castInfo) {
|
|
||||||
super(exprDmc.getSessionId(), exprDmc.getExpressionInfo(), exprDmc, index, length );
|
|
||||||
fCastInfo = castInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CastInfo getCastInfo() {
|
|
||||||
return fCastInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the address of an expression as well as the size of its type.
|
* Contains the address of an expression as well as the size of its type.
|
||||||
|
@ -1462,13 +1448,10 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
protected class CastedExpressionDMC extends MIExpressionDMC implements ICastedExpressionDMContext {
|
protected class CastedExpressionDMC extends MIExpressionDMC implements ICastedExpressionDMContext {
|
||||||
|
|
||||||
private final CastInfo fCastInfo;
|
private final CastInfo fCastInfo;
|
||||||
/** if non-null, interpret result as this type rather than the raw expression's type */
|
|
||||||
private String fCastExpression;
|
|
||||||
|
|
||||||
public CastedExpressionDMC(MIExpressionDMC exprDMC, String castExpression, CastInfo castInfo) {
|
public CastedExpressionDMC(MIExpressionDMC exprDMC, String castExpression, CastInfo castInfo) {
|
||||||
super(getSession().getId(), exprDMC.getExpression(), exprDMC.getRelativeExpression(), exprDMC);
|
super(getSession().getId(), castExpression, exprDMC.getRelativeExpression(), exprDMC);
|
||||||
fCastInfo = castInfo;
|
fCastInfo = castInfo;
|
||||||
fCastExpression = castExpression;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1479,14 +1462,6 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
return fCastInfo;
|
return fCastInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.dsf.mi.service.MIExpressions.java#getExpression()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getExpression() {
|
|
||||||
return fCastExpression;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return True if the two objects are equal, false otherwise.
|
* @return True if the two objects are equal, false otherwise.
|
||||||
*/
|
*/
|
||||||
|
@ -1495,13 +1470,6 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
return super.equals(other)
|
return super.equals(other)
|
||||||
&& fCastInfo.equals(((CastedExpressionDMC) other).fCastInfo);
|
&& fCastInfo.equals(((CastedExpressionDMC) other).fCastInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return baseToString() + ".expr" + "[" + //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
getExpression() +", " + getRelativeExpression() + "]"; //$NON-NLS-1$//$NON-NLS-2$
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -1527,10 +1495,10 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
// cast to array (can be in addition to cast to type)
|
// cast to array (can be in addition to cast to type)
|
||||||
if (castingLength > 0) {
|
if (castingLength > 0) {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append("*("); //$NON-NLS-1$
|
buffer.append("(*("); //$NON-NLS-1$
|
||||||
buffer.append('(').append(castExpression).append(')');
|
buffer.append('(').append(castExpression).append(')');
|
||||||
buffer.append('+').append(castingIndex).append(')');
|
buffer.append('+').append(castingIndex).append(')');
|
||||||
buffer.append('@').append(castingLength);
|
buffer.append('@').append(castingLength).append(')');
|
||||||
castExpression = buffer.toString();
|
castExpression = buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1568,8 +1536,6 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
int startIndex1 = (startIndex < 0) ? 0 : startIndex;
|
int startIndex1 = (startIndex < 0) ? 0 : startIndex;
|
||||||
int length1 = (length < 0) ? numChildren - startIndex1 : Math.min(length, numChildren - startIndex1);
|
int length1 = (length < 0) ? numChildren - startIndex1 : Math.min(length, numChildren - startIndex1);
|
||||||
|
|
||||||
CastInfo castInfo = (exprCtx instanceof ICastedExpressionDMContext) ?
|
|
||||||
((ICastedExpressionDMContext)exprCtx).getCastInfo() : null;
|
|
||||||
IndexedPartitionDMC[] children = new IndexedPartitionDMC[numChildren];
|
IndexedPartitionDMC[] children = new IndexedPartitionDMC[numChildren];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for(int i = 0; i < children.length; ++i) {
|
for(int i = 0; i < children.length; ++i) {
|
||||||
|
@ -1578,8 +1544,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
exprCtx.getParents()[0],
|
exprCtx.getParents()[0],
|
||||||
exprCtx.getExpressionInfo(),
|
exprCtx.getExpressionInfo(),
|
||||||
index,
|
index,
|
||||||
partLength,
|
partLength);
|
||||||
castInfo);
|
|
||||||
index += partLength;
|
index += partLength;
|
||||||
}
|
}
|
||||||
return Arrays.copyOfRange(children, startIndex1, startIndex1 + length1 );
|
return Arrays.copyOfRange(children, startIndex1, startIndex1 + length1 );
|
||||||
|
@ -1591,9 +1556,6 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
final int length,
|
final int length,
|
||||||
final DataRequestMonitor<IExpressionDMContext[]> rm) {
|
final DataRequestMonitor<IExpressionDMContext[]> rm) {
|
||||||
|
|
||||||
CastInfo castInfo = (partDmc instanceof ICastedExpressionDMContext) ?
|
|
||||||
((ICastedExpressionDMContext)partDmc).getCastInfo() : null;
|
|
||||||
|
|
||||||
final int startIndex1 = (startIndex < 0) ? 0 : startIndex;
|
final int startIndex1 = (startIndex < 0) ? 0 : startIndex;
|
||||||
final int length1 = (length < 0) ? Integer.MAX_VALUE : length;
|
final int length1 = (length < 0) ? Integer.MAX_VALUE : length;
|
||||||
|
|
||||||
|
@ -1620,8 +1582,7 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
partDmc,
|
partDmc,
|
||||||
partDmc.getParentInfo(),
|
partDmc.getParentInfo(),
|
||||||
index,
|
index,
|
||||||
childPartLength,
|
childPartLength);
|
||||||
castInfo);
|
|
||||||
index += childPartLength;
|
index += childPartLength;
|
||||||
}
|
}
|
||||||
rm.setData(children);
|
rm.setData(children);
|
||||||
|
@ -1634,11 +1595,8 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IExpressionDMContext parentCtx = createExpression(partDmc.getParents()[0], partDmc.getParentInfo());
|
|
||||||
if (castInfo != null)
|
|
||||||
parentCtx = createCastedExpression(parentCtx, castInfo);
|
|
||||||
getRealSubExpressions(
|
getRealSubExpressions(
|
||||||
parentCtx,
|
createExpression(partDmc.getParents()[0], partDmc.getParentInfo()),
|
||||||
partStartIndex + startIndex1,
|
partStartIndex + startIndex1,
|
||||||
Math.min(length1, partLength - startIndex1),
|
Math.min(length1, partLength - startIndex1),
|
||||||
rm);
|
rm);
|
||||||
|
@ -1711,18 +1669,10 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
return ( diff > length ) ? length : diff ;
|
return ( diff > length ) ? length : diff ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IndexedPartitionDMC createIndexedPartition(
|
private IndexedPartitionDMC createIndexedPartition(IDMContext ctx, ExpressionInfo info, int index, int length) {
|
||||||
IDMContext ctx,
|
|
||||||
ExpressionInfo info,
|
|
||||||
int index,
|
|
||||||
int length,
|
|
||||||
CastInfo castInfo) {
|
|
||||||
IFrameDMContext frameDmc = DMContexts.getAncestorOfType(ctx, IFrameDMContext.class);
|
IFrameDMContext frameDmc = DMContexts.getAncestorOfType(ctx, IFrameDMContext.class);
|
||||||
if (frameDmc != null) {
|
if (frameDmc != null) {
|
||||||
IndexedPartitionDMC partDmc =
|
return new IndexedPartitionDMC(getSession().getId(), info, frameDmc, index, length);
|
||||||
new IndexedPartitionDMC(getSession().getId(), info, frameDmc, index, length);
|
|
||||||
return (castInfo != null) ?
|
|
||||||
new CastedIndexedPartitionDMC(partDmc, index, length, castInfo) : partDmc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IMIExecutionDMContext.class);
|
IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(ctx, IMIExecutionDMContext.class);
|
||||||
|
@ -1733,17 +1683,11 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
|
||||||
MIStack stackService = getServicesTracker().getService(MIStack.class);
|
MIStack stackService = getServicesTracker().getService(MIStack.class);
|
||||||
if (stackService != null) {
|
if (stackService != null) {
|
||||||
frameDmc = stackService.createFrameDMContext(execCtx, 0);
|
frameDmc = stackService.createFrameDMContext(execCtx, 0);
|
||||||
IndexedPartitionDMC partDmc =
|
return new IndexedPartitionDMC(getSession().getId(), info, frameDmc, index, length);
|
||||||
new IndexedPartitionDMC(getSession().getId(), info, frameDmc, index, length);
|
|
||||||
return (castInfo != null) ?
|
|
||||||
new CastedIndexedPartitionDMC(partDmc, index, length, castInfo) : partDmc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexedPartitionDMC partDmc =
|
return new IndexedPartitionDMC(getSession().getId(), info, ctx, index, length);
|
||||||
new IndexedPartitionDMC(getSession().getId(), info, ctx, index, length);
|
|
||||||
return (castInfo != null) ?
|
|
||||||
new CastedIndexedPartitionDMC(partDmc, index, length, castInfo) : partDmc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getRealSubExpressionCount(IExpressionDMContext dmc, int numChildLimit, final DataRequestMonitor<Integer> rm) {
|
private void getRealSubExpressionCount(IExpressionDMContext dmc, int numChildLimit, final DataRequestMonitor<Integer> rm) {
|
||||||
|
|
|
@ -1337,9 +1337,6 @@ public class MIVariableManager implements ICommandControl {
|
||||||
int castingIndex = 0;
|
int castingIndex = 0;
|
||||||
// in case of casts, need to resolve that before dereferencing, to be safe
|
// in case of casts, need to resolve that before dereferencing, to be safe
|
||||||
if (exprDmc instanceof ICastedExpressionDMContext) {
|
if (exprDmc instanceof ICastedExpressionDMContext) {
|
||||||
// When casting, if we are dealing with a resulting array, we should surround
|
|
||||||
// it with parenthesis before we subscript it.
|
|
||||||
exprName = '(' + exprName + ')';
|
|
||||||
castingIndex = ((ICastedExpressionDMContext)exprDmc).getCastInfo().getArrayStartIndex();
|
castingIndex = ((ICastedExpressionDMContext)exprDmc).getCastInfo().getArrayStartIndex();
|
||||||
}
|
}
|
||||||
if (exprDmc instanceof IIndexedPartitionDMContext) {
|
if (exprDmc instanceof IIndexedPartitionDMContext) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue