Debugger: fix value reading problem.
When reading a variable value from a register, if the value's size is smaller than the size of the register and the architecture is little endian, we need to adjust the bit offset we read from in addition to byte swapping, otherwise we wind up reading the wrong bytes. This was mainly noticeable in the case of functions that returned boolean values, which would consequently sometimes show up incorrectly.
This commit is contained in:
parent
991183511b
commit
91c6c2ec21
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -178,8 +179,10 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType,
|
||||
if (registerValue.Size() < bytesToRead)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
if (!bigEndian)
|
||||
if (!bigEndian) {
|
||||
registerValue.SwapEndianess();
|
||||
bitOffset = registerValue.Size() * 8 - bitOffset - bitSize;
|
||||
}
|
||||
valueBuffer.AddBits(registerValue.Bytes(), bitSize, bitOffset);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user