Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for bug 26595

Fix for bug 26595.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.36
diff -u -r1.36 ChangeLog
--- ChangeLog 20 Nov 2002 14:41:58 -0000 1.36
+++ ChangeLog 20 Nov 2002 21:46:41 -0000
@@ -1,3 +1,9 @@
+2002-11-20 Mikhail Khodjaiants
+ Fix for bug 26595.
+ * src/.../mi/core/cdi/MemoryManager.java (compareBlocks):
+ If the start address of a memory block has changed fir 'changed' event
+ only for the corresponding bytes of the overlapping area of new and old blocks.

 2002-11-19 Alain Magloire
 
  * src/.../mi/core/cdi/MemoryManager.java (compareBlocks):
Index: src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java,v
retrieving revision 1.11
diff -u -r1.11 MemoryManager.java
--- src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java 20 Nov 2002 14:41:50 -0000 1.11
+++ src/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java 20 Nov 2002 21:46:42 -0000
@@ -58,10 +58,11 @@
   */
  public Long[] update(MemoryBlock block, List aList) throws CDIException {
   MemoryBlock newBlock = cloneBlock(block);
+  boolean newAddress = ( newBlock.getStartAddress() != block.getStartAddress() );
   Long[] array = compareBlocks(block, newBlock);
   // Update the block MIDataReadMemoryInfo.
   block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo());
-  if (array.length > 0) {
+  if (array.length > 0 || newAddress) {
    if (aList != null) {
     aList.add(new MIMemoryChangedEvent(array));
    } else {
@@ -90,13 +91,14 @@
   byte[] oldBytes = oldBlock.getBytes();
   byte[] newBytes = newBlock.getBytes();
   List aList = new ArrayList(newBytes.length);
-  for (int i = 0; i < newBytes.length; i++) {
-   if (i < oldBytes.length) {
-    if (oldBytes[i] != newBytes[i]) {
-     aList.add(new Long(newBlock.getStartAddress() + i));
+  long diff = newBlock.getStartAddress() - oldBlock.getStartAddress();
+  if ( Math.abs( diff ) < newBytes.length ) {
+   for (int i = 0; i < newBytes.length; i++) {
+    if (i + (int)diff < oldBytes.length && i + (int)diff >= 0) {
+     if (oldBytes[i + (int)diff] != newBytes[i]) {
+      aList.add(new Long(newBlock.getStartAddress() + i));
+     }
     }
-   } else {
-    aList.add(new Long(newBlock.getStartAddress() + i));
    }
   }
   return (Long[])aList.toArray(new Long[0]);


Back to the top