[Lldb-commits] [PATCH] D144230: [lldb] Make use of persistent result variables configurable

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 16 15:56:10 PST 2023


kastiglione created this revision.
kastiglione added reviewers: jingham, aprantl.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Context: The `expression` command uses artificial variables to store the expression
result. This result variable is unconditionally kept around after the expression command
has completed. These variables are known as persistent results. These are the variables
`$0`, `$1`, etc, that are displayed when running `p` or `expression`.

This change allows users to control whether result variables are persisted, by
introducing a `--persistent-result`/`-C` flag.

Aside: the short flags `p`/`P`/`r`/`R` are all taken, the flag `-C` was chosen because
the word "cache" also seems apt.

This change keeps the current default behavior, persistent results are created by
default. This change gives users the ability to opt-out by re-aliasing `p`. For example:

  command unalias p
  command alias p expression -C false --

For consistency, this flag is also adopted by `dwim-print`. Of note, if asked,
`dwim-print` will create a persistent result even for frame variables.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144230

Files:
  lldb/source/Commands/CommandObjectDWIMPrint.cpp
  lldb/source/Commands/CommandObjectExpression.cpp
  lldb/source/Commands/CommandObjectExpression.h
  lldb/source/Commands/Options.td
  lldb/source/DataFormatters/ValueObjectPrinter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144230.498180.patch
Type: text/x-patch
Size: 5230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230216/8caa027d/attachment.bin>


More information about the lldb-commits mailing list