summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
diff options
context:
space:
mode:
authorDave Lee <davelee.com@gmail.com>2023-02-17 19:53:16 -0800
committerDave Lee <davelee.com@gmail.com>2023-03-07 13:08:08 -0800
commit9584ef1b02c0c2f77454c15008cb4a047a91a348 (patch)
treec3041859221edfa1aaa311c064ea4125c5b86250 /lldb/test/API/python_api/debugger/TestDebuggerAPI.py
parenta611b3f3059e4c3b9e7b914091c3edaef099fd5d (diff)
Recommit "[lldb] Redefine p alias to dwim-print command"
Redefine the `p` alias to the `dwim-print` command instead of `expression`. See https://reviews.llvm.org/D138315 for the introduction of `dwim-print`. To summarize, `dwim-print` is, as the name suggests, a command for printing. How a value gets printed, is decided by `dwim-print`. In some cases, `dwim-print` will print values using the same means as `frame variable` (because it's generally more reliable and faster that `expression` evaluation), and in other cases `dwim-print` uses the same code path as `expression`. This change has been tested in two different ways: 1. Re-aliasing `p` to `dwim-print`, as in this patch 2. Redefinining the `expression` command to `CommandObjectDWIMPrint` Previously, many of the lldb's tests used `p`, and which meant a test run with `p` aliases to `dwim-print` was a good way to test `dwim-print`. However most of those tests were updated to use `expression` explicitly (in anticipation of this change). Now, the best way to test `dwim-print` is the second approach: ``` diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 373c894f34f5..9c943cd30c7c 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -539,7 +539,7 @@ void CommandInterpreter::LoadCommandDictionary() { REGISTER_COMMAND_OBJECT("diagnostics", CommandObjectDiagnostics); REGISTER_COMMAND_OBJECT("disassemble", CommandObjectDisassemble); REGISTER_COMMAND_OBJECT("dwim-print", CommandObjectDWIMPrint); - REGISTER_COMMAND_OBJECT("expression", CommandObjectExpression); + REGISTER_COMMAND_OBJECT("expression", CommandObjectDWIMPrint); REGISTER_COMMAND_OBJECT("frame", CommandObjectMultiwordFrame); REGISTER_COMMAND_OBJECT("gui", CommandObjectGUI); REGISTER_COMMAND_OBJECT("help", CommandObjectHelp); ``` When the test suite is run with this change, there are two main categories of test failures for specific to features that `dwim-print` intentionally doesn't support: 1. Top level expressions (`--top-level`/`-p`) 2. Multiline expressions In cases where the behavior of `expression` is needed, users can use `expression` at those times. Differential Revision: https://reviews.llvm.org/D145189
Diffstat (limited to 'lldb/test/API/python_api/debugger/TestDebuggerAPI.py')
0 files changed, 0 insertions, 0 deletions