[Lldb-commits] [lldb] [lldb] Store proper integer bitwidth in Scalar Type (PR #81451)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 13 11:07:13 PST 2024
bulbazord wrote:
> > This uses `DataExtractor::GetMaxU64` which already does this under the hood. What does this do that isn't already being done? It may help if you add a test case to show what you are trying to fix.
>
> @clayborg @bulbazord The problem with GetMaxU64 is that it always returns uint64_t even though actual type was uint32_t, so when byteswap is performed it becomes invalid integer, to fixed this we need to store correct bitwidth not higher. i.e. Suppose there is actual 32 bit integer i.e. 0xffffffff `GetMaxU64` will return 0x00000000ffffffff (prmoted to uint64_t from uint32_t) and when performing byteswap on this it becomes 0xffffffff00000000 which is invalid.
That makes sense to me, but how are you encountering this behavior? What specifically is this fixing? If you can write a test case that fails without your change but works with your change, that would help us understand what you're trying to fix. Correctness is important, and tests help us verify that we're not inadvertently introducing regressions.
https://github.com/llvm/llvm-project/pull/81451
More information about the lldb-commits
mailing list