[Lldb-commits] [lldb] [lldb] Store proper integer bitwidth in Scalar Type (PR #81451)

Kamlesh Kumar via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 12 22:44:08 PST 2024


kamleshbhalui 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.

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.


https://github.com/llvm/llvm-project/pull/81451


More information about the lldb-commits mailing list