Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantha Chan2008-04-03 11:36:32 -0400
committerSamantha Chan2008-04-03 11:36:32 -0400
commite4a5b88f850e03285b4868a6ab39105d71ee1ffa (patch)
tree98adec80a4208317f22eab7b3c89dbb3bb118240
parentb9aeaa7c3dee67402abf48c9b5967e2fd32aba76 (diff)
downloadeclipse.platform.debug-e4a5b88f850e03285b4868a6ab39105d71ee1ffa.tar.gz
eclipse.platform.debug-e4a5b88f850e03285b4868a6ab39105d71ee1ffa.tar.xz
eclipse.platform.debug-e4a5b88f850e03285b4868a6ab39105d71ee1ffa.zip
Bug 225336 - [Memory View] MemoryView mistreats small bounded memory blocks
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java15
2 files changed, 31 insertions, 1 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
index 60641845e..65c221efa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
@@ -178,6 +178,11 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
// re-calculate buffer start since we may not have enough lines to popoulate the view
bufferStart = bufferEnd.subtract(BigInteger.valueOf(descriptor.getNumLines()*addressableUnitsPerLine));
bufferStart = bufferStart.subtract(BigInteger.valueOf(descriptor.getPreBuffer()*addressableUnitsPerLine));
+
+ // if after adjusting buffer start, it goes before the memory block start
+ // address, adjust it back
+ if (bufferStart.compareTo(mbStart) < 0)
+ bufferStart = mbStart;
}
}
@@ -197,13 +202,23 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
if (bufferEnd.compareTo(mbEnd) > 0)
{
bufferStart = mbEnd.subtract(BigInteger.valueOf((descriptor.getNumLines()-1)*addressableUnitsPerLine));
+ bufferEnd = mbEnd;
+
+ // after adjusting buffer start, check if it's smaller than memory block's start address
+ if (bufferStart.compareTo(mbStart) < 0)
+ bufferStart = mbStart;
}
// buffer end must be greater than buffer start
if (bufferEnd.compareTo(bufferStart) <= 0)
throw new DebugException(DebugUIPlugin.newErrorStatus(DebugUIMessages.TableRenderingContentProvider_2, null));
- int numLines = descriptor.getNumLines();
+ int numLines = descriptor.getNumLines();
+ int bufferNumLines = bufferEnd.subtract(bufferStart).divide(BigInteger.valueOf(addressableUnitsPerLine)).intValue()+1;
+
+ if (bufferNumLines < numLines)
+ numLines = bufferNumLines;
+
// get stoarage to fit the memory view tab size
return getMemoryToFitTable(bufferStart, numLines, context);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
index b97cf42ba..2174a5e12 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
@@ -232,6 +232,11 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
bufferStart = bufferEnd.subtract(BigInteger.valueOf(fInput.getNumLines()*addressableUnitsPerLine));
bufferStart = bufferStart.subtract(BigInteger.valueOf(fInput.getPreBuffer()*addressableUnitsPerLine));
}
+
+ // if after adjusting buffer start, it goes before the memory block start
+ // address, adjust it back
+ if (bufferStart.compareTo(mbStart) < 0)
+ bufferStart = mbStart;
}
// buffer end must be greater than buffer start
@@ -250,6 +255,11 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
if (bufferEnd.compareTo(mbEnd) > 0)
{
bufferStart = mbEnd.subtract(BigInteger.valueOf((fInput.getNumLines()-1)*addressableUnitsPerLine));
+ bufferEnd = mbEnd;
+
+ // after adjusting buffer start, check if it's smaller than memory block's start address
+ if (bufferStart.compareTo(mbStart) < 0)
+ bufferStart = mbStart;
}
// buffer end must be greater than buffer start
@@ -257,6 +267,11 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
throw new DebugException(DebugUIPlugin.newErrorStatus(DebugUIMessages.TableRenderingContentProvider_2, null));
int numLines = fInput.getNumLines();
+ int bufferNumLines = bufferEnd.subtract(bufferStart).divide(BigInteger.valueOf(addressableUnitsPerLine)).intValue()+1;
+
+ if (bufferNumLines < numLines)
+ numLines = bufferNumLines;
+
// get stoarage to fit the memory view tab size
getMemoryToFitTable(bufferStart, numLines, fInput.isUpdateDelta());
}

Back to the top