1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

Bug 381868 - CDT debugger 'Display As Array...' does not show elements

of large array

Change-Id: I64e6a9c2f4966555fbe10dd6c0512a26bcf4171a
Reviewed-on: https://git.eclipse.org/r/6295
Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
This commit is contained in:
Mikhail Khodjaiants 2012-06-07 14:11:28 -04:00
parent c76e7de87a
commit 876ea78cbf

View file

@ -498,6 +498,20 @@ 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.
@ -1554,6 +1568,8 @@ 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) {
@ -1562,7 +1578,8 @@ 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 );
@ -1574,6 +1591,9 @@ 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;
@ -1600,7 +1620,8 @@ 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);
@ -1613,8 +1634,11 @@ 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(
createExpression(partDmc.getParents()[0], partDmc.getParentInfo()), parentCtx,
partStartIndex + startIndex1, partStartIndex + startIndex1,
Math.min(length1, partLength - startIndex1), Math.min(length1, partLength - startIndex1),
rm); rm);
@ -1687,10 +1711,18 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
return ( diff > length ) ? length : diff ; return ( diff > length ) ? length : diff ;
} }
private IndexedPartitionDMC createIndexedPartition(IDMContext ctx, ExpressionInfo info, int index, int length) { private IndexedPartitionDMC createIndexedPartition(
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) {
return new IndexedPartitionDMC(getSession().getId(), info, frameDmc, index, length); IndexedPartitionDMC partDmc =
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);
@ -1701,11 +1733,17 @@ 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);
return new IndexedPartitionDMC(getSession().getId(), info, frameDmc, index, length); IndexedPartitionDMC partDmc =
new IndexedPartitionDMC(getSession().getId(), info, frameDmc, index, length);
return (castInfo != null) ?
new CastedIndexedPartitionDMC(partDmc, index, length, castInfo) : partDmc;
} }
} }
return new IndexedPartitionDMC(getSession().getId(), info, ctx, index, length); IndexedPartitionDMC partDmc =
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) {