[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:52:12 PST 2024
https://github.com/kamleshbhalui updated https://github.com/llvm/llvm-project/pull/81451
>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 1/2] [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(
>From a04e9ea70fd29cd5fb0599c0e2f106c17656da57 Mon Sep 17 00:00:00 2001
From: Kamlesh Kumar <kamleshbhalui at gmail.com>
Date: Mon, 12 Feb 2024 14:21:44 +0530
Subject: [PATCH 2/2] clang-formatted
---
lldb/source/Expression/DWARFExpression.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 1546612be34ac7..6839e05bb115bd 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -867,7 +867,7 @@ static Scalar DerefSizeExtractDataHelper(uint8_t *addr_bytes,
case 8:
return addr_data.GetU64(&addr_data_offset);
default:
- return addr_data.GetAddress(&addr_data_offset);
+ return addr_data.GetAddress(&addr_data_offset);
}
}
More information about the lldb-commits
mailing list