1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 489216 - [memory view] memory space sometimes wrongly set, during

the restoring of memory monitors

Change-Id: Iab8554aef0ca24d2643440f1ba845eb253e29676
This commit is contained in:
Marc Dumais 2016-03-08 09:17:15 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent e3a5acb761
commit 16ed5ea208

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2010, 2015 Texas Instruments, Freescale Semiconductor and others. * Copyright (c) 2010, 2016 Texas Instruments, Freescale Semiconductor and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -445,7 +445,7 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
* @see org.eclipse.cdt.dsf.debug.model.DsfMemoryBlockRetrieval#createBlocksFromConfiguration(org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext, java.lang.String) * @see org.eclipse.cdt.dsf.debug.model.DsfMemoryBlockRetrieval#createBlocksFromConfiguration(org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext, java.lang.String)
*/ */
@Override @Override
protected void createBlocksFromConfiguration(IMemoryDMContext memoryCtx, String memento) throws CoreException { protected void createBlocksFromConfiguration(final IMemoryDMContext memoryCtx, String memento) throws CoreException {
// Parse the memento and validate its type // Parse the memento and validate its type
Element root = DebugPlugin.parseDocument(memento); Element root = DebugPlugin.parseDocument(memento);
@ -462,6 +462,7 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
NodeList expressionList = root.getChildNodes(); NodeList expressionList = root.getChildNodes();
int length = expressionList.getLength(); int length = expressionList.getLength();
for (int i = 0; i < length; ++i) { for (int i = 0; i < length; ++i) {
IMemoryDMContext memoryContext = memoryCtx;
Node node = expressionList.item(i); Node node = expressionList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
Element entry = (Element) node; Element entry = (Element) node;
@ -476,18 +477,18 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
memorySpaceID = null; memorySpaceID = null;
assert false : "should have either no memory space or a valid (non-empty) ID"; //$NON-NLS-1$ assert false : "should have either no memory space or a valid (non-empty) ID"; //$NON-NLS-1$
} else { } else {
if (memoryCtx instanceof IMemorySpaceDMContext) { if (memoryContext instanceof IMemorySpaceDMContext) {
//The context is already a memory space context, make sure the ids are consistent //The context is already a memory space context, make sure the ids are consistent
assert(((IMemorySpaceDMContext) memoryCtx).getMemorySpaceId().equals(memorySpaceID)); assert(((IMemorySpaceDMContext) memoryContext).getMemorySpaceId().equals(memorySpaceID));
} else { } else {
//Use a memory space context if the memory space id is valid //Use a memory space context if the memory space id is valid
memoryCtx = new MemorySpaceDMContext(getSession().getId(), memorySpaceID, memoryCtx); memoryContext = new MemorySpaceDMContext(getSession().getId(), memorySpaceID, memoryContext);
} }
} }
} }
BigInteger blockAddress = new BigInteger(address); BigInteger blockAddress = new BigInteger(address);
DsfMemoryBlock block = new GdbMemoryBlock(this, memoryCtx, getModelId(), label, blockAddress, getAddressableSize(memoryCtx), 0, memorySpaceID); DsfMemoryBlock block = new GdbMemoryBlock(this, memoryContext, getModelId(), label, blockAddress, getAddressableSize(memoryContext), 0, memorySpaceID);
blocks.add(block); blocks.add(block);
} }
} }