[all-commits] [llvm/llvm-project] 3328ee: [lldb] Suppress persistent result when running po
Dave Lee via All-commits
all-commits at lists.llvm.org
Thu Feb 16 21:05:40 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3328ee550c86458ade5b3daf5fb4ad97b6a99e6c
https://github.com/llvm/llvm-project/commit/3328ee550c86458ade5b3daf5fb4ad97b6a99e6c
Author: Dave Lee <davelee.com at gmail.com>
Date: 2023-02-16 (Thu, 16 Feb 2023)
Changed paths:
M lldb/source/Commands/CommandObjectExpression.cpp
A lldb/test/API/commands/expression/po_persistent_result/Makefile
A lldb/test/API/commands/expression/po_persistent_result/TestPoPersistentResult.py
A lldb/test/API/commands/expression/po_persistent_result/main.m
Log Message:
-----------
[lldb] Suppress persistent result when running po
Remove the persistent result variable after executing `po`.
Without this change, the following behavior happens:
```
(lldb) p thing
(NSObject *) $0 = 0x600000008000
(lldb) po thing
<NSObject: 0x600000008000>
(lldb) p thing
(NSObject *) $2 = 0x600000008000
(lldb) p $1
(NSObject *) $1 = 0x600000008000
```
Even though `po` hides the persistent result variable, it's still created - as $1 in
this example. It can be accessed even though its existence is not evident.
With this change, the persistent result is removed after the object description has
printed. Instead, this is the behavior:
```
(lldb) p thing
(NSObject *) $0 = 0x600000008000
(lldb) po thing
<NSObject: 0x600000008000>
(lldb) p thing
(NSObject *) $1 = 0x600000008000
```
The difference here is that the `po` doens't silently create a persistent result.
Differential Revision: https://reviews.llvm.org/D144044
More information about the All-commits
mailing list