[all-commits] [llvm/llvm-project] db8145: [lldb] Delay removal of persistent results
Dave Lee via All-commits
all-commits at lists.llvm.org
Thu May 18 09:44:25 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: db814552132d614e410118e22b22c89d35ae6062
https://github.com/llvm/llvm-project/commit/db814552132d614e410118e22b22c89d35ae6062
Author: Dave Lee <davelee.com at gmail.com>
Date: 2023-05-18 (Thu, 18 May 2023)
Changed paths:
M lldb/source/Commands/CommandObjectDWIMPrint.cpp
M lldb/source/Commands/CommandObjectExpression.cpp
M lldb/source/Commands/CommandObjectExpression.h
Log Message:
-----------
[lldb] Delay removal of persistent results
Follow up to "Suppress persistent result when running po" (D144044).
This change delays removal of the persistent result until after `Dump` has been called.
In doing so, the persistent result is available for the purpose of getting its object
description.
In the original change, the persistent result removal happens indirectly, by setting
`EvaluateExpressionOptions::SetSuppressPersistentResult`. In practice this has worked,
however this exposed a latent bug in swift-lldb. The subtlety, and the bug, depend on
when the persisteted result variable is removed.
When the result is removed via `SetSuppressPersistentResult`, it happens within the call
to `Target::EvaluateExpression`. That is, by the time the call returns, the persistent
result is already removed.
The issue occurs shortly thereafter, when `ValueObject::Dump` is called, it cannot make
use of the persistent result variable (instead it uses the `ValueObjectConstResult`). In
swift-lldb, this causes an additional expression evaluation to happen. It first tries an
expression that reference `$R0` etc, but that always fails because `$R0` is removed. The
fallback to this failure does work most of the time, but there's at least one bug
involving imported Clang types.
Differential Revision: https://reviews.llvm.org/D150619
More information about the All-commits
mailing list