mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
[lldb] Fix reading 32-bit signed integers (#169150)
Both `Target::ReadSignedIntegerFromMemory()` and `Process::ReadSignedIntegerFromMemory()` internally created an unsigned scalar, so extending the value later did not duplicate the sign bit.
This commit is contained in:
@@ -2452,8 +2452,10 @@ size_t Process::ReadScalarIntegerFromMemory(addr_t addr, uint32_t byte_size,
|
||||
scalar = data.GetMaxU32(&offset, byte_size);
|
||||
else
|
||||
scalar = data.GetMaxU64(&offset, byte_size);
|
||||
if (is_signed)
|
||||
if (is_signed) {
|
||||
scalar.MakeSigned();
|
||||
scalar.SignExtend(byte_size * 8);
|
||||
}
|
||||
return bytes_read;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user