[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:
Igor Kudrin
2025-11-26 10:49:49 -08:00
committed by GitHub
parent bf43b95025
commit a059afafde
3 changed files with 77 additions and 6 deletions

View File

@@ -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 {