summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-06-11 08:50:30 -0400
committerJonah Graham2018-06-11 10:49:26 -0400
commit231ec3e5403c88aa45b79e7001762e5c83bde04f (patch)
tree894708888b7549964b37d33c9915a5a424223d2f
parent4e4e010e3353372d0d38a3b1f5fcd957ed3fefae (diff)
downloadorg.eclipse.cdt-231ec3e5403c88aa45b79e7001762e5c83bde04f.tar.gz
org.eclipse.cdt-231ec3e5403c88aa45b79e7001762e5c83bde04f.tar.xz
org.eclipse.cdt-231ec3e5403c88aa45b79e7001762e5c83bde04f.zip
Bug #535767: Store endianess per memory context
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java
index 620ab12ede..1f00bcf354 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBMemory.java
@@ -65,9 +65,9 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
private Map<IMemoryDMContext, Integer> fAddressableSizes = new HashMap<IMemoryDMContext, Integer>();
/**
- * We assume the endianness is the same for all processes because GDB supports only one target.
+ * Cache of the endianness for each memory context.
*/
- private Boolean fIsBigEndian;
+ private Map<IMemoryDMContext, Boolean> fIsBigEndian = new HashMap<>();
public GDBMemory(DsfSession session) {
super(session);
@@ -272,7 +272,7 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
}
- if (fIsBigEndian == null) {
+ if (fIsBigEndian.get(memContext) == null) {
stepsList.add(
new Step() {
// read endianness
@@ -284,7 +284,7 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
@Override
protected void handleCompleted() {
if (isSuccess()) {
- fIsBigEndian = getData();
+ fIsBigEndian.put(memContext, getData());
}
// Accept failure
requestMonitor.done();
@@ -336,12 +336,13 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
@Override
public boolean isBigEndian(IMemoryDMContext context) {
- assert fIsBigEndian != null;
- if (fIsBigEndian == null) {
- GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Endianness was never initialized!")); //$NON-NLS-1$
+ Boolean isBigEndian = fIsBigEndian.get(context);
+ assert isBigEndian != null;
+ if (isBigEndian == null) {
+ GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Endianness was never initialized for " + context)); //$NON-NLS-1$
return false;
}
- return fIsBigEndian;
+ return isBigEndian.booleanValue();
}
/**