diff options
author | Dave Lee <davelee.com@gmail.com> | 2025-08-15 08:37:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-15 08:37:26 -0700 |
commit | ae7e1b82fe97f184fdc042f339784a64f28d5c08 (patch) | |
tree | 3aedbfb9009f85581c498dc0d60607bad84178c7 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | ffaba758fb4ff98820c0a9ae15733863d1c5be37 (diff) | |
download | llvm-ae7e1b82fe97f184fdc042f339784a64f28d5c08.zip llvm-ae7e1b82fe97f184fdc042f339784a64f28d5c08.tar.gz llvm-ae7e1b82fe97f184fdc042f339784a64f28d5c08.tar.bz2 |
[lldb] Print ValueObject when GetObjectDescription fails (#152417)
This fixes a few bugs, effectively through a fallback to `p` when `po` fails.
The motivating bug this fixes is when an error within the compiler causes `po` to fail.
Previously when that happened, only its value (typically an object's address) was
printed – and problematically, no compiler diagnostics were shown. With this change,
compiler diagnostics are shown, _and_ the object is fully printed (ie `p`).
Another bug this fixes is when `po` is used on a type that doesn't provide an object
description (such as a struct). Again, the normal `ValueObject` printing is used.
Additionally, this also improves how lldb handles an object description method that
fails in some way. Now an error will be shown (it wasn't before), and the value will be
printed normally.
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index c5b9167..197bffe9 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -202,7 +202,7 @@ EvaluateExpressionOptions CommandObjectExpression::CommandOptions::GetEvaluateExpressionOptions( const Target &target, const OptionGroupValueObjectDisplay &display_opts) { EvaluateExpressionOptions options; - options.SetCoerceToId(display_opts.use_objc); + options.SetCoerceToId(display_opts.use_object_desc); options.SetUnwindOnError(unwind_on_error); options.SetIgnoreBreakpoints(ignore_breakpoints); options.SetKeepInMemory(true); @@ -241,11 +241,11 @@ CommandObjectExpression::CommandOptions::GetEvaluateExpressionOptions( bool CommandObjectExpression::CommandOptions::ShouldSuppressResult( const OptionGroupValueObjectDisplay &display_opts) const { // Explicitly disabling persistent results takes precedence over the - // m_verbosity/use_objc logic. + // m_verbosity/use_object_desc logic. if (suppress_persistent_result != eLazyBoolCalculate) return suppress_persistent_result == eLazyBoolYes; - return display_opts.use_objc && + return display_opts.use_object_desc && m_verbosity == eLanguageRuntimeDescriptionDisplayVerbosityCompact; } @@ -332,7 +332,7 @@ Options *CommandObjectExpression::GetOptions() { return &m_option_group; } void CommandObjectExpression::HandleCompletion(CompletionRequest &request) { EvaluateExpressionOptions options; - options.SetCoerceToId(m_varobj_options.use_objc); + options.SetCoerceToId(m_varobj_options.use_object_desc); options.SetLanguage(m_command_options.language); options.SetExecutionPolicy(lldb_private::eExecutionPolicyNever); options.SetAutoApplyFixIts(false); |