25#include "llvm/ADT/StringRef.h"
26#include "llvm/Support/FormatVariadic.h"
34 "Print a variable or expression.",
35 "dwim-print [<variable-name> | <expression>]",
36 eCommandProcessMustBePaused | eCommandTryTargetAPILock) {
45 StringRef exclude_expr_options[] = {
"debug",
"top-level"};
104 if (valobj_sp && valobj_sp->GetError().Success()) {
105 if (!suppress_result) {
106 if (
auto persisted_valobj = valobj_sp->Persist())
107 valobj_sp = persisted_valobj;
113 flags = args.GetArgString();
127 ValueObjectSP valobj_sp;
134 flags = args.GetArgStringWithDelimiter();
143 if (
auto result_var_sp =
145 auto language = valobj_sp->GetPreferredDisplayLanguage();
146 if (
auto *persistent_state =
148 persistent_state->RemovePersistentVariable(result_var_sp);
155 result.
SetError(valobj_sp->GetError());
158 "unknown error evaluating expression `{0}`", expr);
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
@ eVariablePathCompletion
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override
Options * GetOptions() override
CommandObjectExpression::CommandOptions m_expr_options
OptionGroupFormat m_format_options
OptionGroupOptions m_option_group
CommandObjectDWIMPrint(CommandInterpreter &interpreter)
OptionGroupValueObjectDisplay m_varobj_options
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
bool ShouldSuppressResult(const OptionGroupValueObjectDisplay &display_opts) const
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity
LazyBool suppress_persistent_result
EvaluateExpressionOptions GetEvaluateExpressionOptions(const Target &target, const OptionGroupValueObjectDisplay &display_opts)
Return the appropriate expression options used for evaluating the expression in the given target.
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
Target & GetDummyTarget()
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
void AppendErrorWithFormatv(const char *format, Args &&... args)
void SetStatus(lldb::ReturnStatus status)
void void AppendMessageWithFormatv(const char *format, Args &&... args)
void SetError(const Status &error, const char *fallback_error_cstr=nullptr)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
A uniqued constant string class.
lldb::DWIMPrintVerbosity GetDWIMPrintVerbosity() const
DumpValueObjectOptions & SetHideRootName(bool hide_root_name)
void SetSuppressPersistentResult(bool b)
ExecutionContextScope * GetBestExecutionContextScope() const
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
void Append(OptionGroup *group)
Append options from a OptionGroup class.
DumpValueObjectOptions GetAsDumpOptions(LanguageRuntimeDescriptionDisplayVerbosity lang_descr_verbosity=eLanguageRuntimeDescriptionDisplayVerbosityFull, lldb::Format format=lldb::eFormatDefault, lldb::TypeSummaryImplSP summary_sp=lldb::TypeSummaryImplSP())
A pair of an option list with a 'raw' string as a suffix.
const std::string & GetRawPart() const
Returns the raw suffix part of the parsed string.
A command line option parsing protocol class.
void NotifyOptionParsingStarting(ExecutionContext *execution_context)
This base class provides an interface to stack frames.
lldb::ValueObjectSP FindVariable(ConstString name)
Attempt to reconstruct the ValueObject for a variable with a given name from within the current Stack...
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
static const Status::ValueType kNoResult
ValueObject::GetError() returns this if there is no result from the expression.
A class that represents a running process on the host machine.
std::vector< OptionArgElement > OptionElementVector
@ eDWIMPrintVerbosityFull
Always print a message indicating how dwim-print is evaluating its expression.
@ eDWIMPrintVerbosityNone
Run dwim-print with no verbosity.
ExpressionResults
The results of expression evaluation.
@ eReturnStatusSuccessFinishResult
Used to build individual command argument lists.