[Lldb-commits] [PATCH] D147370: [lldb] fixing #61727 fixing incorrect variable displaying with DW_OP_div
LU Hongyi via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sat Apr 1 00:35:52 PDT 2023
jwnhy created this revision.
jwnhy added reviewers: Michael137, DavidSpickett.
Herald added a project: All.
jwnhy requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This patch resolves an issue where a value
is incorrectly displayed if it is represented
by DW_OP_div.
This issue is caused by lldb evaluating
operands of DW_OP_div as unsigned
and performed unintended unsigned
division.
This issue is resolved by creating two
temporary signed scalar and performing
signed division.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D147370
Files:
lldb/source/Expression/DWARFExpression.cpp
Index: lldb/source/Expression/DWARFExpression.cpp
===================================================================
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -1436,8 +1436,12 @@
return false;
} else {
stack.pop_back();
- stack.back() =
- stack.back().ResolveValue(exe_ctx) / tmp.ResolveValue(exe_ctx);
+ Scalar divisor, dividend;
+ divisor = tmp.ResolveValue(exe_ctx);
+ dividend = stack.back().ResolveValue(exe_ctx);
+ divisor.MakeSigned();
+ dividend.MakeSigned();
+ stack.back() = dividend / divisor;
if (!stack.back().ResolveValue(exe_ctx).IsValid()) {
if (error_ptr)
error_ptr->SetErrorString("Divide failed.");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147370.510189.patch
Type: text/x-patch
Size: 820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230401/f7591147/attachment.bin>
More information about the lldb-commits
mailing list