mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Bug 323630 - Expanding registers in the register view triggers an infinite recursion loop in Eclipse/CDI
This commit is contained in:
parent
6b44ff1ead
commit
4f83e760c3
6 changed files with 65 additions and 26 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.debug.mi.core; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.debug.mi.core; singleton:=true
|
||||||
Bundle-Version: 7.0.0.qualifier
|
Bundle-Version: 7.1.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.debug.mi.core.MIPlugin
|
Bundle-Activator: org.eclipse.cdt.debug.mi.core.MIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
* Copyright (c) 2000, 2010 QNX Software Systems 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
|
||||||
|
@ -449,10 +449,12 @@ public class RegisterManager extends Manager {
|
||||||
private Register findRegister(RegisterDescriptor rd) throws CDIException {
|
private Register findRegister(RegisterDescriptor rd) throws CDIException {
|
||||||
Target target = (Target)rd.getTarget();
|
Target target = (Target)rd.getTarget();
|
||||||
String name = rd.getName();
|
String name = rd.getName();
|
||||||
|
String fullName = rd.getFullName();
|
||||||
int position = rd.getPosition();
|
int position = rd.getPosition();
|
||||||
Register[] regs = getRegisters(target);
|
Register[] regs = getRegisters(target);
|
||||||
for (int i = 0; i < regs.length; i++) {
|
for (int i = 0; i < regs.length; i++) {
|
||||||
if (regs[i].getName().equals(name)
|
if (regs[i].getName().equals(name)
|
||||||
|
&& regs[i].getFullName().equals(fullName)
|
||||||
&& regs[i].getCastingArrayStart() == rd.getCastingArrayStart()
|
&& regs[i].getCastingArrayStart() == rd.getCastingArrayStart()
|
||||||
&& regs[i].getCastingArrayEnd() == rd.getCastingArrayEnd()
|
&& regs[i].getCastingArrayEnd() == rd.getCastingArrayEnd()
|
||||||
&& VariableDescriptor.equalsCasting(regs[i], rd)) {
|
&& VariableDescriptor.equalsCasting(regs[i], rd)) {
|
||||||
|
|
|
@ -154,7 +154,12 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
return fMIVar;
|
return fMIVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getHexAddress() throws CDIException {
|
/**
|
||||||
|
* @return The address of this variable as hex string if available, otherwise an empty string.
|
||||||
|
* @noreference This method is not intended to be referenced by clients outside CDT.
|
||||||
|
* @since 7.1
|
||||||
|
*/
|
||||||
|
public String getHexAddress() throws CDIException {
|
||||||
if (hexAddress != null) {
|
if (hexAddress != null) {
|
||||||
return hexAddress;
|
return hexAddress;
|
||||||
}
|
}
|
||||||
|
@ -162,8 +167,13 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
String qualName = "&(" + getQualifiedName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
String qualName = "&(" + getQualifiedName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
VariableDescriptor desc = createDescriptor((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(), getName(), qualName, getPosition(), getStackDepth());
|
VariableDescriptor desc = createDescriptor((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(), getName(), qualName, getPosition(), getStackDepth());
|
||||||
Variable v = vm.createVariable( desc );
|
Variable v = vm.createVariable( desc );
|
||||||
v.setFormat(ICDIFormat.HEXADECIMAL);
|
// make sure to avoid infinite recursion. see bug 323630
|
||||||
hexAddress = v.getValue().getValueString();
|
if (v != this) {
|
||||||
|
v.setFormat(ICDIFormat.HEXADECIMAL);
|
||||||
|
hexAddress = v.getValue().getValueString();
|
||||||
|
} else {
|
||||||
|
hexAddress = ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
return hexAddress;
|
return hexAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +371,7 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
} else if (t instanceof ICDIReferenceType) {
|
} else if (t instanceof ICDIReferenceType) {
|
||||||
value = new ReferenceValue(this);
|
value = new ReferenceValue(this);
|
||||||
} else if (t instanceof ICDIArrayType) {
|
} else if (t instanceof ICDIArrayType) {
|
||||||
value = new ArrayValue(this, getHexAddress());
|
value = new ArrayValue(this);
|
||||||
} else if (t instanceof ICDIStructType) {
|
} else if (t instanceof ICDIStructType) {
|
||||||
value = new StructValue(this);
|
value = new StructValue(this);
|
||||||
} else {
|
} else {
|
||||||
|
@ -510,7 +520,8 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName()
|
||||||
*/
|
*/
|
||||||
public String getTypeName() throws CDIException {
|
@Override
|
||||||
|
public String getTypeName() throws CDIException {
|
||||||
if (fTypename == null) {
|
if (fTypename == null) {
|
||||||
fTypename = getMIVar().getType();
|
fTypename = getMIVar().getType();
|
||||||
if (fTypename == null || fTypename.length() == 0) {
|
if (fTypename == null || fTypename.length() == 0) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 QNX Software Systems and others.
|
* Copyright (c) 2000, 2010 QNX Software Systems 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
|
||||||
|
@ -34,6 +34,16 @@ public class ArrayValue extends DerivedValue implements ICDIArrayValue, ICDIPoin
|
||||||
|
|
||||||
private String hexAddress;
|
private String hexAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the array value object given a variable
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
* @since 7.1
|
||||||
|
*/
|
||||||
|
public ArrayValue(Variable v) {
|
||||||
|
super(v);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the array value object given a variable and the
|
* Construct the array value object given a variable and the
|
||||||
* hexadecimal address of the variable.
|
* hexadecimal address of the variable.
|
||||||
|
@ -41,21 +51,35 @@ public class ArrayValue extends DerivedValue implements ICDIArrayValue, ICDIPoin
|
||||||
* @param v
|
* @param v
|
||||||
* @param hexAddress
|
* @param hexAddress
|
||||||
*/
|
*/
|
||||||
public ArrayValue(Variable v, String hexAddress) {
|
public ArrayValue(Variable v, String address) {
|
||||||
super(v);
|
this(v);
|
||||||
if (hexAddress == null || hexAddress.trim().length()==0) {
|
hexAddress = address;
|
||||||
return;
|
|
||||||
} else if (hexAddress.startsWith("0x") || hexAddress.startsWith("0X")) { //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
this.hexAddress = hexAddress.substring(2);
|
|
||||||
} else {
|
|
||||||
this.hexAddress = hexAddress;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute array address as string.
|
||||||
|
*/
|
||||||
|
private String getAddressString() throws CDIException {
|
||||||
|
if (hexAddress != null)
|
||||||
|
return hexAddress;
|
||||||
|
|
||||||
|
String address = getVariable().getHexAddress();
|
||||||
|
if (address == null) {
|
||||||
|
address = ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (address.startsWith("0x") || address.startsWith("0X")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
hexAddress = address.substring(2);
|
||||||
|
} else {
|
||||||
|
hexAddress = address;
|
||||||
|
}
|
||||||
|
return hexAddress;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables()
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIValue#getVariables()
|
||||||
*/
|
*/
|
||||||
public ICDIVariable[] getVariables() throws CDIException {
|
@Override
|
||||||
|
public ICDIVariable[] getVariables() throws CDIException {
|
||||||
|
|
||||||
/* GDB is appallingly slow on array fetches. As as slow as 128 entries
|
/* GDB is appallingly slow on array fetches. As as slow as 128 entries
|
||||||
* per second on NT gdbs with slow processors. We need to set a timeout
|
* per second on NT gdbs with slow processors. We need to set a timeout
|
||||||
|
@ -102,12 +126,14 @@ public class ArrayValue extends DerivedValue implements ICDIArrayValue, ICDIPoin
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
|
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
|
||||||
*/
|
*/
|
||||||
public BigInteger pointerValue() throws CDIException {
|
public BigInteger pointerValue() throws CDIException {
|
||||||
if (hexAddress == null)
|
String address = getAddressString();
|
||||||
return null;
|
if (address.length() > 0 ){
|
||||||
try {
|
try {
|
||||||
return new BigInteger(hexAddress, 16);
|
return new BigInteger(address, 16);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<feature
|
<feature
|
||||||
id="org.eclipse.cdt.gnu.debug"
|
id="org.eclipse.cdt.gnu.debug"
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="6.1.0.qualifier"
|
version="7.1.0.qualifier"
|
||||||
provider-name="%providerName">
|
provider-name="%providerName">
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<feature id="org.eclipse.cdt.gnu.build" url="features/org.eclipse.cdt.gnu.build_7.0.0.@timeStamp@.jar" version="7.0.0.@timeStamp@">
|
<feature id="org.eclipse.cdt.gnu.build" url="features/org.eclipse.cdt.gnu.build_7.0.0.@timeStamp@.jar" version="7.0.0.@timeStamp@">
|
||||||
<category name="CDT Optional Features"/>
|
<category name="CDT Optional Features"/>
|
||||||
</feature>
|
</feature>
|
||||||
<feature id="org.eclipse.cdt.gnu.debug" url="features/org.eclipse.cdt.gnu.debug_6.1.0.@timeStamp@.jar" version="6.1.0.@timeStamp@">
|
<feature id="org.eclipse.cdt.gnu.debug" url="features/org.eclipse.cdt.gnu.debug_7.1.0.@timeStamp@.jar" version="7.1.0.@timeStamp@">
|
||||||
<category name="CDT Optional Features"/>
|
<category name="CDT Optional Features"/>
|
||||||
</feature>
|
</feature>
|
||||||
<feature id="org.eclipse.cdt.platform" url="features/org.eclipse.cdt.platform_7.1.0.@timeStamp@.jar" version="7.1.0.@timeStamp@">
|
<feature id="org.eclipse.cdt.platform" url="features/org.eclipse.cdt.platform_7.1.0.@timeStamp@.jar" version="7.1.0.@timeStamp@">
|
||||||
|
|
Loading…
Add table
Reference in a new issue