1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Bug 378729 - Should not fetch address of a register or convenience

variable

Change-Id: I41ed489ad3a1be39d9317245054a5f3fb82c08d5
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/15376
Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
IP-Clean: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
Tested-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
This commit is contained in:
Marc Khouzam 2013-08-12 13:02:55 -04:00
parent 767a83a455
commit 7e6df21d23
2 changed files with 35 additions and 11 deletions

View file

@ -234,6 +234,25 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
public void setChildCountLimit(int newLimit) {
this.childCountLimit = newLimit;
}
/**
* @return if this expression is part of the memory space or not.
* If it not part of the memory space, it won't have an address.
* @since 4.2
*/
public boolean inMemory() {
// Registers and convenience variables which both start with $
// are not part of memory. We care about the top-most parent
// as it is the only one that can be a register or convenience var.
if (getParent() == null) {
if (getRelExpr().startsWith("$")) { //$NON-NLS-1$
return false;
}
return true;
}
return getParent().inMemory();
}
}
/**
@ -1066,9 +1085,12 @@ public class MIExpressions extends AbstractDsfService implements IMIExpressions,
if (dmc instanceof MIExpressionDMC) {
MIExpressionDMC miDMC = (MIExpressionDMC) dmc;
if (miDMC.getExpressionInfo().hasDynamicAncestor()) {
if (miDMC.getExpressionInfo().hasDynamicAncestor() ||
!miDMC.getExpressionInfo().inMemory()) {
// For children of dynamic varobjs, there is no full expression that gdb
// could evaluate in order to provide address and size.
// Also, if an expression is not in memory, such as a register
// or a GDB convenience variable, there is no address to return
rm.setData(new InvalidDMAddress());
rm.done();
return;

View file

@ -518,8 +518,9 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
protected void handleSuccess() {
// Figure out which memory area was modified
IExpressionDMAddress expression = getData();
final int count = expression.getSize();
IAddress expAddress = expression.getAddress();
if (expAddress != IExpressions.IExpressionDMLocation.INVALID_ADDRESS) {
final int count = expression.getSize();
final Addr64 address;
if (expAddress instanceof Addr64)
address = (Addr64) expAddress;
@ -530,6 +531,7 @@ public class MIMemory extends AbstractDsfService implements IMemory, ICachingSer
getMemoryCache(memoryDMC).refreshMemory(memoryDMC, address, 0, 1, count, true,
new RequestMonitor(getExecutor(), null));
}
}
});
}
}