diff options
author | Dave Lee <davelee.com@gmail.com> | 2023-03-08 13:22:00 -0800 |
---|---|---|
committer | Dave Lee <davelee.com@gmail.com> | 2023-03-15 13:34:19 -0700 |
commit | 8bad4ae679df6fc7dbd016dccbd3da34206e836b (patch) | |
tree | 62455be48b4db75899dc5e8738d4619529aaf4c3 /lldb/source/Commands | |
parent | 6a6994cc9bc0327aaf8b005c650ff5eb29d2bcce (diff) | |
download | llvm-8bad4ae679df6fc7dbd016dccbd3da34206e836b.zip llvm-8bad4ae679df6fc7dbd016dccbd3da34206e836b.tar.gz llvm-8bad4ae679df6fc7dbd016dccbd3da34206e836b.tar.bz2 |
[lldb] Change dwim-print to default to disabled persistent results
Change `dwim-print` to now disable persistent results by default, unless requested by
the user with the `--persistent-result` flag.
Ex:
```
(lldb) dwim-print 1 + 1
(int) 2
(lldb) dwim-print --persistent-result on -- 1 + 1
(int) $0 = 2
```
Users who wish to enable persistent results can make and use an alias that includes
`--persistent-result on`.
Differential Revision: https://reviews.llvm.org/D145609
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectDWIMPrint.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.h | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp b/lldb/source/Commands/CommandObjectDWIMPrint.cpp index d8bc7a1..419a27a 100644 --- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp +++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp @@ -71,6 +71,10 @@ bool CommandObjectDWIMPrint::DoExecute(StringRef command, return false; } + // If the user has not specified, default to disabling persistent results. + if (m_expr_options.suppress_persistent_result == eLazyBoolCalculate) + m_expr_options.suppress_persistent_result = eLazyBoolYes; + auto verbosity = GetDebugger().GetDWIMPrintVerbosity(); Target *target_ptr = m_exe_ctx.GetTargetPtr(); diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 63b9236..2658677 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -151,7 +151,7 @@ Status CommandObjectExpression::CommandOptions::SetOptionValue( bool persist_result = OptionArgParser::ToBoolean(option_arg, true, &success); if (success) - suppress_persistent_result = !persist_result; + suppress_persistent_result = !persist_result ? eLazyBoolYes : eLazyBoolNo; else error.SetErrorStringWithFormat( "could not convert \"%s\" to a boolean value.", @@ -187,7 +187,7 @@ void CommandObjectExpression::CommandOptions::OptionParsingStarting( auto_apply_fixits = eLazyBoolCalculate; top_level = false; allow_jit = true; - suppress_persistent_result = false; + suppress_persistent_result = eLazyBoolCalculate; } llvm::ArrayRef<OptionDefinition> @@ -202,8 +202,9 @@ CommandObjectExpression::CommandOptions::GetEvaluateExpressionOptions( options.SetCoerceToId(display_opts.use_objc); // Explicitly disabling persistent results takes precedence over the // m_verbosity/use_objc logic. - if (suppress_persistent_result) - options.SetSuppressPersistentResult(true); + if (suppress_persistent_result != eLazyBoolCalculate) + options.SetSuppressPersistentResult(suppress_persistent_result == + eLazyBoolYes); else if (m_verbosity == eLanguageRuntimeDescriptionDisplayVerbosityCompact) options.SetSuppressPersistentResult(display_opts.use_objc); options.SetUnwindOnError(unwind_on_error); diff --git a/lldb/source/Commands/CommandObjectExpression.h b/lldb/source/Commands/CommandObjectExpression.h index e381a4a..d6a4bb1 100644 --- a/lldb/source/Commands/CommandObjectExpression.h +++ b/lldb/source/Commands/CommandObjectExpression.h @@ -53,7 +53,7 @@ public: lldb::LanguageType language; LanguageRuntimeDescriptionDisplayVerbosity m_verbosity; LazyBool auto_apply_fixits; - bool suppress_persistent_result; + LazyBool suppress_persistent_result; }; CommandObjectExpression(CommandInterpreter &interpreter); |