1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 432963 - [Memory] Cache associated to memory spaces context are not

being reset

Change-Id: I3b8de9008ce0d60cbdc2b04ad2c2bb9b844ee47b
Signed-off-by: Alvaro Sanchez-Leon <alvsan09@gmail.com>
Reviewed-on: https://git.eclipse.org/r/25206
This commit is contained in:
Alvaro Sanchez-Leon 2014-04-17 09:05:03 -04:00
parent a55526430c
commit 4c34ced31b

View file

@ -14,6 +14,7 @@
* John Dallaway - support for -data-write-memory-bytes (bug 387793) * John Dallaway - support for -data-write-memory-bytes (bug 387793)
* John Dallaway - memory cache update fix (bug 387688) * John Dallaway - memory cache update fix (bug 387688)
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730) * Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Support 16 bit addressable size (Bug 426730)
* Alvaro Sanchez-Leon (Ericsson AB) - [Memory] Memory space cache not being reset (Bug 432963)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.mi.service; package org.eclipse.cdt.dsf.mi.service;
@ -441,15 +442,10 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
// It is the memory context we want to clear, not only the context that resumed. The resumed context // It is the memory context we want to clear, not only the context that resumed. The resumed context
// is probably a thread but that running thread could have changed any memory within the memory // is probably a thread but that running thread could have changed any memory within the memory
// context. // context.
fCommandCache.reset(memoryDMC); if (memoryDMC != null) {
if (fMemoryCaches.containsKey(memoryDMC)) { fCommandCache.reset(memoryDMC);
// We do not want to use the call to getMemoryCache() here.
// This is because: memoryCacheReset(memoryDMC);
// 1- if there is not an entry already , we do not want to automatically
// create one, just to call reset() on it.
// 2- if memoryDMC == null, we do not want to create a cache
// entry for which the key is 'null'
fMemoryCaches.get(memoryDMC).reset();
} }
} }
} }
@ -464,15 +460,10 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
// It is the memory context we want to clear, not only the context that stopped. The stopped context // It is the memory context we want to clear, not only the context that stopped. The stopped context
// is probably a thread but that thread that ran could have changed any memory within the memory // is probably a thread but that thread that ran could have changed any memory within the memory
// context. // context.
fCommandCache.reset(memoryDMC); if (memoryDMC != null) {
if (fMemoryCaches.containsKey(memoryDMC)) { fCommandCache.reset(memoryDMC);
// We do not want to use the call to getMemoryCache() here.
// This is because: memoryCacheReset(memoryDMC);
// 1- if there is not an entry already , we do not want to automatically
// create one, just to call reset() on it.
// 2- if memoryDMC == null, we do not want to create a cache
// entry for which the key is 'null'
fMemoryCaches.get(memoryDMC).reset();
} }
} }
@ -1042,14 +1033,21 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
fCommandCache.reset(context); fCommandCache.reset(context);
IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(context, IMemoryDMContext.class); IMemoryDMContext memoryDMC = DMContexts.getAncestorOfType(context, IMemoryDMContext.class);
if (fMemoryCaches.containsKey(memoryDMC)) {
// We do not want to use the call to getMemoryCache() here. if (memoryDMC != null) {
// This is because: memoryCacheReset(memoryDMC);
// 1- if there is not an entry already , we do not want to automatically
// create one, just to call reset() on it.
// 2- if memoryDMC == null, we do not want to create a cache
// entry for which the key is 'null'
fMemoryCaches.get(memoryDMC).reset();
} }
} }
/**
* Reset the cache for the given memory context or any of its associated
* child memory space contexts (see Bug 432963)
*/
private void memoryCacheReset(IMemoryDMContext memoryDMC) {
for (IMemoryDMContext ctx : fMemoryCaches.keySet()) {
if (ctx != null && ctx.equals(memoryDMC) || DMContexts.isAncestorOf(ctx, memoryDMC)) {
fMemoryCaches.get(ctx).reset();
}
}
}
} }