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"
22#include "lldb/Target/Process.h"
24#include "lldb/Target/Target.h"
26#include "lldb/lldb-forward.h"
28#include "llvm/ADT/StringSet.h"
29
30using namespace lldb;
31using namespace lldb_private;
32
34 llvm::StringSet<> plugin_names;
36 if (!plugin_names.insert(language->GetPluginName()).second)
38 if (std::unique_ptr<OptionGroupLanguageExpression> options =
39 language->CreateExpressionOptions())
40 m_language_options.push_back(std::move(options));
42 });
43}
44
46
47#define LLDB_OPTIONS_expression
48#include "CommandOptions.inc"
49
51 uint32_t option_idx, llvm::StringRef option_arg,
52 ExecutionContext *execution_context) {
54
55 const int short_option = GetDefinitions()[option_idx].short_option;
56
57 switch (short_option) {
58 case 'l':
61 StreamString sstr;
62 sstr.Printf("unknown language type: '%s' for expression. "
63 "List of supported languages:\n",
64 option_arg.str().c_str());
65
67 error = Status(sstr.GetString().str());
68 }
69 break;
70
71 case 'a': {
72 bool success;
73 bool result;
74 result = OptionArgParser::ToBoolean(option_arg, true, &success);
75 if (!success)
77 "invalid all-threads value setting: \"%s\"",
78 option_arg.str().c_str());
79 else
80 try_all_threads = result;
81 } break;
82
83 case 'i': {
84 bool success;
85 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
86 if (success)
87 ignore_breakpoints = tmp_value;
88 else
90 "could not convert \"%s\" to a boolean value.",
91 option_arg.str().c_str());
92 break;
93 }
94
95 case 'j': {
96 bool success;
97 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
98 if (success)
99 allow_jit = tmp_value;
100 else
102 "could not convert \"%s\" to a boolean value.",
103 option_arg.str().c_str());
104 break;
105 }
106
107 case 't':
108 if (option_arg.getAsInteger(0, timeout)) {
109 timeout = 0;
111 "invalid timeout setting \"%s\"", option_arg.str().c_str());
112 }
113 break;
114
115 case 'u': {
116 bool success;
117 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
118 if (success)
119 unwind_on_error = tmp_value;
120 else
122 "could not convert \"%s\" to a boolean value.",
123 option_arg.str().c_str());
124 break;
125 }
126
127 case 'v':
128 if (option_arg.empty()) {
130 break;
131 }
134 option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
135 if (!error.Success())
137 "unrecognized value for description-verbosity '%s'",
138 option_arg.str().c_str());
139 break;
140
141 case 'g':
142 debug = true;
143 unwind_on_error = false;
144 ignore_breakpoints = false;
145 break;
146
147 case 'p':
148 top_level = true;
149 break;
150
151 case 'X': {
152 bool success;
153 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
154 if (success)
156 else
158 "could not convert \"%s\" to a boolean value.",
159 option_arg.str().c_str());
160 break;
161 }
162
163 case '\x01': {
164 bool success;
165 bool persist_result =
166 OptionArgParser::ToBoolean(option_arg, true, &success);
167 if (success)
169 else
171 "could not convert \"%s\" to a boolean value.",
172 option_arg.str().c_str());
173 break;
174 }
175
176 default:
177 llvm_unreachable("Unimplemented option");
178 }
179
180 return error;
181}
182
184 ExecutionContext *execution_context) {
185 auto process_sp =
186 execution_context ? execution_context->GetProcessSP() : ProcessSP();
187 if (process_sp) {
188 ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions();
189 unwind_on_error = process_sp->GetUnwindOnErrorInExpressions();
190 } else {
191 ignore_breakpoints = true;
192 unwind_on_error = true;
193 }
194
195 show_summary = true;
196 try_all_threads = true;
197 timeout = 0;
198 debug = false;
202 top_level = false;
203 allow_jit = true;
205}
206
207llvm::ArrayRef<OptionDefinition>
209 return llvm::ArrayRef(g_expression_options);
210}
211
214 const Target &target, const OptionGroupValueObjectDisplay &display_opts) {
216 options.SetCoerceToId(display_opts.use_object_desc);
219 options.SetKeepInMemory(true);
220 options.SetUseDynamic(display_opts.use_dynamic);
222 options.SetDebug(debug);
223 options.SetLanguage(language);
224 options.SetExecutionPolicy(
227 for (const std::unique_ptr<OptionGroupLanguageExpression> &language_options :
229 language_options->Apply(options);
230
232 if (this->auto_apply_fixits == eLazyBoolCalculate)
234 else
235 auto_apply_fixits = this->auto_apply_fixits == eLazyBoolYes;
236
239
240 if (top_level)
242
243 // If there is any chance we are going to stop and want to see what went
244 // wrong with our expression, we should generate debug info
246 options.SetGenerateDebugInfo(true);
247
248 if (timeout > 0)
249 options.SetTimeout(std::chrono::microseconds(timeout));
250 else
251 options.SetTimeout(std::nullopt);
252 return options;
253}
254
256 const OptionGroupValueObjectDisplay &display_opts) const {
257 // Explicitly disabling persistent results takes precedence over the
258 // m_verbosity/use_object_desc logic.
261
262 return display_opts.use_object_desc &&
264}
265
267 OptionGroupOptions &group) {
268 for (const std::unique_ptr<OptionGroupLanguageExpression> &language_options :
270 group.Append(language_options.get());
271}
272
274 CommandInterpreter &interpreter)
275 : CommandObjectRaw(interpreter, "expression",
276 "Evaluate an expression on the current "
277 "thread. Displays any returned value "
278 "with LLDB's default formatting.",
279 "",
280 eCommandProcessMustBePaused | eCommandTryTargetAPILock |
281 eCommandAllowsDummyTarget),
284 m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false,
285 true),
288 R"(
289Single and multi-line expressions:
290
291)"
292 " The expression provided on the command line must be a complete expression \
293with no newlines. To evaluate a multi-line expression, \
294hit a return after an empty expression, and lldb will enter the multi-line expression editor. \
295Hit return on an empty line to end the multi-line expression."
296
297 R"(
298
299Timeouts:
300
301)"
302 " If the expression can be evaluated statically (without running code) then it will be. \
303Otherwise, by default the expression will run on the current thread with a short timeout: \
304currently .25 seconds. If it doesn't return in that time, the evaluation will be interrupted \
305and resumed with all threads running. You can use the -a option to disable retrying on all \
306threads. You can use the -t option to set a shorter timeout."
307 R"(
308
309User defined variables:
310
311)"
312 " You can define your own variables for convenience or to be used in subsequent expressions. \
313You define them the same way you would define variables in C. If the first character of \
314your user defined variable is a $, then the variable's value will be available in future \
315expressions, otherwise it will just be available in the current expression."
316 R"(
317
318Continuing evaluation after a breakpoint:
319
320)"
321 " If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \
322you are done with your investigation, you can either remove the expression execution frames \
323from the stack with \"thread return -x\" or if you are still interested in the expression result \
324you can issue the \"continue\" command and the expression evaluation will complete and the \
325expression result will be available using the \"thread.completed-expression\" key in the thread \
326format."
327
328 R"(
329
330Examples:
331
332 expr my_struct->a = my_array[3]
333 expr -f bin -- (index * 8) + 5
334 expr unsigned int $foo = 5
335 expr char c[] = \"foo\"; c[0])");
336
338
339 // Add the "--format" and "--gdb-format"
345 m_command_options.AppendLanguageOptions(m_option_group);
349 m_option_group.Finalize();
350}
351
353
355
361 options.SetAutoApplyFixIts(false);
362 options.SetGenerateDebugInfo(false);
363
365
366 // Get out before we start doing things that expect a valid frame pointer.
367 if (exe_ctx.GetFramePtr() == nullptr)
368 return;
369
370 Target *exe_target = exe_ctx.GetTargetPtr();
371 Target &target = exe_target ? *exe_target : GetDummyTarget();
372
373 unsigned cursor_pos = request.GetRawCursorPos();
374 // Get the full user input including the suffix. The suffix is necessary
375 // as OptionsWithRaw will use it to detect if the cursor is cursor is in the
376 // argument part of in the raw input part of the arguments. If we cut of
377 // of the suffix then "expr -arg[cursor] --" would interpret the "-arg" as
378 // the raw input (as the "--" is hidden in the suffix).
379 llvm::StringRef code = request.GetRawLineWithUnusedSuffix();
380
381 const std::size_t original_code_size = code.size();
382
383 // Remove the first token which is 'expr' or some alias/abbreviation of that.
384 code = llvm::getToken(code).second.ltrim();
385 OptionsWithRaw args(code);
386 code = args.GetRawPart();
387
388 // The position where the expression starts in the command line.
389 assert(original_code_size >= code.size());
390 std::size_t raw_start = original_code_size - code.size();
391
392 // Check if the cursor is actually in the expression string, and if not, we
393 // exit.
394 // FIXME: We should complete the options here.
395 if (cursor_pos < raw_start)
396 return;
397
398 // Make the cursor_pos again relative to the start of the code string.
399 assert(cursor_pos >= raw_start);
400 cursor_pos -= raw_start;
401
402 auto language = exe_ctx.GetFrameRef().GetLanguage();
406 code, llvm::StringRef(), language, UserExpression::eResultTypeAny,
407 options, nullptr, error));
408 if (error.Fail())
409 return;
410
411 expr->Complete(exe_ctx, request, cursor_pos);
412}
413
416 CompilerType type(valobj.GetCompilerType());
417 CompilerType pointee;
418 if (!type.IsPointerType(&pointee))
419 return Status::FromErrorString("as it does not refer to a pointer");
420 if (pointee.IsVoidType())
421 return Status::FromErrorString("as it refers to a pointer to void");
422 return Status();
423}
424
425bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
426 Stream &output_stream,
427 Stream &error_stream,
428 CommandReturnObject &result) {
429 // Don't use m_exe_ctx as this might be called asynchronously after the
430 // command object DoExecute has finished when doing multi-line expression
431 // that use an input reader...
433 Target *exe_target = exe_ctx.GetTargetPtr();
434 Target &target = exe_target ? *exe_target : GetDummyTarget();
435
436 lldb::ValueObjectSP result_valobj_sp;
437 StackFrame *frame = exe_ctx.GetFramePtr();
438
441 "Can't disable JIT compilation for top-level expressions");
442 return false;
443 }
444
445 EvaluateExpressionOptions eval_options =
446 m_command_options.GetEvaluateExpressionOptions(target, m_varobj_options);
447 // This command manually removes the result variable, make sure expression
448 // evaluation doesn't do it first.
449 eval_options.SetSuppressPersistentResult(false);
450
451 ExpressionResults success = target.EvaluateExpression(
452 expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
453
454 // Only mention Fix-Its if the expression evaluator applied them.
455 // Compiler errors refer to the final expression after applying Fix-It(s).
456 if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
457 error_stream << " Evaluated this expression after applying Fix-It(s):\n";
458 error_stream << " " << m_fixed_expression << "\n";
459 }
460
461 if (result_valobj_sp) {
462 result.GetValueObjectList().Append(result_valobj_sp);
463
464 Format format = m_format_options.GetFormat();
465
466 if (result_valobj_sp->GetError().Success()) {
467 if (format != eFormatVoid) {
468 if (format != eFormatDefault)
469 result_valobj_sp->SetFormat(format);
470
471 if (m_varobj_options.elem_count > 0) {
473 if (error.Fail()) {
475 "expression cannot be used with --element-count %s",
476 error.AsCString(""));
477 return false;
478 }
479 }
480
481 bool suppress_result =
482 m_command_options.ShouldSuppressResult(m_varobj_options);
483
484 DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
485 m_command_options.m_verbosity, format));
486 options.SetHideRootName(suppress_result);
487 options.SetVariableFormatDisplayLanguage(
488 result_valobj_sp->GetPreferredDisplayLanguage());
489
490 if (llvm::Error error =
491 result_valobj_sp->Dump(output_stream, options)) {
492 result.AppendError(toString(std::move(error)));
493 return false;
494 }
495
496 m_interpreter.PrintWarningsIfNecessary(result.GetOutputStream(),
497 m_cmd_name);
498
499 if (suppress_result)
500 if (auto result_var_sp =
501 target.GetPersistentVariable(result_valobj_sp->GetName())) {
502 auto language = result_valobj_sp->GetPreferredDisplayLanguage();
503 if (auto *persistent_state =
505 persistent_state->RemovePersistentVariable(result_var_sp);
506 }
508 }
509 } else {
510 if (result_valobj_sp->GetError().GetError() ==
512 if (format != eFormatVoid && GetDebugger().GetNotifyVoid()) {
513 error_stream.PutCString("(void)\n");
514 }
515
517 } else {
519 result.SetError(result_valobj_sp->GetError().ToError());
520 }
521 }
522 } else {
523 error_stream.PutCString("error: unknown error\n");
524 }
525
526 // A setup or parse error can be a bug in the evaluator. Any other failure
527 // happens once the expression runs.
528 const bool evaluator_failed =
530 if (evaluator_failed)
532 return !evaluator_failed;
533}
534
536 std::string &line) {
537 io_handler.SetIsDone(true);
538 StreamSP output_stream =
540 StreamSP error_stream =
543 CommandReturnObject return_obj(
544 GetCommandInterpreter().GetDebugger().GetUseColor());
545 EvaluateExpression(line.c_str(), *output_stream, *error_stream, return_obj);
546
547 output_stream->Flush();
548 *error_stream << return_obj.GetErrorString();
549}
550
552 StringList &lines) {
553 // An empty lines is used to indicate the end of input
554 const size_t num_lines = lines.GetSize();
555 if (num_lines > 0 && lines[num_lines - 1].empty()) {
556 // Remove the last empty line from "lines" so it doesn't appear in our
557 // resulting input and return true to indicate we are done getting lines
558 lines.PopBack();
559 return true;
560 }
561 return false;
562}
563
565 m_expr_lines.clear();
567
569 bool color_prompt = debugger.GetUseColor();
570 const bool multiple_lines = true; // Get multiple lines
571 IOHandlerSP io_handler_sp(
573 "lldb-expr", // Name of input reader for history
574 llvm::StringRef(), // No prompt
575 llvm::StringRef(), // Continuation prompt
576 multiple_lines, color_prompt,
577 1, // Show line numbers starting at 1
578 *this));
579
580 if (LockableStreamFileSP output_sp = io_handler_sp->GetOutputStreamFileSP()) {
581 LockedStreamFile locked_stream = output_sp->Lock();
582 locked_stream.PutCString(
583 "Enter expressions, then terminate with an empty line to evaluate:\n");
584 }
585 debugger.RunIOHandlerAsync(io_handler_sp);
586}
587
589 // Default certain settings for REPL regardless of the global settings.
590 EvaluateExpressionOptions expr_options;
591 expr_options.SetUnwindOnError(false);
592 expr_options.SetIgnoreBreakpoints(false);
593 expr_options.SetTryAllThreads(true);
594 expr_options.SetTimeout(std::nullopt);
595 return expr_options;
596}
597
598void CommandObjectExpression::DoExecute(llvm::StringRef command,
599 CommandReturnObject &result) {
600 m_fixed_expression.clear();
602 m_option_group.NotifyOptionParsingStarting(&exe_ctx);
603
604 if (command.empty()) {
606 // Still gathering input; the IOHandler will set the final status.
608 return;
609 }
610
611 OptionsWithRaw args(command);
612 llvm::StringRef expr = args.GetRawPart();
613
614 if (args.HasArgs()) {
615 if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group, exe_ctx))
616 return;
617
618 if (m_repl_option.GetOptionValue().GetCurrentValue()) {
619 Target *target = GetTarget();
620 assert(target && "target guaranteed by eCommandAllowsDummyTarget");
621 // Drop into REPL
622 m_expr_lines.clear();
624
625 Debugger &debugger = target->GetDebugger();
626
627 // Check if the LLDB command interpreter is sitting on top of a REPL
628 // that launched it...
631 // the LLDB command interpreter is sitting on top of a REPL that
632 // launched it, so just say the command interpreter is done and
633 // fall back to the existing REPL
634 m_interpreter.GetIOHandler(false)->SetIsDone(true);
635 } else {
636 // We are launching the REPL on top of the current LLDB command
637 // interpreter, so just push one
638 bool initialize = false;
639 Status repl_error;
640 REPLSP repl_sp(target->GetREPL(repl_error, m_command_options.language,
641 nullptr, false));
642
643 if (!repl_sp) {
644 initialize = true;
645 repl_sp = target->GetREPL(repl_error, m_command_options.language,
646 nullptr, true);
647 if (repl_error.Fail()) {
648 result.SetError(std::move(repl_error));
649 return;
650 }
651 }
652
653 if (repl_sp) {
654 if (initialize) {
655 repl_sp->SetEvaluateOptions(GetExprOptions());
656 repl_sp->SetFormatOptions(m_format_options);
657 repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
658 }
659
660 IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
661 io_handler_sp->SetIsDone(false);
662 debugger.RunIOHandlerAsync(io_handler_sp);
663 } else {
665 "Couldn't create a REPL for %s",
667 result.SetError(std::move(repl_error));
668 return;
669 }
670 }
671 }
672 // No expression following options
673 else if (expr.empty()) {
675 // Still gathering input; the IOHandler will set the final status.
677 return;
678 }
679 }
680
681 // Previously the indent was set up for diagnosing command line
682 // parsing errors. Now point it to the expression.
683 std::optional<uint16_t> indent;
684 size_t pos = m_original_command.rfind(expr);
685 if (pos != llvm::StringRef::npos)
686 indent = pos;
687 result.SetDiagnosticIndent(indent);
688
689 Target *target = GetTarget();
690 assert(target && "target guaranteed by eCommandAllowsDummyTarget");
691 if (EvaluateExpression(expr, result.GetOutputStream(),
692 result.GetErrorStream(), result)) {
693
694 if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) {
695 CommandHistory &history = m_interpreter.GetCommandHistory();
696 // FIXME: Can we figure out what the user actually typed (e.g. some alias
697 // for expr???)
698 // If we can it would be nice to show that.
699 std::string fixed_command("expression ");
700 if (args.HasArgs()) {
701 // Add in any options that might have been in the original command:
702 fixed_command.append(std::string(args.GetArgStringWithDelimiter()));
703 fixed_command.append(m_fixed_expression);
704 } else
705 fixed_command.append(m_fixed_expression);
706 history.AppendString(fixed_command);
707 }
708 return;
709 }
711}
static EvaluateExpressionOptions GetExprOptions()
static lldb_private::Status CanBeUsedForElementCountPrinting(ValueObject &valobj)
static llvm::raw_ostream & error(Stream &strm)
void AppendString(llvm::StringRef str, bool reject_if_dupe=true)
ExecutionContext GetExecutionContext(bool adopt_dummy_target=true) const
Returns the execution context the interpreter should run a command in.
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
bool ShouldSuppressResult(const OptionGroupValueObjectDisplay &display_opts) const
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity
std::vector< std::unique_ptr< OptionGroupLanguageExpression > > m_language_options
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
void AppendLanguageOptions(OptionGroupOptions &group)
Appends the options that language plugins add to the commands that evaluate expressions to group.
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
Target * GetTarget()
Get the target this command should operate on.
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:106
lldb::StreamUP GetAsyncErrorStream()
bool GetUseColor() const
Definition Debugger.cpp:544
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
void SuggestBugReport(llvm::StringRef failure, Stream &strm)
Writes the 'bugreport' note to strm if ShouldSuggestBugReport.
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
lldb::StreamUP GetAsyncOutputStream()
void SetUnwindOnError(bool unwind=false)
Definition Target.h:412
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:370
void SetKeepInMemory(bool keep=true)
Definition Target.h:422
void SetCoerceToId(bool coerce=true)
Definition Target.h:408
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:376
void SetTryAllThreads(bool try_others=true)
Definition Target.h:445
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:518
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:433
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:365
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:416
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:427
"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:303
static void ForEach(llvm::function_ref< IterationAction(Language *)> callback)
Definition Language.cpp:109
static const char * GetNameForLanguageType(lldb::LanguageType language)
Returns the internal LLDB name for the specified language.
Definition Language.cpp:292
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
static const uint32_t OPTION_GROUP_GDB_FMT
static const uint32_t OPTION_GROUP_FORMAT
void Append(OptionGroup *group)
Append options from a OptionGroup class.
Definition Options.cpp:759
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
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:293
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:63
bool GetEnableNotifyAboutFixIts() const
Definition Target.cpp:5738
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:5732
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:5726
Debugger & GetDebugger() const
Definition Target.h:1378
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2865
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:3097
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:337
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:2885
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:3029
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.
std::string toString(FormatterBytecode::OpCodes op)
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
@ eReturnStatusStarted
@ 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)