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
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 'Q':
49 break;
50 case 'l':
53 StreamString sstr;
54 sstr.Printf("unknown language type: '%s' for expression. "
55 "List of supported languages:\n",
56 option_arg.str().c_str());
57
59 error = Status(sstr.GetString().str());
60 }
61 break;
62
63 case 'a': {
64 bool success;
65 bool result;
66 result = OptionArgParser::ToBoolean(option_arg, true, &success);
67 if (!success)
69 "invalid all-threads value setting: \"%s\"",
70 option_arg.str().c_str());
71 else
72 try_all_threads = result;
73 } break;
74
75 case 'i': {
76 bool success;
77 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
78 if (success)
79 ignore_breakpoints = tmp_value;
80 else
82 "could not convert \"%s\" to a boolean value.",
83 option_arg.str().c_str());
84 break;
85 }
86
87 case 'j': {
88 bool success;
89 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
90 if (success)
91 allow_jit = tmp_value;
92 else
94 "could not convert \"%s\" to a boolean value.",
95 option_arg.str().c_str());
96 break;
97 }
98
99 case 't':
100 if (option_arg.getAsInteger(0, timeout)) {
101 timeout = 0;
103 "invalid timeout setting \"%s\"", option_arg.str().c_str());
104 }
105 break;
106
107 case 'u': {
108 bool success;
109 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
110 if (success)
111 unwind_on_error = tmp_value;
112 else
114 "could not convert \"%s\" to a boolean value.",
115 option_arg.str().c_str());
116 break;
117 }
118
119 case 'v':
120 if (option_arg.empty()) {
122 break;
123 }
126 option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
127 if (!error.Success())
129 "unrecognized value for description-verbosity '%s'",
130 option_arg.str().c_str());
131 break;
132
133 case 'g':
134 debug = true;
135 unwind_on_error = false;
136 ignore_breakpoints = false;
137 break;
138
139 case 'p':
140 top_level = true;
141 break;
142
143 case 'X': {
144 bool success;
145 bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
146 if (success)
148 else
150 "could not convert \"%s\" to a boolean value.",
151 option_arg.str().c_str());
152 break;
153 }
154
155 case '\x01': {
156 bool success;
157 bool persist_result =
158 OptionArgParser::ToBoolean(option_arg, true, &success);
159 if (success)
161 else
163 "could not convert \"%s\" to a boolean value.",
164 option_arg.str().c_str());
165 break;
166 }
167
168 default:
169 llvm_unreachable("Unimplemented option");
170 }
171
172 return error;
173}
174
176 ExecutionContext *execution_context) {
177 auto process_sp =
178 execution_context ? execution_context->GetProcessSP() : ProcessSP();
179 if (process_sp) {
180 ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions();
181 unwind_on_error = process_sp->GetUnwindOnErrorInExpressions();
182 } else {
183 ignore_breakpoints = true;
184 unwind_on_error = true;
185 }
186
187 show_summary = true;
188 try_all_threads = true;
189 timeout = 0;
190 debug = false;
194 top_level = false;
195 allow_jit = true;
198}
199
200llvm::ArrayRef<OptionDefinition>
202 return llvm::ArrayRef(g_expression_options);
203}
204
207 const Target &target, const OptionGroupValueObjectDisplay &display_opts) {
209 options.SetCoerceToId(display_opts.use_object_desc);
212 options.SetKeepInMemory(true);
213 options.SetUseDynamic(display_opts.use_dynamic);
215 options.SetDebug(debug);
216 options.SetLanguage(language);
217 options.SetExecutionPolicy(
221
223 if (this->auto_apply_fixits == eLazyBoolCalculate)
225 else
226 auto_apply_fixits = this->auto_apply_fixits == eLazyBoolYes;
227
230
231 if (top_level)
233
234 // If there is any chance we are going to stop and want to see what went
235 // wrong with our expression, we should generate debug info
237 options.SetGenerateDebugInfo(true);
238
239 if (timeout > 0)
240 options.SetTimeout(std::chrono::microseconds(timeout));
241 else
242 options.SetTimeout(std::nullopt);
243 return options;
244}
245
247 const OptionGroupValueObjectDisplay &display_opts) const {
248 // Explicitly disabling persistent results takes precedence over the
249 // m_verbosity/use_object_desc logic.
252
253 return display_opts.use_object_desc &&
255}
256
258 CommandInterpreter &interpreter)
259 : CommandObjectRaw(interpreter, "expression",
260 "Evaluate an expression on the current "
261 "thread. Displays any returned value "
262 "with LLDB's default formatting.",
263 "",
264 eCommandProcessMustBePaused | eCommandTryTargetAPILock),
267 m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false,
268 true),
271 R"(
272Single and multi-line expressions:
273
274)"
275 " The expression provided on the command line must be a complete expression \
276with no newlines. To evaluate a multi-line expression, \
277hit a return after an empty expression, and lldb will enter the multi-line expression editor. \
278Hit return on an empty line to end the multi-line expression."
279
280 R"(
281
282Timeouts:
283
284)"
285 " If the expression can be evaluated statically (without running code) then it will be. \
286Otherwise, by default the expression will run on the current thread with a short timeout: \
287currently .25 seconds. If it doesn't return in that time, the evaluation will be interrupted \
288and resumed with all threads running. You can use the -a option to disable retrying on all \
289threads. You can use the -t option to set a shorter timeout."
290 R"(
291
292User defined variables:
293
294)"
295 " You can define your own variables for convenience or to be used in subsequent expressions. \
296You define them the same way you would define variables in C. If the first character of \
297your user defined variable is a $, then the variable's value will be available in future \
298expressions, otherwise it will just be available in the current expression."
299 R"(
300
301Continuing evaluation after a breakpoint:
302
303)"
304 " If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \
305you are done with your investigation, you can either remove the expression execution frames \
306from the stack with \"thread return -x\" or if you are still interested in the expression result \
307you can issue the \"continue\" command and the expression evaluation will complete and the \
308expression result will be available using the \"thread.completed-expression\" key in the thread \
309format."
310
311 R"(
312
313Examples:
315 expr my_struct->a = my_array[3]
316 expr -f bin -- (index * 8) + 5
317 expr unsigned int $foo = 5
318 expr char c[] = \"foo\"; c[0])");
319
321
322 // Add the "--format" and "--gdb-format"
331 m_option_group.Finalize();
332}
333
335
337
343 options.SetAutoApplyFixIts(false);
344 options.SetGenerateDebugInfo(false);
345
347
348 // Get out before we start doing things that expect a valid frame pointer.
349 if (exe_ctx.GetFramePtr() == nullptr)
350 return;
351
352 Target *exe_target = exe_ctx.GetTargetPtr();
353 Target &target = exe_target ? *exe_target : GetDummyTarget();
354
355 unsigned cursor_pos = request.GetRawCursorPos();
356 // Get the full user input including the suffix. The suffix is necessary
357 // as OptionsWithRaw will use it to detect if the cursor is cursor is in the
358 // argument part of in the raw input part of the arguments. If we cut of
359 // of the suffix then "expr -arg[cursor] --" would interpret the "-arg" as
360 // the raw input (as the "--" is hidden in the suffix).
361 llvm::StringRef code = request.GetRawLineWithUnusedSuffix();
362
363 const std::size_t original_code_size = code.size();
364
365 // Remove the first token which is 'expr' or some alias/abbreviation of that.
366 code = llvm::getToken(code).second.ltrim();
367 OptionsWithRaw args(code);
368 code = args.GetRawPart();
369
370 // The position where the expression starts in the command line.
371 assert(original_code_size >= code.size());
372 std::size_t raw_start = original_code_size - code.size();
373
374 // Check if the cursor is actually in the expression string, and if not, we
375 // exit.
376 // FIXME: We should complete the options here.
377 if (cursor_pos < raw_start)
378 return;
379
380 // Make the cursor_pos again relative to the start of the code string.
381 assert(cursor_pos >= raw_start);
382 cursor_pos -= raw_start;
383
384 auto language = exe_ctx.GetFrameRef().GetLanguage();
388 code, llvm::StringRef(), language, UserExpression::eResultTypeAny,
389 options, nullptr, error));
390 if (error.Fail())
391 return;
392
393 expr->Complete(exe_ctx, request, cursor_pos);
394}
395
398 CompilerType type(valobj.GetCompilerType());
399 CompilerType pointee;
400 if (!type.IsPointerType(&pointee))
401 return Status::FromErrorString("as it does not refer to a pointer");
402 if (pointee.IsVoidType())
403 return Status::FromErrorString("as it refers to a pointer to void");
404 return Status();
405}
406
407bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
408 Stream &output_stream,
409 Stream &error_stream,
410 CommandReturnObject &result) {
411 // Don't use m_exe_ctx as this might be called asynchronously after the
412 // command object DoExecute has finished when doing multi-line expression
413 // that use an input reader...
415 Target *exe_target = exe_ctx.GetTargetPtr();
416 Target &target = exe_target ? *exe_target : GetDummyTarget();
417
418 lldb::ValueObjectSP result_valobj_sp;
419 StackFrame *frame = exe_ctx.GetFramePtr();
420
423 "Can't disable JIT compilation for top-level expressions.\n");
424 return false;
425 }
426
427 EvaluateExpressionOptions eval_options =
428 m_command_options.GetEvaluateExpressionOptions(target, m_varobj_options);
429 // This command manually removes the result variable, make sure expression
430 // evaluation doesn't do it first.
431 eval_options.SetSuppressPersistentResult(false);
432
433 ExpressionResults success = target.EvaluateExpression(
434 expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
435
436 // Only mention Fix-Its if the expression evaluator applied them.
437 // Compiler errors refer to the final expression after applying Fix-It(s).
438 if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
439 error_stream << " Evaluated this expression after applying Fix-It(s):\n";
440 error_stream << " " << m_fixed_expression << "\n";
441 }
442
443 if (result_valobj_sp) {
444 result.GetValueObjectList().Append(result_valobj_sp);
445
446 Format format = m_format_options.GetFormat();
447
448 if (result_valobj_sp->GetError().Success()) {
449 if (format != eFormatVoid) {
450 if (format != eFormatDefault)
451 result_valobj_sp->SetFormat(format);
452
453 if (m_varobj_options.elem_count > 0) {
455 if (error.Fail()) {
457 "expression cannot be used with --element-count %s\n",
458 error.AsCString(""));
459 return false;
460 }
461 }
462
463 bool suppress_result =
464 m_command_options.ShouldSuppressResult(m_varobj_options);
465
466 DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
467 m_command_options.m_verbosity, format));
468 options.SetHideRootName(suppress_result);
469 options.SetVariableFormatDisplayLanguage(
470 result_valobj_sp->GetPreferredDisplayLanguage());
471
472 if (llvm::Error error =
473 result_valobj_sp->Dump(output_stream, options)) {
474 result.AppendError(toString(std::move(error)));
475 return false;
476 }
477
478 m_interpreter.PrintWarningsIfNecessary(result.GetOutputStream(),
479 m_cmd_name);
480
481 if (suppress_result)
482 if (auto result_var_sp =
483 target.GetPersistentVariable(result_valobj_sp->GetName())) {
484 auto language = result_valobj_sp->GetPreferredDisplayLanguage();
485 if (auto *persistent_state =
487 persistent_state->RemovePersistentVariable(result_var_sp);
488 }
491 } else {
492 if (result_valobj_sp->GetError().GetError() ==
494 if (format != eFormatVoid && GetDebugger().GetNotifyVoid()) {
495 error_stream.PutCString("(void)\n");
496 }
497
499 } else {
501 result.SetError(result_valobj_sp->GetError().ToError());
502 }
503 }
504 } else {
505 error_stream.Printf("error: unknown error\n");
507
508 return (success != eExpressionSetupError &&
509 success != eExpressionParseError);
510}
511
513 std::string &line) {
514 io_handler.SetIsDone(true);
515 StreamSP output_stream =
517 StreamSP error_stream =
520 CommandReturnObject return_obj(
521 GetCommandInterpreter().GetDebugger().GetUseColor());
522 EvaluateExpression(line.c_str(), *output_stream, *error_stream, return_obj);
523
524 output_stream->Flush();
525 *error_stream << return_obj.GetErrorString();
526}
527
529 StringList &lines) {
530 // An empty lines is used to indicate the end of input
531 const size_t num_lines = lines.GetSize();
532 if (num_lines > 0 && lines[num_lines - 1].empty()) {
533 // Remove the last empty line from "lines" so it doesn't appear in our
534 // resulting input and return true to indicate we are done getting lines
535 lines.PopBack();
536 return true;
537 }
538 return false;
539}
540
542 m_expr_lines.clear();
546 bool color_prompt = debugger.GetUseColor();
547 const bool multiple_lines = true; // Get multiple lines
548 IOHandlerSP io_handler_sp(
550 "lldb-expr", // Name of input reader for history
551 llvm::StringRef(), // No prompt
552 llvm::StringRef(), // Continuation prompt
553 multiple_lines, color_prompt,
554 1, // Show line numbers starting at 1
555 *this));
556
557 if (LockableStreamFileSP output_sp = io_handler_sp->GetOutputStreamFileSP()) {
558 LockedStreamFile locked_stream = output_sp->Lock();
559 locked_stream.PutCString(
560 "Enter expressions, then terminate with an empty line to evaluate:\n");
561 }
562 debugger.RunIOHandlerAsync(io_handler_sp);
563}
564
568 command_options.OptionParsingStarting(&ctx);
569
570 // Default certain settings for REPL regardless of the global settings.
571 command_options.unwind_on_error = false;
572 command_options.ignore_breakpoints = false;
573 command_options.debug = false;
574
575 EvaluateExpressionOptions expr_options;
576 expr_options.SetUnwindOnError(command_options.unwind_on_error);
577 expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
578 expr_options.SetTryAllThreads(command_options.try_all_threads);
579
580 if (command_options.timeout > 0)
581 expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
582 else
583 expr_options.SetTimeout(std::nullopt);
584
585 return expr_options;
586}
587
588void CommandObjectExpression::DoExecute(llvm::StringRef command,
589 CommandReturnObject &result) {
590 m_fixed_expression.clear();
593
594 if (command.empty()) {
596 return;
597 }
598
599 OptionsWithRaw args(command);
600 llvm::StringRef expr = args.GetRawPart();
601
602 if (args.HasArgs()) {
603 if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group, exe_ctx))
604 return;
605
607 Target &target = GetTarget();
608 // Drop into REPL
609 m_expr_lines.clear();
611
612 Debugger &debugger = target.GetDebugger();
613
614 // Check if the LLDB command interpreter is sitting on top of a REPL
615 // that launched it...
618 // the LLDB command interpreter is sitting on top of a REPL that
619 // launched it, so just say the command interpreter is done and
620 // fall back to the existing REPL
621 m_interpreter.GetIOHandler(false)->SetIsDone(true);
622 } else {
623 // We are launching the REPL on top of the current LLDB command
624 // interpreter, so just push one
625 bool initialize = false;
626 Status repl_error;
627 REPLSP repl_sp(target.GetREPL(repl_error, m_command_options.language,
628 nullptr, false));
629
630 if (!repl_sp) {
631 initialize = true;
632 repl_sp = target.GetREPL(repl_error, m_command_options.language,
633 nullptr, true);
634 if (repl_error.Fail()) {
635 result.SetError(std::move(repl_error));
636 return;
637 }
638 }
639
640 if (repl_sp) {
641 if (initialize) {
642 repl_sp->SetEvaluateOptions(
644 repl_sp->SetFormatOptions(m_format_options);
645 repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
646 }
647
648 IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
649 io_handler_sp->SetIsDone(false);
650 debugger.RunIOHandlerAsync(io_handler_sp);
651 } else {
653 "Couldn't create a REPL for %s",
655 result.SetError(std::move(repl_error));
656 return;
657 }
658 }
659 }
660 // No expression following options
661 else if (expr.empty()) {
663 return;
664 }
665 }
666
667 // Previously the indent was set up for diagnosing command line
668 // parsing errors. Now point it to the expression.
669 std::optional<uint16_t> indent;
670 size_t pos = m_original_command.rfind(expr);
671 if (pos != llvm::StringRef::npos)
672 indent = pos;
673 result.SetDiagnosticIndent(indent);
674
675 Target &target = GetTarget();
676 if (EvaluateExpression(expr, result.GetOutputStream(),
677 result.GetErrorStream(), result)) {
678
679 if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
680 CommandHistory &history = m_interpreter.GetCommandHistory();
681 // FIXME: Can we figure out what the user actually typed (e.g. some alias
682 // for expr???)
683 // If we can it would be nice to show that.
684 std::string fixed_command("expression ");
685 if (args.HasArgs()) {
686 // Add in any options that might have been in the original command:
687 fixed_command.append(std::string(args.GetArgStringWithDelimiter()));
688 fixed_command.append(m_fixed_expression);
689 } else
690 fixed_command.append(m_fixed_expression);
691 history.AppendString(fixed_command);
692 }
693 return;
694 }
696}
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:87
lldb::StreamUP GetAsyncErrorStream()
bool GetUseColor() const
Definition Debugger.cpp:484
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:373
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:331
void SetKeepInMemory(bool keep=true)
Definition Target.h:383
void SetCoerceToId(bool coerce=true)
Definition Target.h:369
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:337
void SetCppIgnoreContextQualifiers(bool value)
Definition Target.cpp:5433
void SetTryAllThreads(bool try_others=true)
Definition Target.h:406
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:475
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:394
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:326
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:377
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:388
"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:316
static const char * GetNameForLanguageType(lldb::LanguageType language)
Returns the internal LLDB name for the specified language.
Definition Language.cpp:305
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:70
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:65
bool GetEnableNotifyAboutFixIts() const
Definition Target.cpp:4901
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:4895
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:4889
Debugger & GetDebugger() const
Definition Target.h:1224
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2685
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2917
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:315
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:2705
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:2849
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
@ 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)