Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2013-10-02 20:50:30 +0000
committerEugene Tarassov2013-10-02 20:50:30 +0000
commit0797e2ad42629339f0d7d32f6cde7f6fdfeb2623 (patch)
treefef804c44d4a458178d51d8fcca77911a63fa445 /plugins/org.eclipse.tcf.debug
parentacbc8508618a2d1429f9dab10c487594e002423e (diff)
downloadorg.eclipse.tcf-0797e2ad42629339f0d7d32f6cde7f6fdfeb2623.tar.gz
org.eclipse.tcf-0797e2ad42629339f0d7d32f6cde7f6fdfeb2623.tar.xz
org.eclipse.tcf-0797e2ad42629339f0d7d32f6cde7f6fdfeb2623.zip
TCF Debugger: fixed: Memory Map (Symbol Files) dialog cannot handle entries with additional non-standard properties
Diffstat (limited to 'plugins/org.eclipse.tcf.debug')
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java46
1 files changed, 39 insertions, 7 deletions
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java
index 2679bf579..546b0c434 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFMemoryRegion.java
@@ -11,13 +11,16 @@
package org.eclipse.tcf.internal.debug.model;
import java.math.BigInteger;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import org.eclipse.tcf.protocol.JSON;
import org.eclipse.tcf.services.IMemoryMap;
/**
* A comparable extension of TCFMemoryRegion.
+ * Note: this class has a natural ordering that is inconsistent with equals.
*/
public class TCFMemoryRegion extends org.eclipse.tcf.util.TCFMemoryRegion implements Comparable<TCFMemoryRegion> {
@@ -31,18 +34,47 @@ public class TCFMemoryRegion extends org.eclipse.tcf.util.TCFMemoryRegion implem
}
public int compareTo(TCFMemoryRegion r) {
- if (addr == null && r.addr == null) return 0;
- if (addr == null) return -1;
- if (r.addr == null) return +1;
- return addr.compareTo(r.addr);
+ if (addr != r.addr) {
+ if (addr == null) return -1;
+ if (r.addr == null) return +1;
+ int n = addr.compareTo(r.addr);
+ if (n != 0) return n;
+ }
+ if (size != r.size) {
+ if (size == null) return -1;
+ if (r.size == null) return +1;
+ int n = size.compareTo(r.size);
+ if (n != 0) return n;
+ }
+ return 0;
}
@Override
public boolean equals(Object o) {
- if (o instanceof TCFMemoryRegion) {
- return compareTo((TCFMemoryRegion)o) == 0;
+ if (this == o) return true;
+ if (!(o instanceof TCFMemoryRegion)) return false;
+ TCFMemoryRegion r = (TCFMemoryRegion)o;
+ if (compareTo(r) != 0) return false;
+ Map<String,Object> x = getProperties();
+ Map<String,Object> y = r.getProperties();
+ if (x.size() != y.size()) return false;
+ Iterator<Entry<String,Object>> i = x.entrySet().iterator();
+ while (i.hasNext()) {
+ Entry<String,Object> e = i.next();
+ String key = e.getKey();
+ if (key != null) {
+ if (key.equals(IMemoryMap.PROP_ADDRESS)) continue;
+ if (key.equals(IMemoryMap.PROP_SIZE)) continue;
+ }
+ Object val = e.getValue();
+ if (val == null) {
+ if (y.get(key) != null || !y.containsKey(key)) return false;
+ }
+ else {
+ if (!val.equals(y.get(key))) return false;
+ }
}
- return false;
+ return true;
}
@Override

Back to the top