[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 00:46:03 PST 2024
https://github.com/kamleshbhalui created https://github.com/llvm/llvm-project/pull/81451
Storing Larger bitwidth causes problem when byteswapping.
>From 51347e2de532261cfe980b299baeceb7747b7d48 Mon Sep 17 00:00:00 2001
From: Kamlesh Kumar <kamleshbhalui at gmail.com>
Date: Mon, 12 Feb 2024 13:30:32 +0530
Subject: [PATCH] [lldb] Store proper integer bitwidth in Scalar Type
Storing Larger bitwidth causes problem when byteswapping.
---
lldb/source/Expression/DWARFExpression.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index fe4928d4f43a43..1546612be34ac7 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -857,10 +857,18 @@ static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
DataExtractor addr_data(addr_bytes, size_addr_bytes, byte_order, size);
lldb::offset_t addr_data_offset = 0;
- if (size <= 8)
- return addr_data.GetMaxU64(&addr_data_offset, size);
- else
- return addr_data.GetAddress(&addr_data_offset);
+ switch (size) {
+ case 1:
+ return addr_data.GetU8(&addr_data_offset);
+ case 2:
+ return addr_data.GetU16(&addr_data_offset);
+ case 4:
+ return addr_data.GetU32(&addr_data_offset);
+ case 8:
+ return addr_data.GetU64(&addr_data_offset);
+ default:
+ return addr_data.GetAddress(&addr_data_offset);
+ }
}
bool DWARFExpression::Evaluate(
More information about the lldb-commits
mailing list