Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2020-09-18 21:34:31 +0000
committerEugene Tarassov2020-09-18 21:34:31 +0000
commita40090618f602551ca7b6f0191e5d5757c1d1896 (patch)
treefb7d228e781a436bf78ed6c2e9c38be1b6878b4f
parent0f80b52b7a067b347c14a3420977a0e577022eda (diff)
downloadorg.eclipse.tcf-a40090618f602551ca7b6f0191e5d5757c1d1896.tar.gz
org.eclipse.tcf-a40090618f602551ca7b6f0191e5d5757c1d1896.tar.xz
org.eclipse.tcf-a40090618f602551ca7b6f0191e5d5757c1d1896.zip
TCF Debugger: fixed display of expression type class and size when the expression cannot be evaluated
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ExpressionsProxy.java37
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IExpressions.java7
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java87
3 files changed, 84 insertions, 47 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ExpressionsProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ExpressionsProxy.java
index cb92f41e7..50b456928 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ExpressionsProxy.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/ExpressionsProxy.java
@@ -84,6 +84,12 @@ public class ExpressionsProxy implements IExpressions {
return (String)props.get(PROP_TYPE);
}
+ public TypeClass getTypeClass() {
+ Number n = (Number)props.get(PROP_CLASS);
+ if (n != null) return toTypeClass(n.intValue());
+ return TypeClass.unknown;
+ }
+
public Map<String, Object> getProperties() {
return props;
}
@@ -126,20 +132,7 @@ public class ExpressionsProxy implements IExpressions {
public TypeClass getTypeClass() {
Number n = (Number)props.get(VAL_CLASS);
- if (n != null) {
- switch (n.intValue()) {
- case 1: return TypeClass.cardinal;
- case 2: return TypeClass.integer;
- case 3: return TypeClass.real;
- case 4: return TypeClass.pointer;
- case 5: return TypeClass.array;
- case 6: return TypeClass.composite;
- case 7: return TypeClass.enumeration;
- case 8: return TypeClass.function;
- case 9: return TypeClass.member_pointer;
- case 10: return TypeClass.complex;
- }
- }
+ if (n != null) return toTypeClass(n.intValue());
return TypeClass.unknown;
}
@@ -305,4 +298,20 @@ public class ExpressionsProxy implements IExpressions {
Collection<String> c = (Collection<String>)o;
return (String[])c.toArray(new String[c.size()]);
}
+
+ private static TypeClass toTypeClass(int n) {
+ switch (n) {
+ case 1: return TypeClass.cardinal;
+ case 2: return TypeClass.integer;
+ case 3: return TypeClass.real;
+ case 4: return TypeClass.pointer;
+ case 5: return TypeClass.array;
+ case 6: return TypeClass.composite;
+ case 7: return TypeClass.enumeration;
+ case 8: return TypeClass.function;
+ case 9: return TypeClass.member_pointer;
+ case 10: return TypeClass.complex;
+ }
+ return TypeClass.unknown;
+ }
}
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IExpressions.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IExpressions.java
index 521dcad7b..201449804 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IExpressions.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IExpressions.java
@@ -89,6 +89,12 @@ public interface IExpressions extends IService {
String getTypeID();
/**
+ * Get expression type class.
+ * @return type class.
+ */
+ ISymbols.TypeClass getTypeClass();
+
+ /**
* Check if the expression can be assigned a new value.
* @return true if can assign.
*/
@@ -120,6 +126,7 @@ public interface IExpressions extends IService {
PROP_BITS = "Bits",
PROP_SIZE = "Size",
PROP_TYPE = "Type",
+ PROP_CLASS = "Class",
PROP_CAN_ASSIGN = "CanAssign",
PROP_HAS_FUNC_CALL = "HasFuncCall";
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
index 479fa7275..58b8509f1 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java
@@ -666,20 +666,31 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
@Override
protected boolean startDataRetrieval() {
if (!type.validate(this)) return false;
- if (type.getData() == null) {
- if (!value.validate(this)) return false;
- IExpressions.Value val = value.getData();
- if (val != null && val.getValue() != null) {
- String s = getTypeName(val.getTypeClass(), val.getValue().length);
- if (s != null) {
- set(null, null, s);
- return true;
- }
+ if (type.getData() != null) {
+ StringBuffer bf = new StringBuffer();
+ if (!getTypeName(bf, type, model.isShowQualifiedTypeNamesEnabled(), this)) return false;
+ set(null, null, bf.toString());
+ return true;
+ }
+ if (!value.validate(this)) return false;
+ IExpressions.Value val = value.getData();
+ if (val != null && val.getValue() != null) {
+ String s = getTypeName(val.getTypeClass(), val.getValue().length);
+ if (s != null) {
+ set(null, null, s);
+ return true;
}
}
- StringBuffer bf = new StringBuffer();
- if (!getTypeName(bf, type, model.isShowQualifiedTypeNamesEnabled(), this)) return false;
- set(null, null, bf.toString());
+ if (!rem_expression.validate(this)) return false;
+ IExpressions.Expression exp = rem_expression.getData();
+ if (exp != null) {
+ String s = getTypeName(exp.getTypeClass(), exp.getSize());
+ if (s != null) {
+ set(null, null, s);
+ return true;
+ }
+ }
+ set(null, null, "N/A");
return true;
}
};
@@ -1769,15 +1780,6 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
if (level == 0) {
assert offs == 0 && size == data.length && data_node == this;
if (size > 0 && !appendNumericValueText(bf, type_class, done)) return false;
- String s = getTypeName(type_class, size);
- if (s == null) s = "not available";
- bf.append("Size: ", SWT.BOLD);
- bf.append(Integer.toString(size), StyledStringBuffer.MONOSPACED);
- bf.append(size == 1 ? " byte" : " bytes");
- bf.append(", ");
- bf.append("Type: ", SWT.BOLD);
- bf.append(s);
- bf.append('\n');
}
else if (size == 0) {
bf.append("N/A", StyledStringBuffer.MONOSPACED);
@@ -1903,6 +1905,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
if (!rem_expression.validate(done)) return false;
if (rem_expression.getError() == null) {
if (!value.validate(done)) return false;
+ if (!type_name.validate(done)) return false;
IExpressions.Value v = value.getData();
if (v != null) {
String type_id = v.getTypeID();
@@ -1946,23 +1949,41 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
bf.append(bit_stride.longValue() == 1 ? " bit" : " bits");
fst = false;
}
- if (type_data != null) {
- if (!type_name.validate(done)) return false;
+ if (v.getValue() != null) {
+ int sz = v.getValue().length;
if (!fst) bf.append(", ");
bf.append("Size: ", SWT.BOLD);
- bf.append(Integer.toString(type_data.getSize()), StyledStringBuffer.MONOSPACED);
- bf.append(type_data.getSize() == 1 ? " byte" : " bytes");
- String nm = type_name.getData();
- if (nm != null) {
- bf.append(", ");
- bf.append("Type: ", SWT.BOLD);
- bf.append(nm);
+ bf.append(Integer.toString(sz), StyledStringBuffer.MONOSPACED);
+ bf.append(sz == 1 ? " byte" : " bytes");
+ fst = false;
+ }
+ else if (type_data != null) {
+ int sz = type_data.getSize();
+ if (!fst) bf.append(", ");
+ bf.append("Size: ", SWT.BOLD);
+ bf.append(Integer.toString(sz), StyledStringBuffer.MONOSPACED);
+ bf.append(sz == 1 ? " byte" : " bytes");
+ fst = false;
+ }
+ else {
+ IExpressions.Expression exp = rem_expression.getData();
+ if (exp != null) {
+ int sz = exp.getSize();
+ if (!fst) bf.append(", ");
+ bf.append("Size: ", SWT.BOLD);
+ bf.append(Integer.toString(sz), StyledStringBuffer.MONOSPACED);
+ bf.append(sz == 1 ? " byte" : " bytes");
+ fst = false;
}
- bf.append('\n');
}
- else if (bin_scale != null || dec_scale != null) {
- bf.append('\n');
+ String tnm = type_name.getData();
+ if (tnm != null) {
+ if (!fst) bf.append(", ");
+ bf.append("Type: ", SWT.BOLD);
+ bf.append(tnm);
+ fst = false;
}
+ if (!fst) bf.append('\n');
@SuppressWarnings("unchecked")
List<Map<String,Object>> pieces = (List<Map<String,Object>>)value_props.get(IExpressions.VAL_PIECES);
if (pieces != null) {

Back to the top