mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug #535767: Store endianess per memory context
Change-Id: Ib4beea9a2b54bc26f5357c199ffd6154f49b96dc
This commit is contained in:
parent
4e4e010e33
commit
231ec3e540
1 changed files with 9 additions and 8 deletions
|
@ -65,9 +65,9 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
|
||||||
private Map<IMemoryDMContext, Integer> fAddressableSizes = new HashMap<IMemoryDMContext, Integer>();
|
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) {
|
public GDBMemory(DsfSession session) {
|
||||||
super(session);
|
super(session);
|
||||||
|
@ -272,7 +272,7 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fIsBigEndian == null) {
|
if (fIsBigEndian.get(memContext) == null) {
|
||||||
stepsList.add(
|
stepsList.add(
|
||||||
new Step() {
|
new Step() {
|
||||||
// read endianness
|
// read endianness
|
||||||
|
@ -284,7 +284,7 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
|
||||||
@Override
|
@Override
|
||||||
protected void handleCompleted() {
|
protected void handleCompleted() {
|
||||||
if (isSuccess()) {
|
if (isSuccess()) {
|
||||||
fIsBigEndian = getData();
|
fIsBigEndian.put(memContext, getData());
|
||||||
}
|
}
|
||||||
// Accept failure
|
// Accept failure
|
||||||
requestMonitor.done();
|
requestMonitor.done();
|
||||||
|
@ -336,12 +336,13 @@ public class GDBMemory extends MIMemory implements IGDBMemory2 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBigEndian(IMemoryDMContext context) {
|
public boolean isBigEndian(IMemoryDMContext context) {
|
||||||
assert fIsBigEndian != null;
|
Boolean isBigEndian = fIsBigEndian.get(context);
|
||||||
if (fIsBigEndian == null) {
|
assert isBigEndian != null;
|
||||||
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Endianness was never initialized!")); //$NON-NLS-1$
|
if (isBigEndian == null) {
|
||||||
|
GdbPlugin.log(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, "Endianness was never initialized for " + context)); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return fIsBigEndian;
|
return isBigEndian.booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue