https://github.com/satyajanga updated https://github.com/llvm/llvm-project/pull/150149
>From f4c7789bb5994f1df81294c054ddc74b397e6e3f Mon Sep 17 00:00:00 2001 From: satya janga <satyaja...@fb.com> Date: Tue, 22 Jul 2025 17:57:30 -0700 Subject: [PATCH] Zero extend APInt when piece size is bigger than the bitwidth Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D78791142 --- lldb/source/Expression/DWARFExpression.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 52891fcefd68b..a709574e96f98 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -1978,7 +1978,12 @@ llvm::Expected<Value> DWARFExpression::Evaluate( // grows to the nearest host integer type. llvm::APInt fail_value(1, 0, false); llvm::APInt ap_int = scalar.UInt128(fail_value); - assert(ap_int.getBitWidth() >= bit_size); + // We have seen a case where we have expression like: + // DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x28 + // here we are assuming the compiler was trying to zero + // extend the value that we should append to the buffer. + if (ap_int.getBitWidth() < bit_size) + ap_int.zext(bit_size); llvm::ArrayRef<uint64_t> buf{ap_int.getRawData(), ap_int.getNumWords()}; curr_piece.GetScalar() = Scalar(llvm::APInt(bit_size, buf)); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits