[all-commits] [llvm/llvm-project] 4ea199: [lldb-dap] Adjusting how repl-mode auto determines...
John Harrison via All-commits
all-commits at lists.llvm.org
Wed Jan 17 09:00:34 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4ea1994a0307b09532d519292d34dad7555598ca
https://github.com/llvm/llvm-project/commit/4ea1994a0307b09532d519292d34dad7555598ca
Author: John Harrison <harjohn at google.com>
Date: 2024-01-17 (Wed, 17 Jan 2024)
Changed paths:
M lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py
M lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
M lldb/tools/lldb-dap/DAP.cpp
M lldb/tools/lldb-dap/DAP.h
M lldb/tools/lldb-dap/lldb-dap.cpp
Log Message:
-----------
[lldb-dap] Adjusting how repl-mode auto determines commands vs variable expressions. (#78005)
The previous logic for determining if an expression was a command or
variable expression in the repl would incorrectly identify the context
in many common cases where a local variable name partially overlaps with
the repl input.
For example:
```
int foo() {
int var = 1; // break point, evaluating "p var", previously emitted a warning
}
```
Instead of checking potentially multiple conflicting values against the
expression input, I updated the heuristic to only consider the first
term. This is much more reliable at eliminating false positives when the
input does not actually hide a local variable.
Additionally, I updated the warning on conflicts to occur anytime the
conflict is detected since the specific conflict can change based on the
current input. This also includes additional details on how users can
change the behavior.
Example Debug Console output from
lldb/test/API/tools/lldb-dap/evaluate/main.cpp:11 breakpoint 3.
```
lldb-dap> var + 3
Warning: Expression 'var' is both an LLDB command and variable. It will be evaluated as a variable. To evaluate the expression as an LLDB command, use '`' as a prefix.
45
lldb-dap> var + 1
Warning: Expression 'var' is both an LLDB command and variable. It will be evaluated as a variable. To evaluate the expression as an LLDB command, use '`' as a prefix.
43
```
More information about the All-commits
mailing list