mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Bugzilla 294779.
This commit is contained in:
parent
14d210a876
commit
7bd060b64d
1 changed files with 41 additions and 77 deletions
|
@ -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,61 +438,46 @@ 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the internal state
|
// Update the internal state
|
||||||
fBlock = newBlock;
|
fBlock = newBlock;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue