From 06854adaefc92d257834439052a2ffcbfa720ed3 Mon Sep 17 00:00:00 2001 From: Ling Wang Date: Wed, 7 Aug 2013 01:32:48 -0500 Subject: [PATCH] Bug 414519: [Memory View] user specified start address is not honored. Change-Id: I0e72b6a4d685197191427c93b67b9a96d80da682 Signed-off-by: Ling Wang Reviewed-on: https://git.eclipse.org/r/15214 Reviewed-by: Marc Khouzam IP-Clean: Marc Khouzam Tested-by: Marc Khouzam --- .../ui/memory/floatingpoint/Rendering.java | 21 ++++++++++++++----- .../ui/memory/traditional/Rendering.java | 16 +++++++++++++- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java index bf6ba9cdecd..625c6562c4b 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.floatingpoint/src/org/eclipse/cdt/debug/ui/memory/floatingpoint/Rendering.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010, 2012 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2014 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -167,13 +167,24 @@ public class Rendering extends Composite implements IDebugEventSetListener if (fParent.getMemoryBlock() != null) { + // This is base address from user. + // Honor it if the block has no limits or the base is within the block limits. + // Fix Bug 414519. + BigInteger base = fParent.getBigBaseAddress(); + fViewportAddress = fParent.getMemoryBlockStartAddress(); // The viewport address will be null if memory may be retrieved at any // address less than this memory block's base. If so use the base address. - if (fViewportAddress == null) - fViewportAddress = fParent.getBigBaseAddress(); + fViewportAddress = base; + else { + BigInteger blockEndAddr = fParent.getMemoryBlockEndAddress(); + if (base.compareTo(fViewportAddress) > 0) { + if (blockEndAddr == null || base.compareTo(blockEndAddr) < 0) + fViewportAddress = base; + } + } fBaseAddress = fViewportAddress; } @@ -755,10 +766,10 @@ public class Rendering extends Composite implements IDebugEventSetListener } @SuppressWarnings("hiding") - private HashMap fEditBuffer = new HashMap(); + private HashMap fEditBuffer = new HashMap<>(); private boolean fDisposed = false; private Object fLastQueued = null; - private Vector fQueue = new Vector(); + private Vector fQueue = new Vector<>(); protected MemoryUnit fCache = null; protected MemoryUnit fHistoryCache[] = new MemoryUnit[0]; protected int fHistoryDepth = 0; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java index 6ec88963edf..db8ba619c0b 100755 --- a/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.traditional/src/org/eclipse/cdt/debug/ui/memory/traditional/Rendering.java @@ -8,6 +8,7 @@ * Contributors: * Ted R Williams (Wind River Systems, Inc.) - initial implementation * Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730) + * Ling Wang (Silicon Laboratories) - Honor start address (Bug 414519) *******************************************************************************/ package org.eclipse.cdt.debug.ui.memory.traditional; @@ -176,12 +177,25 @@ public class Rendering extends Composite implements IDebugEventSetListener // initialize the viewport start if(fParent.getMemoryBlock() != null) { + // This is base address from user. + // Honor it if the block has no limits or the base is within the block limits. + // Fix Bug 414519. + BigInteger base = fParent.getBigBaseAddress(); + fViewportAddress = fParent.getMemoryBlockStartAddress(); // this will be null if memory may be retrieved at any address less than // this memory block's base. if so use the base address. if (fViewportAddress == null) - fViewportAddress = fParent.getBigBaseAddress(); + fViewportAddress = base; + else { + BigInteger blockEndAddr = fParent.getMemoryBlockEndAddress(); + if (base.compareTo(fViewportAddress) > 0) { + if (blockEndAddr == null || base.compareTo(blockEndAddr) < 0) + fViewportAddress = base; + } + } + fBaseAddress = fViewportAddress; }