1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

Bugzilla 294779.

This commit is contained in:
Randy Rohrbach 2009-11-10 19:16:21 +00:00
parent 14d210a876
commit 7bd060b64d

View file

@ -316,16 +316,15 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
// cell is highlighted (and the delta sigh is shown). // cell is highlighted (and the delta sigh is shown).
if (fBlock != null && newLength > 0) { if (fBlock != null && newLength > 0) {
switch (fBlockAddress.compareTo(address)) { switch (fBlockAddress.compareTo(address)) {
// Cached block begins before the retrieved block location // case : Cached block begins before the retrieved block location
// //
// <--- fLength --------------------------------------------------> // <--- fLength -------------------------------------------------->
// +--------------------------------------------------------------+ // +--------------------------------------------------------------+
// | Cached data from previous retrieve | // | Cached data from previous retrieve |
// | | // | |
// | <------------------ length ----------------------------->| // | <------------------ length -----------------------> |
// | <------------------ newLength --------------------> |
// | +-------------------------------------------------+ | // | +-------------------------------------------------+ |
// | | | | // | |<----------------- newLength ------------------->| |
// | | Newly retrieved data | | // | | Newly retrieved data | |
// |<-+->+-------------------------------------------------+ | // |<-+->+-------------------------------------------------+ |
// | | address | // | | address |
@ -333,9 +332,8 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
// | +--- bigDistance/distance | // | +--- bigDistance/distance |
// | | // | |
// | <------------------ length ----------------------------->| // | <------------------ length ----------------------------->|
// | <------------------ newLength -------------------------->|
// | +--------------------------------------------------------+ // | +--------------------------------------------------------+
// | | | // | |<----------------- newLength -------------------------->|
// | | Newly retrieved data | // | | Newly retrieved data |
// |<-+->+--------------------------------------------------------+ // |<-+->+--------------------------------------------------------+
// | | address | // | | address |
@ -355,44 +353,28 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
// fBlockAddress // fBlockAddress
case -1: case -1:
{ {
// Determine the distance between the cached and the // Determine the distance between the cached and the requested block addresses
// requested block addresses // If the distance does not exceed the length of the cached block, then there
// is some overlap between the blocks and we have to mark the changed bytes.
BigInteger bigDistance = address.subtract(fBlockAddress); BigInteger bigDistance = address.subtract(fBlockAddress);
// If the distance does not exceed the length of the cached block,
// then there is some overlap between the blocks and we have to
// mark the changed bytes (if applicable)
if (bigDistance.compareTo(BigInteger.valueOf(fLength)) == -1) { if (bigDistance.compareTo(BigInteger.valueOf(fLength)) == -1) {
// Here we can reasonably assume that java integers are OK // Calculate the length of the data we are going to examine/update
int distance = bigDistance.intValue(); int distance = bigDistance.intValue();
int length = fLength - distance; int length = fLength - distance;
if ( length > newLength ) { if ( length > newLength ) {
length = newLength; length = newLength;
} }
// Work by cells of 4 bytes // Process each cell, updating the status and history/change
for (int i = 0; i < length && i + 4 < newLength; i += 4) { for (int i = 0; i < length; i++) {
// Determine if any byte within the cell was modified if ( i < newLength ) {
boolean changed = false; newBlock[i].setFlags(fBlock[distance + i].getFlags());
for (int j = i; j < (i + 4) && j < length; j++) { if (newBlock[i].getValue() != fBlock[distance + i].getValue()) {
if ( j < newLength ) { newBlock[i].setHistoryKnown(true);
newBlock[j].setFlags(fBlock[distance + j].getFlags()); newBlock[i].setChanged(true);
if (newBlock[j].getValue() != fBlock[distance + j].getValue()) {
changed = true;
} }
} }
} }
// If so, flag the whole cell as modified
if (changed) {
for (int j = i; j < (i + 4) && j < length; j++) {
if ( j < newLength ) {
newBlock[j].setHistoryKnown(true);
newBlock[j].setChanged(true);
}
}
}
}
} }
break; break;
} }
@ -402,23 +384,20 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
// in to it. // in to it.
// //
// Case 0: // Case 0:
//
// <--- fLength --------------------------------------------------> // <--- fLength -------------------------------------------------->
// +--------------------------------------------------------------+ // +--------------------------------------------------------------+
// | Cached data from previous retrieve | // | Cached data from previous retrieve |
// | | // | |
// |<-- length ----------------> | // |<-- length ----------------> |
// |<-- newLength -------------> |
// +---------------------------+ | // +---------------------------+ |
// | | | // |<-- newLength ------------>| |
// | Newly retrieve data | | // | Newly retrieve data | |
// +---------------------------+ | // +---------------------------+ |
// |address | // |address |
// | | // | |
// |<--------------------- length ------------------------------->| // |<--------------------- length ------------------------------->|
// |<--------------------- newLength ---------------------------->|
// +--------------------------------------------------------------+ // +--------------------------------------------------------------+
// | | // |<--------------------- newLength ---------------------------->|
// | Newly retrieve data | // | Newly retrieve data |
// +--------------------------------------------------------------+ // +--------------------------------------------------------------+
// |address | // |address |
@ -441,7 +420,7 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
// | | // | |
// |<----------------------- length ----------------------------->| // |<----------------------- length ----------------------------->|
// +---------------------------------------------------------------------+ // +---------------------------------------------------------------------+
// | <----------------------------- newLength -------------------------->| // |<------------------------------ newLength -------------------------->|
// | Newly retrieved data | // | Newly retrieved data |
// +---------------------------------------------------------------------+ // +---------------------------------------------------------------------+
// address| | // address| |
@ -459,49 +438,32 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
case 0: case 0:
case 1: case 1:
{ {
// Determine the distance between the cached and the // Determine the distance between the requested block and the cache block
// requested block addresses // If the distance does not exceed the length of the new block, then there
// is some overlap between the blocks and we have to update the blanks and
// possibly note they are changed.
BigInteger bigDistance = fBlockAddress.subtract(address); BigInteger bigDistance = fBlockAddress.subtract(address);
// If the distance does not exceed the length of the new block,
// then there is some overlap between the blocks and we have to
// mark the changed bytes (if applicable)
if (bigDistance.compareTo(BigInteger.valueOf(newLength)) == -1) { if (bigDistance.compareTo(BigInteger.valueOf(newLength)) == -1) {
// Here we can reasonably assume that java integers are OK // Calculate the length of the data we are going to examine/update
int distance = bigDistance.intValue(); int distance = bigDistance.intValue();
int length = newLength - distance; int length = newLength - distance;
if ( length > fBlock.length ) { if ( length > fBlock.length ) {
length = fBlock.length; length = fBlock.length;
} }
// Work by cells of 4 bytes // Process each cell, updating the status and history/change
for (int i = 0; i < length && distance + i + 4 < newLength; i += 4) { for (int i = 0; i < length; i++) {
// Determine if any byte within the cell was modified if ( (distance + i) < newLength ) {
boolean changed = false; newBlock[distance + i].setFlags(fBlock[i].getFlags());
for (int j = i; j < (i + 4) && j < length; j++) { if (newBlock[distance + i].getValue() != fBlock[i].getValue()) {
if ( ( distance + j ) < newLength ) { newBlock[distance + i].setHistoryKnown(true);
newBlock[distance + j].setFlags(fBlock[j].getFlags()); newBlock[distance + i].setChanged(true);
if (newBlock[distance + j].getValue() != fBlock[j].getValue()) {
changed = true;
}
}
}
// If so, flag the whole cell as modified
if (changed) {
for (int j = i; j < (i + 4) && j < length; j++) {
if ( ( distance + j ) < newLength ) {
newBlock[distance + j].setHistoryKnown(true);
newBlock[distance + j].setChanged(true);
}
} }
} }
} }
} }
break; break;
} }
default:
break;
} }
} }
@ -510,10 +472,12 @@ public class DsfMemoryBlock extends PlatformObject implements IMemoryBlockExtens
fBlockAddress = address; fBlockAddress = address;
fLength = newLength; fLength = newLength;
if (fUpdatePolicy.equals(DsfMemoryBlock.UPDATE_POLICY_BREAKPOINT)) if (fUpdatePolicy.equals(DsfMemoryBlock.UPDATE_POLICY_BREAKPOINT)) {
fUseCachedData = true; fUseCachedData = true;
else if (fUpdatePolicy.equals(DsfMemoryBlock.UPDATE_POLICY_MANUAL)) }
else if (fUpdatePolicy.equals(DsfMemoryBlock.UPDATE_POLICY_MANUAL)) {
fUseCachedData = true; fUseCachedData = true;
}
return fBlock; return fBlock;
} }