Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions lldb/source/Commands/CommandObjectDWIMPrint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
maybe_add_hint(output);
result.GetOutputStream() << output;
} else {
llvm::Error error =
valobj.Dump(result.GetOutputStream(), dump_options);
llvm::Error error = valobj.Dump(result.GetOutputStream(), dump_options);
if (error) {
result.AppendError(toString(std::move(error)));
return;
Expand All @@ -155,6 +154,28 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
result.SetStatus(eReturnStatusSuccessFinishResult);
};

// If the frame is synthetic, then we handle all printing through the
// GetValueForVariableExpressionPath. This is so that the synthetic frame has
// the ability to take over anything it needs to.
if (frame && frame->IsSynthetic()) {
VariableSP var_sp;
Status status;
auto valobj_sp = frame->GetValueForVariableExpressionPath(
expr, eval_options.GetUseDynamic(),
StackFrame::eExpressionPathOptionsAllowDirectIVarAccess, var_sp,
status);

// Something failed, print the error and return immediately.
if (!status.Success()) {
result.AppendError(status.AsCString());
return;
}

// Otherwise, simply print the object.
dump_val_object(*valobj_sp);
return;
}

// First, try `expr` as a _limited_ frame variable expression path: only the
// dot operator (`.`) is permitted for this case.
//
Expand Down
Loading