mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
[208278] endian cleanup
This commit is contained in:
parent
4cecd6c03d
commit
b72cf3c87a
1 changed files with 28 additions and 8 deletions
|
@ -761,7 +761,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
final MemoryByte readBytes[] = memoryBlock
|
final MemoryByte readBytes[] = memoryBlock
|
||||||
.getBytesFromAddress(startAddress, units);
|
.getBytesFromAddress(startAddress, units);
|
||||||
|
|
||||||
final MemoryByte cachedBytes[] = new MemoryByte[readBytes.length];
|
MemoryByte cachedBytes[] = new MemoryByte[readBytes.length];
|
||||||
for(int i = 0; i < readBytes.length; i++)
|
for(int i = 0; i < readBytes.length; i++)
|
||||||
cachedBytes[i] = new MemoryByte(readBytes[i].getValue(), readBytes[i].getFlags());
|
cachedBytes[i] = new MemoryByte(readBytes[i].getValue(), readBytes[i].getFlags());
|
||||||
|
|
||||||
|
@ -771,7 +771,27 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
setTargetLittleEndian(!cachedBytes[0].isBigEndian());
|
setTargetLittleEndian(!cachedBytes[0].isBigEndian());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reorder bytes within unit to be a sequential byte stream if the endian is already little
|
||||||
|
if(isTargetLittleEndian())
|
||||||
|
{
|
||||||
|
// there isn't an order when the unit size is one, so skip for performance
|
||||||
|
if(addressableSize.compareTo(BigInteger.ONE) != 0)
|
||||||
|
{
|
||||||
|
int unitSize = addressableSize.intValue();
|
||||||
|
MemoryByte cachedBytesAsByteSequence[] = new MemoryByte[cachedBytes.length];
|
||||||
|
for(int unit = 0; unit < units; unit++)
|
||||||
|
{
|
||||||
|
for(int unitbyte = 0; unitbyte < unitSize; unitbyte++)
|
||||||
|
{
|
||||||
|
cachedBytesAsByteSequence[unit * unitSize + unitbyte] = cachedBytes[unit * unitSize + unitSize - unitbyte];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cachedBytes = cachedBytesAsByteSequence;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final MemoryByte[] cachedBytesFinal = cachedBytes;
|
||||||
Display.getDefault().asyncExec(new Runnable()
|
Display.getDefault().asyncExec(new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -798,8 +818,8 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
|
|
||||||
for(int i = overlapLength.intValue(); i >= 0; i--)
|
for(int i = overlapLength.intValue(); i >= 0; i--)
|
||||||
{
|
{
|
||||||
cachedBytes[offsetIntoNew + i]
|
cachedBytesFinal[offsetIntoNew + i]
|
||||||
.setChanged(cachedBytes[offsetIntoNew
|
.setChanged(cachedBytesFinal[offsetIntoNew
|
||||||
+ i].getValue() != fHistoryCache.bytes[offsetIntoOld
|
+ i].getValue() != fHistoryCache.bytes[offsetIntoOld
|
||||||
+ i].getValue());
|
+ i].getValue());
|
||||||
}
|
}
|
||||||
|
@ -809,7 +829,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
fCache = new MemoryUnit();
|
fCache = new MemoryUnit();
|
||||||
fCache.start = startAddress;
|
fCache.start = startAddress;
|
||||||
fCache.end = endAddress;
|
fCache.end = endAddress;
|
||||||
fCache.bytes = cachedBytes;
|
fCache.bytes = cachedBytesFinal;
|
||||||
|
|
||||||
Rendering.this.redrawPanes();
|
Rendering.this.redrawPanes();
|
||||||
}
|
}
|
||||||
|
@ -1637,11 +1657,11 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
||||||
|
|
||||||
if(readable)
|
if(readable)
|
||||||
{
|
{
|
||||||
// see if we need to swap the data or not. if the bytes are BE
|
// bytes from the cache are stored as a sequential byte sequence regardless of target endian.
|
||||||
// and we want to view in LE then we need to swap. if the bytes
|
// the endian attribute tells us the recommended endian for display. the user may change this
|
||||||
// are LE and we want to view BE then we need to swap.
|
// from the default. if the endian is little, we must swap the byte order.
|
||||||
boolean needsSwap = false;
|
boolean needsSwap = false;
|
||||||
if ((isDisplayLittleEndian() && !isTargetLittleEndian()) || (!isDisplayLittleEndian() && isTargetLittleEndian()))
|
if(isDisplayLittleEndian())
|
||||||
needsSwap = true;
|
needsSwap = true;
|
||||||
|
|
||||||
switch(radix)
|
switch(radix)
|
||||||
|
|
Loading…
Add table
Reference in a new issue