LLDB mainline
CommandObjectExpression.cpp
Go to the documentation of this file.
1//===-- CommandObjectExpression.cpp ---------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "lldb/Core/Debugger.h"
21#include "lldb/Target/Process.h"
23#include "lldb/Target/Target.h"
26#include "lldb/lldb-forward.h"
28
29using namespace lldb;
30using namespace lldb_private;
31
33
35
36#define LLDB_OPTIONS_expression
37#include "CommandOptions.inc"
38
40 uint32_t option_idx, llvm::StringRef option_arg,
41 ExecutionContext *execution_context) {
43
44 const int short_option = GetDefinitions()[option_idx].short_option;
45
46 switch (short_option) {
47 case 'l':
50 StreamString sstr;
51 sstr.Printf("unknown language type: '%s' for expression. "
52 "List of supported languages:\n",
53 option_arg.str().c_str());
54
56 error = Status(sstr.GetString().str());
57 }
58 break;
59
60 case 'a': {
61 bool success;
62 bool result;
63 result = OptionArgParser::ToBoolean(option_arg, true, &success);
64 if (!success)
66 "invalid all-threads value setting: \"%s\"",
67 option_arg.str().c_str());
68 else
69 try_all_threads = result;
70 } break;
71
72 case 'i': {
73 bool success;
74 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
75 if (success)
76 ignore_breakpoints = tmp_value;
77 else
79 "could not convert \"%s\" to a boolean value.",
80 option_arg.str().c_str());
81 break;
82 }
83
84 case 'j': {
85 bool success;
86 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
87 if (success)
88 allow_jit = tmp_value;
89 else
91 "could not convert \"%s\" to a boolean value.",
92 option_arg.str().c_str());
93 break;
94 }
95
96 case 't':
97 if (option_arg.getAsInteger(0, timeout)) {
98 timeout = 0;
100 "invalid timeout setting \"%s\"", option_arg.str().c_str());
101 }
102 break;
103
104 case 'u': {
105 bool success;
106 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
107 if (success)
108 unwind_on_error = tmp_value;
109 else
111 "could not convert \"%s\" to a boolean value.",
112 option_arg.str().c_str());
113 break;
114 }
115
116 case 'v':
117 if (option_arg.empty()) {
119 break;
120 }
123 option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
124 if (!error.Success())
126 "unrecognized value for description-verbosity '%s'",
127 option_arg.str().c_str());
128 break;
129
130 case 'g':
131 debug = true;
132 unwind_on_error = false;
133 ignore_breakpoints = false;
134 break;
135
136 case 'p':
137 top_level = true;
138 break;
139
140 case 'X': {
141 bool success;
142 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
143 if (success)
145 else
147 "could not convert \"%s\" to a boolean value.",
148 option_arg.str().c_str());
149 break;
150 }
151
152 case '\x01': {
153 bool success;
154 bool persist_result =
155 OptionArgParser::ToBoolean(option_arg, true, &success);
156 if (success)
158 else
160 "could not convert \"%s\" to a boolean value.",
161 option_arg.str().c_str());
162 break;
163 }
164
165 default:
166 llvm_unreachable("Unimplemented option");
167 }
168
169 return error;
170}
171
173 ExecutionContext *execution_context) {
174 auto process_sp =
175 execution_context ? execution_context->GetProcessSP() : ProcessSP();
176 if (process_sp) {
177 ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions();
178 unwind_on_error = process_sp->GetUnwindOnErrorInExpressions();
179 } else {
180 ignore_breakpoints = true;
181 unwind_on_error = true;
182 }
183
184 show_summary = true;
185 try_all_threads = true;
186 timeout = 0;
187 debug = false;
191 top_level = false;
192 allow_jit = true;
194}
195
196llvm::ArrayRef<OptionDefinition>
198 return llvm::ArrayRef(g_expression_options);
199}
200
203 const Target &target, const OptionGroupValueObjectDisplay &display_opts) {
205 options.SetCoerceToId(display_opts.use_object_desc);
208 options.SetKeepInMemory(true);
209 options.SetUseDynamic(display_opts.use_dynamic);
211 options.SetDebug(debug);
212 options.SetLanguage(language);
213 options.SetExecutionPolicy(
216
218 if (this->auto_apply_fixits == eLazyBoolCalculate)
220 else
221 auto_apply_fixits = this->auto_apply_fixits == eLazyBoolYes;
222
225
226 if (top_level)
228
229 // If there is any chance we are going to stop and want to see what went
230 // wrong with our expression, we should generate debug info
232 options.SetGenerateDebugInfo(true);
233
234 if (timeout > 0)
235 options.SetTimeout(std::chrono::microseconds(timeout));
236 else
237 options.SetTimeout(std::nullopt);
238 return options;
239}
240
242 const OptionGroupValueObjectDisplay &display_opts) const {
243 // Explicitly disabling persistent results takes precedence over the
244 // m_verbosity/use_object_desc logic.
247
248 return display_opts.use_object_desc &&
250}
251
253 CommandInterpreter &interpreter)
254 : CommandObjectRaw(interpreter, "expression",
255 "Evaluate an expression on the current "
256 "thread. Displays any returned value "
257 "with LLDB's default formatting.",
258 "",
259 eCommandProcessMustBePaused | eCommandTryTargetAPILock),
262 m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false,
263 true),
266 R"(
267Single and multi-line expressions:
268
269)"
270 " The expression provided on the command line must be a complete expression \
271with no newlines. To evaluate a multi-line expression, \
272hit a return after an empty expression, and lldb will enter the multi-line expression editor. \
273Hit return on an empty line to end the multi-line expression."
274
275 R"(
276
277Timeouts:
278
279)"
280 " If the expression can be evaluated statically (without running code) then it will be. \
281Otherwise, by default the expression will run on the current thread with a short timeout: \
282currently .25 seconds. If it doesn't return in that time, the evaluation will be interrupted \
283and resumed with all threads running. You can use the -a option to disable retrying on all \
284threads. You can use the -t option to set a shorter timeout."
285 R"(
286
287User defined variables:
288
289)"
290 " You can define your own variables for convenience or to be used in subsequent expressions. \
291You define them the same way you would define variables in C. If the first character of \
292your user defined variable is a $, then the variable's value will be available in future \
293expressions, otherwise it will just be available in the current expression."
294 R"(
295
296Continuing evaluation after a breakpoint:
297
298)"
299 " If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \
300you are done with your investigation, you can either remove the expression execution frames \
301from the stack with \"thread return -x\" or if you are still interested in the expression result \
302you can issue the \"continue\" command and the expression evaluation will complete and the \
303expression result will be available using the \"thread.completed-expression\" key in the thread \
304format."
305
306 R"(
307
308Examples:
310 expr my_struct->a = my_array[3]
311 expr -f bin -- (index * 8) + 5
312 expr unsigned int $foo = 5
313 expr char c[] = \"foo\"; c[0])");
314
316
317 // Add the "--format" and "--gdb-format"
326 m_option_group.Finalize();
327}
328
330
332
338 options.SetAutoApplyFixIts(false);
339 options.SetGenerateDebugInfo(false);
340
342
343 // Get out before we start doing things that expect a valid frame pointer.
344 if (exe_ctx.GetFramePtr() == nullptr)
345 return;
346
347 Target *exe_target = exe_ctx.GetTargetPtr();
348 Target &target = exe_target ? *exe_target : GetDummyTarget();
349
350 unsigned cursor_pos = request.GetRawCursorPos();
351 // Get the full user input including the suffix. The suffix is necessary
352 // as OptionsWithRaw will use it to detect if the cursor is cursor is in the
353 // argument part of in the raw input part of the arguments. If we cut of
354 // of the suffix then "expr -arg[cursor] --" would interpret the "-arg" as
355 // the raw input (as the "--" is hidden in the suffix).
356 llvm::StringRef code = request.GetRawLineWithUnusedSuffix();
357
358 const std::size_t original_code_size = code.size();
359
360 // Remove the first token which is 'expr' or some alias/abbreviation of that.
361 code = llvm::getToken(code).second.ltrim();
362 OptionsWithRaw args(code);
363 code = args.GetRawPart();
364
365 // The position where the expression starts in the command line.
366 assert(original_code_size >= code.size());
367 std::size_t raw_start = original_code_size - code.size();
368
369 // Check if the cursor is actually in the expression string, and if not, we
370 // exit.
371 // FIXME: We should complete the options here.
372 if (cursor_pos < raw_start)
373 return;
374
375 // Make the cursor_pos again relative to the start of the code string.
376 assert(cursor_pos >= raw_start);
377 cursor_pos -= raw_start;
378
379 auto language = exe_ctx.GetFrameRef().GetLanguage();
383 code, llvm::StringRef(), language, UserExpression::eResultTypeAny,
384 options, nullptr, error));
385 if (error.Fail())
386 return;
387
388 expr->Complete(exe_ctx, request, cursor_pos);
389}
390
393 CompilerType type(valobj.GetCompilerType());
394 CompilerType pointee;
395 if (!type.IsPointerType(&pointee))
396 return Status::FromErrorString("as it does not refer to a pointer");
397 if (pointee.IsVoidType())
398 return Status::FromErrorString("as it refers to a pointer to void");
399 return Status();
400}
401
402bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
403 Stream &output_stream,
404 Stream &error_stream,
405 CommandReturnObject &result) {
406 // Don't use m_exe_ctx as this might be called asynchronously after the
407 // command object DoExecute has finished when doing multi-line expression
408 // that use an input reader...
410 Target *exe_target = exe_ctx.GetTargetPtr();
411 Target &target = exe_target ? *exe_target : GetDummyTarget();
412
413 lldb::ValueObjectSP result_valobj_sp;
414 StackFrame *frame = exe_ctx.GetFramePtr();
415
418 "Can't disable JIT compilation for top-level expressions.\n");
419 return false;
420 }
421
422 EvaluateExpressionOptions eval_options =
423 m_command_options.GetEvaluateExpressionOptions(target, m_varobj_options);
424 // This command manually removes the result variable, make sure expression
425 // evaluation doesn't do it first.
426 eval_options.SetSuppressPersistentResult(false);
427
428 ExpressionResults success = target.EvaluateExpression(
429 expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
430
431 // Only mention Fix-Its if the expression evaluator applied them.
432 // Compiler errors refer to the final expression after applying Fix-It(s).
433 if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
434 error_stream << " Evaluated this expression after applying Fix-It(s):\n";
435 error_stream << " " << m_fixed_expression << "\n";
436 }
437
438 if (result_valobj_sp) {
439 result.GetValueObjectList().Append(result_valobj_sp);
440
441 Format format = m_format_options.GetFormat();
442
443 if (result_valobj_sp->GetError().Success()) {
444 if (format != eFormatVoid) {
445 if (format != eFormatDefault)
446 result_valobj_sp->SetFormat(format);
447
448 if (m_varobj_options.elem_count > 0) {
450 if (error.Fail()) {
452 "expression cannot be used with --element-count %s\n",
453 error.AsCString(""));
454 return false;
455 }
456 }
457
458 bool suppress_result =
459 m_command_options.ShouldSuppressResult(m_varobj_options);
460
461 DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
462 m_command_options.m_verbosity, format));
463 options.SetHideRootName(suppress_result);
464 options.SetVariableFormatDisplayLanguage(
465 result_valobj_sp->GetPreferredDisplayLanguage());
466
467 if (llvm::Error error =
468 result_valobj_sp->Dump(output_stream, options)) {
469 result.AppendError(toString(std::move(error)));
470 return false;
471 }
472
473 m_interpreter.PrintWarningsIfNecessary(result.GetOutputStream(),
474 m_cmd_name);
475
476 if (suppress_result)
477 if (auto result_var_sp =
478 target.GetPersistentVariable(result_valobj_sp->GetName())) {
479 auto language = result_valobj_sp->GetPreferredDisplayLanguage();
480 if (auto *persistent_state =
482 persistent_state->RemovePersistentVariable(result_var_sp);
483 }
486 } else {
487 if (result_valobj_sp->GetError().GetError() ==
489 if (format != eFormatVoid && GetDebugger().GetNotifyVoid()) {
490 error_stream.PutCString("(void)\n");
491 }
492
494 } else {
496 result.SetError(result_valobj_sp->GetError().ToError());
497 }
498 }
499 } else {
500 error_stream.Printf("error: unknown error\n");
502
503 return (success != eExpressionSetupError &&
504 success != eExpressionParseError);
505}
506
508 std::string &line) {
509 io_handler.SetIsDone(true);
510 StreamSP output_stream =
512 StreamSP error_stream =
515 CommandReturnObject return_obj(
516 GetCommandInterpreter().GetDebugger().GetUseColor());
517 EvaluateExpression(line.c_str(), *output_stream, *error_stream, return_obj);
518
519 output_stream->Flush();
520 *error_stream << return_obj.GetErrorString();
521}
522
524 StringList &lines) {
525 // An empty lines is used to indicate the end of input
526 const size_t num_lines = lines.GetSize();
527 if (num_lines > 0 && lines[num_lines - 1].empty()) {
528 // Remove the last empty line from "lines" so it doesn't appear in our
529 // resulting input and return true to indicate we are done getting lines
530 lines.PopBack();
531 return true;
532 }
533 return false;
534}
535
537 m_expr_lines.clear();
541 bool color_prompt = debugger.GetUseColor();
542 const bool multiple_lines = true; // Get multiple lines
543 IOHandlerSP io_handler_sp(
545 "lldb-expr", // Name of input reader for history
546 llvm::StringRef(), // No prompt
547 llvm::StringRef(), // Continuation prompt
548 multiple_lines, color_prompt,
549 1, // Show line numbers starting at 1
550 *this));
551
552 if (LockableStreamFileSP output_sp = io_handler_sp->GetOutputStreamFileSP()) {
553 LockedStreamFile locked_stream = output_sp->Lock();
554 locked_stream.PutCString(
555 "Enter expressions, then terminate with an empty line to evaluate:\n");
556 }
557 debugger.RunIOHandlerAsync(io_handler_sp);
558}
559
563 command_options.OptionParsingStarting(&ctx);
564
565 // Default certain settings for REPL regardless of the global settings.
566 command_options.unwind_on_error = false;
567 command_options.ignore_breakpoints = false;
568 command_options.debug = false;
569
570 EvaluateExpressionOptions expr_options;
571 expr_options.SetUnwindOnError(command_options.unwind_on_error);
572 expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
573 expr_options.SetTryAllThreads(command_options.try_all_threads);
574
575 if (command_options.timeout > 0)
576 expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
577 else
578 expr_options.SetTimeout(std::nullopt);
579
580 return expr_options;
581}
582
583void CommandObjectExpression::DoExecute(llvm::StringRef command,
584 CommandReturnObject &result) {
585 m_fixed_expression.clear();
588
589 if (command.empty()) {
591 return;
592 }
593
594 OptionsWithRaw args(command);
595 llvm::StringRef expr = args.GetRawPart();
596
597 if (args.HasArgs()) {
598 if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group, exe_ctx))
599 return;
600
602 Target &target = GetTarget();
603 // Drop into REPL
604 m_expr_lines.clear();
606
607 Debugger &debugger = target.GetDebugger();
608
609 // Check if the LLDB command interpreter is sitting on top of a REPL
610 // that launched it...
613 // the LLDB command interpreter is sitting on top of a REPL that
614 // launched it, so just say the command interpreter is done and
615 // fall back to the existing REPL
616 m_interpreter.GetIOHandler(false)->SetIsDone(true);
617 } else {
618 // We are launching the REPL on top of the current LLDB command
619 // interpreter, so just push one
620 bool initialize = false;
621 Status repl_error;
622 REPLSP repl_sp(target.GetREPL(repl_error, m_command_options.language,
623 nullptr, false));
624
625 if (!repl_sp) {
626 initialize = true;
627 repl_sp = target.GetREPL(repl_error, m_command_options.language,
628 nullptr, true);
629 if (repl_error.Fail()) {
630 result.SetError(std::move(repl_error));
631 return;
632 }
633 }
634
635 if (repl_sp) {
636 if (initialize) {
637 repl_sp->SetEvaluateOptions(
639 repl_sp->SetFormatOptions(m_format_options);
640 repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
641 }
642
643 IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
644 io_handler_sp->SetIsDone(false);
645 debugger.RunIOHandlerAsync(io_handler_sp);
646 } else {
648 "Couldn't create a REPL for %s",
650 result.SetError(std::move(repl_error));
651 return;
652 }
653 }
654 }
655 // No expression following options
656 else if (expr.empty()) {
658 return;
659 }
660 }
661
662 // Previously the indent was set up for diagnosing command line
663 // parsing errors. Now point it to the expression.
664 std::optional<uint16_t> indent;
665 size_t pos = m_original_command.rfind(expr);
666 if (pos != llvm::StringRef::npos)
667 indent = pos;
668 result.SetDiagnosticIndent(indent);
669
670 Target &target = GetTarget();
671 if (EvaluateExpression(expr, result.GetOutputStream(),
672 result.GetErrorStream(), result)) {
673
674 if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
675 CommandHistory &history = m_interpreter.GetCommandHistory();
676 // FIXME: Can we figure out what the user actually typed (e.g. some alias
677 // for expr???)
678 // If we can it would be nice to show that.
679 std::string fixed_command("expression ");
680 if (args.HasArgs()) {
681 // Add in any options that might have been in the original command:
682 fixed_command.append(std::string(args.GetArgStringWithDelimiter()));
683 fixed_command.append(m_fixed_expression);
684 } else
685 fixed_command.append(m_fixed_expression);
686 history.AppendString(fixed_command);
687 }
688 return;
689 }
691}
static lldb_private::Status CanBeUsedForElementCountPrinting(ValueObject &valobj)
static EvaluateExpressionOptions GetExprOptions(ExecutionContext &ctx, CommandObjectExpression::CommandOptions command_options)
static llvm::raw_ostream & error(Stream &strm)
void AppendString(llvm::StringRef str, bool reject_if_dupe=true)
ExecutionContext GetExecutionContext() const
lldb::IOHandlerSP GetIOHandler(bool force_create=false, CommandInterpreterRunOptions *options=nullptr)
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
bool ShouldSuppressResult(const OptionGroupValueObjectDisplay &display_opts) const
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
EvaluateExpressionOptions GetEvaluateExpressionOptions(const Target &target, const OptionGroupValueObjectDisplay &display_opts)
Return the appropriate expression options used for evaluating the expression in the given target.
CommandObjectExpression(CommandInterpreter &interpreter)
bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines) override
Called to determine whether typing enter after the last line in lines should end input.
OptionGroupValueObjectDisplay m_varobj_options
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream, Stream &error_stream, CommandReturnObject &result)
Evaluates the given expression.
void IOHandlerInputComplete(IOHandler &io_handler, std::string &line) override
Called when a line or lines have been retrieved.
void DoExecute(llvm::StringRef command, CommandReturnObject &result) override
CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help="", llvm::StringRef syntax="", uint32_t flags=0)
virtual void SetHelpLong(llvm::StringRef str)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
void void AppendError(llvm::StringRef in_string)
const ValueObjectList & GetValueObjectList() const
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void SetDiagnosticIndent(std::optional< uint16_t > indent)
Generic representation of a type in a programming language.
"lldb/Utility/ArgCompletionRequest.h"
llvm::StringRef GetRawLineWithUnusedSuffix() const
Returns the full raw user input used to create this CompletionRequest.
A class to manage flag bits.
Definition Debugger.h:80
lldb::StreamUP GetAsyncErrorStream()
bool GetUseColor() const
Definition Debugger.cpp:452
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
lldb::StreamUP GetAsyncOutputStream()
void SetUnwindOnError(bool unwind=false)
Definition Target.h:371
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:329
void SetKeepInMemory(bool keep=true)
Definition Target.h:381
void SetCoerceToId(bool coerce=true)
Definition Target.h:367
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:335
void SetTryAllThreads(bool try_others=true)
Definition Target.h:404
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:473
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:392
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:322
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:375
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:386
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
IOHandlerDelegate(Completion completion=Completion::None)
Definition IOHandler.h:188
void SetIsDone(bool b)
Definition IOHandler.h:81
static void PrintSupportedLanguagesForExpressions(Stream &s, llvm::StringRef prefix, llvm::StringRef suffix)
Prints to the specified stream 's' each language type that the current target supports for expression...
Definition Language.cpp:273
static const char * GetNameForLanguageType(lldb::LanguageType language)
Definition Language.cpp:266
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
OptionValueBoolean & GetOptionValue()
static const uint32_t OPTION_GROUP_GDB_FMT
static const uint32_t OPTION_GROUP_FORMAT
A pair of an option list with a 'raw' string as a suffix.
Definition Args.h:319
A command line option parsing protocol class.
Definition Options.h:58
void NotifyOptionParsingStarting(ExecutionContext *execution_context)
Definition Options.cpp:69
This base class provides an interface to stack frames.
Definition StackFrame.h:44
An error handling class.
Definition Status.h:118
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Definition Status.cpp:106
static Status FromErrorString(const char *str)
Definition Status.h:141
bool Fail() const
Test for error condition.
Definition Status.cpp:294
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:65
bool GetEnableNotifyAboutFixIts() const
Definition Target.cpp:4803
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:4797
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:4791
Debugger & GetDebugger() const
Definition Target.h:1097
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2675
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2910
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:308
UserExpression * GetUserExpressionForLanguage(llvm::StringRef expr, llvm::StringRef prefix, SourceLanguage language, Expression::ResultType desired_type, const EvaluateExpressionOptions &options, ValueObject *ctx_obj, Status &error)
Definition Target.cpp:2695
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)
Definition Target.cpp:2842
static const Status::ValueType kNoResult
ValueObject::GetError() returns this if there is no result from the expression.
void Append(const lldb::ValueObjectSP &val_obj_sp)
CompilerType GetCompilerType()
#define LLDB_OPT_SET_1
#define LLDB_OPT_SET_2
#define LLDB_OPT_SET_ALL
#define LLDB_OPT_SET_3
A class that represents a running process on the host machine.
const char * toString(AppleArm64ExceptionClass EC)
std::shared_ptr< lldb_private::IOHandler > IOHandlerSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Format
Display format definitions.
@ eFormatVoid
Do not print this.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::UserExpression > UserExpressionSP
ExpressionResults
The results of expression evaluation.
@ eExpressionParseError
@ eExpressionSetupError
std::shared_ptr< lldb_private::Process > ProcessSP
@ eReturnStatusFailed
@ eReturnStatusSuccessFinishResult
std::shared_ptr< lldb_private::LockableStreamFile > LockableStreamFileSP
std::shared_ptr< lldb_private::REPL > REPLSP
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)