[Lldb-commits] [lldb] [lldb] Enable caching for BytecodeSyntheticChildren::FrontEnd::Update (PR #181199)
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 17 14:13:55 PST 2026
================
@@ -291,10 +292,41 @@ lldb::ChildCacheState BytecodeSyntheticChildren::FrontEnd::Update() {
return ChildCacheState::eRefetch;
}
+ // If the top of the stack is a 0 or 1, that value is popped of the stack and
+ // treated as a return value of eRefetch or eReuse respectively. If the top of
+ // the stack is any other value, it stays on the stack and becomes part of
+ // `self`.
+ //
+ // This dynamic logic can lead to errors for synthetic formatter authors.
+ // Consider the case where an `update` implementation places the number of
+ // children last on the stack. LLDB will _sometimes_ (but not always) consume
+ // that value as a ChildCacheState value. This would cause downstream problems
+ // in `num_children`, because the count won't be on the stack.
+ //
+ // Bytecode authors are encouraged to explicitly push a ChildCacheState value
+ // on to the stack.
----------------
kastiglione wrote:
Upon further thought (and discussion with @adrian-prantl), I'm thinking of changing `BytecodeSyntheticChildren` to always return `eReuse` after its update. The reason is, I'm not currently aware of cases where bytecode needs to be re-evaluated.
https://github.com/llvm/llvm-project/pull/181199
More information about the lldb-commits
mailing list