Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2010-09-08 03:04:58 -0400
committerAnton Leherbauer2010-09-08 03:04:58 -0400
commit4f83e760c3b32f2d43806c28a30c463e0c7f470a (patch)
treebeceb284b1d658852c65de614a0f809d487eae15
parent6b44ff1ead0540a0a4fe20ad93933c77609f5702 (diff)
downloadorg.eclipse.cdt-4f83e760c3b32f2d43806c28a30c463e0c7f470a.tar.gz
org.eclipse.cdt-4f83e760c3b32f2d43806c28a30c463e0c7f470a.tar.xz
org.eclipse.cdt-4f83e760c3b32f2d43806c28a30c463e0c7f470a.zip
Bug 323630 - Expanding registers in the register view triggers an infinite recursion loop in Eclipse/CDI
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF2
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java4
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java21
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java58
-rw-r--r--debug/org.eclipse.cdt.gnu.debug-feature/feature.xml2
-rw-r--r--releng/org.eclipse.cdt.releng/buildsite.xml2
6 files changed, 64 insertions, 25 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
index d9376777ab..d078a10761 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
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-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java
index 372dc4d50c..0af48e3739 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/RegisterManager.java
@@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -449,10 +449,12 @@ public class RegisterManager extends Manager {
private Register findRegister(RegisterDescriptor rd) throws CDIException {
Target target = (Target)rd.getTarget();
String name = rd.getName();
+ String fullName = rd.getFullName();
int position = rd.getPosition();
Register[] regs = getRegisters(target);
for (int i = 0; i < regs.length; i++) {
if (regs[i].getName().equals(name)
+ && regs[i].getFullName().equals(fullName)
&& regs[i].getCastingArrayStart() == rd.getCastingArrayStart()
&& regs[i].getCastingArrayEnd() == rd.getCastingArrayEnd()
&& VariableDescriptor.equalsCasting(regs[i], rd)) {
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
index 6e0665c7be..03d7472d94 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Variable.java
@@ -154,7 +154,12 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
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) {
return hexAddress;
}
@@ -162,8 +167,13 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
String qualName = "&(" + getQualifiedName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
VariableDescriptor desc = createDescriptor((Target)getTarget(), (Thread)getThread(), (StackFrame)getStackFrame(), getName(), qualName, getPosition(), getStackDepth());
Variable v = vm.createVariable( desc );
- v.setFormat(ICDIFormat.HEXADECIMAL);
- hexAddress = v.getValue().getValueString();
+ // make sure to avoid infinite recursion. see bug 323630
+ if (v != this) {
+ v.setFormat(ICDIFormat.HEXADECIMAL);
+ hexAddress = v.getValue().getValueString();
+ } else {
+ hexAddress = ""; //$NON-NLS-1$
+ }
return hexAddress;
}
@@ -361,7 +371,7 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
} else if (t instanceof ICDIReferenceType) {
value = new ReferenceValue(this);
} else if (t instanceof ICDIArrayType) {
- value = new ArrayValue(this, getHexAddress());
+ value = new ArrayValue(this);
} else if (t instanceof ICDIStructType) {
value = new StructValue(this);
} else {
@@ -510,7 +520,8 @@ public abstract class Variable extends VariableDescriptor implements ICDIVariabl
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableDescriptor#getTypeName()
*/
- public String getTypeName() throws CDIException {
+ @Override
+ public String getTypeName() throws CDIException {
if (fTypename == null) {
fTypename = getMIVar().getType();
if (fTypename == null || fTypename.length() == 0) {
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
index ade3236a74..1e75abb622 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ArrayValue.java
@@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,27 +35,51 @@ public class ArrayValue extends DerivedValue implements ICDIArrayValue, ICDIPoin
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
* hexadecimal address of the variable.
*
* @param v
* @param hexAddress
*/
- public ArrayValue(Variable v, String hexAddress) {
- super(v);
- if (hexAddress == null || hexAddress.trim().length()==0) {
- return;
- } else if (hexAddress.startsWith("0x") || hexAddress.startsWith("0X")) { //$NON-NLS-1$ //$NON-NLS-2$
- this.hexAddress = hexAddress.substring(2);
+ public ArrayValue(Variable v, String address) {
+ this(v);
+ hexAddress = address;
+ }
+
+ /**
+ * 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 {
- this.hexAddress = hexAddress;
+ hexAddress = address;
}
+ return hexAddress;
}
-
+
/* (non-Javadoc)
* @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
* 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()
*/
public BigInteger pointerValue() throws CDIException {
- if (hexAddress == null)
- return null;
- try {
- return new BigInteger(hexAddress, 16);
- } catch (NumberFormatException e) {
- return null;
+ String address = getAddressString();
+ if (address.length() > 0 ){
+ try {
+ return new BigInteger(address, 16);
+ } catch (NumberFormatException e) {
+ return null;
+ }
}
+ return null;
}
}
diff --git a/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml b/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml
index 32e2aab00e..680c8b75b8 100644
--- a/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml
+++ b/debug/org.eclipse.cdt.gnu.debug-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.cdt.gnu.debug"
label="%featureName"
- version="6.1.0.qualifier"
+ version="7.1.0.qualifier"
provider-name="%providerName">
<description>
diff --git a/releng/org.eclipse.cdt.releng/buildsite.xml b/releng/org.eclipse.cdt.releng/buildsite.xml
index c27e0e01a2..42cf03fc79 100644
--- a/releng/org.eclipse.cdt.releng/buildsite.xml
+++ b/releng/org.eclipse.cdt.releng/buildsite.xml
@@ -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@">
<category name="CDT Optional Features"/>
</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"/>
</feature>
<feature id="org.eclipse.cdt.platform" url="features/org.eclipse.cdt.platform_7.1.0.@timeStamp@.jar" version="7.1.0.@timeStamp@">

Back to the top