Unverified Commit 4da2b542 authored by Dave Lee's avatar Dave Lee Committed by GitHub
Browse files

[lldb] Fix dwim-print to not delete non-result persistent variables (#85152)

`EvaluateExpression` does not always create a new persistent result. If the expression 
is a bare persistent variable, then a new persistent result is not created. This means 
the caller can't assume a new persistent result is created for each evaluation. 
However, `dwim-print` was doing exactly that: assuming a new persistent result for each 
evaluation. This resulted in a bug:

```
(lldb) p int $j = 23
(lldb) p $j
(lldb) p $j
```

The first `p $j` would not create a persistent result, and so `dwim-print` would 
inadvertently delete `$j`. The second `p $j` would fail.

The fix is to try `expr` as a persistent variable, after trying `expr` as a frame 
variable. For persistent variables, this avoids calling `EvaluateExpression`.

Resolves https://github.com/llvm/llvm-project/issues/84806

rdar://124688427
parent 8f2632c4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment