Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2013-02-26 20:02:55 -0500
committerEugene Tarassov2013-02-26 20:02:55 -0500
commit84272a64fe85789236ac2aa727f16893ddf175d2 (patch)
tree42229091961a93e5f367b25f7e36a4190193772c /plugins
parente4bdf88875677ef2949e85a816e2ae44e1985c1b (diff)
downloadorg.eclipse.tcf-84272a64fe85789236ac2aa727f16893ddf175d2.tar.gz
org.eclipse.tcf-84272a64fe85789236ac2aa727f16893ddf175d2.tar.xz
org.eclipse.tcf-84272a64fe85789236ac2aa727f16893ddf175d2.zip
Bug 401773 - [Eclipse] In Variables View it should be possible to display the variable value in binary
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java2
-rw-r--r--plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNodeExpression.java57
2 files changed, 37 insertions, 22 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
index ed9f1199d..91dfcf231 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
@@ -323,7 +323,7 @@ public class LocatorService implements ILocator {
return null;
}
});
-
+
// Bug #400659 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=400659):
//
// To workaround Bug 388125 (Oracle bug 7179799) with Java 7, force
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 691b0b9e6..e67a7e3ba 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
@@ -1006,33 +1006,45 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
return "";
}
}
- String s = null;
- if (data == null) s = "N/A";
- if (s == null && radix == 10) {
+ if (data == null) return "N/A";
+ if (radix == 2) {
+ StringBuffer bf = new StringBuffer();
+ int i = size * 8;
+ while (i > 0) {
+ if (i % 4 == 0 && bf.length() > 0) bf.append(',');
+ i--;
+ int j = i / 8;
+ if (big_endian) j = size - j - 1;
+ if ((data[offs + j] & (1 << (i % 8))) != 0) {
+ bf.append('1');
+ }
+ else {
+ bf.append('0');
+ }
+ }
+ return bf.toString();
+ }
+ if (radix == 10) {
switch (t) {
case integer:
- s = TCFNumberFormat.toBigInteger(data, offs, size, big_endian, true).toString();
- break;
+ return TCFNumberFormat.toBigInteger(data, offs, size, big_endian, true).toString();
case real:
- s = TCFNumberFormat.toFPString(data, offs, size, big_endian);
- break;
+ return TCFNumberFormat.toFPString(data, offs, size, big_endian);
}
}
- if (s == null) {
- s = TCFNumberFormat.toBigInteger(data, offs, size, big_endian, false).toString(radix);
- switch (radix) {
- case 8:
- if (!s.startsWith("0")) s = "0" + s;
- break;
- case 16:
- if (s.length() < size * 2) {
- StringBuffer bf = new StringBuffer();
- while (bf.length() + s.length() < size * 2) bf.append('0');
- bf.append(s);
- s = bf.toString();
- }
- break;
+ String s = TCFNumberFormat.toBigInteger(data, offs, size, big_endian, false).toString(radix);
+ switch (radix) {
+ case 8:
+ if (!s.startsWith("0")) s = "0" + s;
+ break;
+ case 16:
+ if (s.length() < size * 2) {
+ StringBuffer bf = new StringBuffer();
+ while (bf.length() + s.length() < size * 2) bf.append('0');
+ bf.append(s);
+ s = bf.toString();
}
+ break;
}
assert s != null;
return s;
@@ -1439,6 +1451,9 @@ public class TCFNodeExpression extends TCFNode implements IElementEditor, ICastT
bf.append("Oct: ", SWT.BOLD);
bf.append(toNumberString(8, type_class, data, offs, size, big_endian), StyledStringBuffer.MONOSPACED);
bf.append('\n');
+ bf.append("Bin: ", SWT.BOLD);
+ bf.append(toNumberString(2), StyledStringBuffer.MONOSPACED);
+ bf.append('\n');
}
@SuppressWarnings("incomplete-switch")

Back to the top