Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2014-11-26 14:49:33 -0500
committerEugene Tarassov2014-11-26 14:49:33 -0500
commit6d1ac9403b659ccf4d9d189ca285157fe838c7bf (patch)
tree150b745812cf3ee8af45d9715560e453a64a6aaf /plugins/org.eclipse.tcf.debug.ui
parent136af638da0700d6b94467584896f031c140439b (diff)
downloadorg.eclipse.tcf-6d1ac9403b659ccf4d9d189ca285157fe838c7bf.tar.gz
org.eclipse.tcf-6d1ac9403b659ccf4d9d189ca285157fe838c7bf.tar.xz
org.eclipse.tcf-6d1ac9403b659ccf4d9d189ca285157fe838c7bf.zip
Bug 451283 - TCF debugger does not support native complex types
Diffstat (limited to 'plugins/org.eclipse.tcf.debug.ui')
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java13
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java17
2 files changed, 28 insertions, 2 deletions
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 7a7a73740..2c7f6acdd 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
@@ -874,6 +874,9 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
case real:
if (size == 0) return null;
return "<Float-" + (size * 8) + ">";
+ case complex:
+ if (size == 0) return null;
+ return "<Complex-" + (size / 2 * 8) + ">";
}
return null;
}
@@ -1057,7 +1060,8 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
@SuppressWarnings("incomplete-switch")
private String toNumberString(int radix, ISymbols.TypeClass t, byte[] data, int offs, int size, boolean big_endian) {
- if (size <= 0 || size > 16) return "";
+ if (size <= 0) return "";
+ if (size > (t == ISymbols.TypeClass.complex ? 32: 16)) return "";
if (radix != 16) {
switch (t) {
case array:
@@ -1089,6 +1093,8 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return TCFNumberFormat.toBigInteger(data, offs, size, big_endian, true).toString();
case real:
return TCFNumberFormat.toFPString(data, offs, size, big_endian);
+ case complex:
+ return TCFNumberFormat.toComplexFPString(data, offs, size, big_endian);
}
}
String s = TCFNumberFormat.toBigInteger(data, offs, size, big_endian, false).toString(radix);
@@ -1573,7 +1579,9 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
bf.append(s);
bf.append('\n');
}
- else if (type_class == ISymbols.TypeClass.integer || type_class == ISymbols.TypeClass.real) {
+ else if (type_class == ISymbols.TypeClass.integer ||
+ type_class == ISymbols.TypeClass.real ||
+ type_class == ISymbols.TypeClass.complex) {
bf.append(toNumberString(10, type_class, data, offs, size, big_endian), StyledStringBuffer.MONOSPACED);
}
else {
@@ -1601,6 +1609,7 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
case integer:
case cardinal:
case real:
+ case complex:
if (level == 0) {
assert offs == 0 && size == data.length && data_node == this;
if (!appendNumericValueText(bf, type_class, data, big_endian, done)) return false;
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java
index 05f6f5d62..afa19d8aa 100644
--- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java
+++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java
@@ -304,6 +304,23 @@ public class TCFNumberFormat {
return s;
}
+ public static String toComplexFPString(byte[] data, boolean big_endian) {
+ return toComplexFPString(data, 0, data.length, big_endian);
+ }
+
+ public static String toComplexFPString(byte[] data, int offs, int size, boolean big_endian) {
+ int fp_size = size / 2;
+ StringBuffer bf = new StringBuffer();
+ bf.append(toFPString(data, offs, fp_size, big_endian));
+ String i = toFPString(data, offs + fp_size, fp_size, big_endian);
+ if (!i.equals("0")) {
+ if (!i.startsWith("-")) bf.append('+');
+ bf.append(i);
+ bf.append('i');
+ }
+ return bf.toString();
+ }
+
public static BigInteger toBigInteger(byte[] data, boolean big_endian, boolean sign_extension) {
return toBigInteger(data, 0, data.length, big_endian, sign_extension);
}

Back to the top