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 |
265 eCommandAllowsDummyTarget),
268 m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false,
269 true),
272 R"(
273Single and multi-line expressions:
274
275)"
276 " The expression provided on the command line must be a complete expression \
277with no newlines. To evaluate a multi-line expression, \
278hit a return after an empty expression, and lldb will enter the multi-line expression editor. \
279Hit return on an empty line to end the multi-line expression."
280
281 R"(
282
283Timeouts:
284
285)"
286 " If the expression can be evaluated statically (without running code) then it will be. \
287Otherwise, by default the expression will run on the current thread with a short timeout: \
288currently .25 seconds. If it doesn't return in that time, the evaluation will be interrupted \
289and resumed with all threads running. You can use the -a option to disable retrying on all \
290threads. You can use the -t option to set a shorter timeout."
291 R"(
292
293User defined variables:
294
295)"
296 " You can define your own variables for convenience or to be used in subsequent expressions. \
297You define them the same way you would define variables in C. If the first character of \
298your user defined variable is a $, then the variable's value will be available in future \
299expressions, otherwise it will just be available in the current expression."
300 R"(
301
302Continuing evaluation after a breakpoint:
303
304)"
305 " If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \
306you are done with your investigation, you can either remove the expression execution frames \
307from the stack with \"thread return -x\" or if you are still interested in the expression result \
308you can issue the \"continue\" command and the expression evaluation will complete and the \
309expression result will be available using the \"thread.completed-expression\" key in the thread \
310format."
311
312 R"(
313
314Examples:
316 expr my_struct->a = my_array[3]
317 expr -f bin -- (index * 8) + 5
318 expr unsigned int $foo = 5
319 expr char c[] = \"foo\"; c[0])");
320
322
323 // Add the "--format" and "--gdb-format"
332 m_option_group.Finalize();
333}
334
336
338
344 options.SetAutoApplyFixIts(false);
345 options.SetGenerateDebugInfo(false);
346
348
349 // Get out before we start doing things that expect a valid frame pointer.
350 if (exe_ctx.GetFramePtr() == nullptr)
351 return;
352
353 Target *exe_target = exe_ctx.GetTargetPtr();
354 Target &target = exe_target ? *exe_target : GetDummyTarget();
355
356 unsigned cursor_pos = request.GetRawCursorPos();
357 // Get the full user input including the suffix. The suffix is necessary
358 // as OptionsWithRaw will use it to detect if the cursor is cursor is in the
359 // argument part of in the raw input part of the arguments. If we cut of
360 // of the suffix then "expr -arg[cursor] --" would interpret the "-arg" as
361 // the raw input (as the "--" is hidden in the suffix).
362 llvm::StringRef code = request.GetRawLineWithUnusedSuffix();
363
364 const std::size_t original_code_size = code.size();
365
366 // Remove the first token which is 'expr' or some alias/abbreviation of that.
367 code = llvm::getToken(code).second.ltrim();
368 OptionsWithRaw args(code);
369 code = args.GetRawPart();
370
371 // The position where the expression starts in the command line.
372 assert(original_code_size >= code.size());
373 std::size_t raw_start = original_code_size - code.size();
374
375 // Check if the cursor is actually in the expression string, and if not, we
376 // exit.
377 // FIXME: We should complete the options here.
378 if (cursor_pos < raw_start)
379 return;
380
381 // Make the cursor_pos again relative to the start of the code string.
382 assert(cursor_pos >= raw_start);
383 cursor_pos -= raw_start;
384
385 auto language = exe_ctx.GetFrameRef().GetLanguage();
389 code, llvm::StringRef(), language, UserExpression::eResultTypeAny,
390 options, nullptr, error));
391 if (error.Fail())
392 return;
393
394 expr->Complete(exe_ctx, request, cursor_pos);
395}
396
399 CompilerType type(valobj.GetCompilerType());
400 CompilerType pointee;
401 if (!type.IsPointerType(&pointee))
402 return Status::FromErrorString("as it does not refer to a pointer");
403 if (pointee.IsVoidType())
404 return Status::FromErrorString("as it refers to a pointer to void");
405 return Status();
406}
407
408bool CommandObjectExpression::EvaluateExpression(llvm::StringRef expr,
409 Stream &output_stream,
410 Stream &error_stream,
411 CommandReturnObject &result) {
412 // Don't use m_exe_ctx as this might be called asynchronously after the
413 // command object DoExecute has finished when doing multi-line expression
414 // that use an input reader...
416 Target *exe_target = exe_ctx.GetTargetPtr();
417 Target &target = exe_target ? *exe_target : GetDummyTarget();
418
419 lldb::ValueObjectSP result_valobj_sp;
420 StackFrame *frame = exe_ctx.GetFramePtr();
421
424 "Can't disable JIT compilation for top-level expressions");
425 return false;
426 }
427
428 EvaluateExpressionOptions eval_options =
429 m_command_options.GetEvaluateExpressionOptions(target, m_varobj_options);
430 // This command manually removes the result variable, make sure expression
431 // evaluation doesn't do it first.
432 eval_options.SetSuppressPersistentResult(false);
433
434 ExpressionResults success = target.EvaluateExpression(
435 expr, frame, result_valobj_sp, eval_options, &m_fixed_expression);
436
437 // Only mention Fix-Its if the expression evaluator applied them.
438 // Compiler errors refer to the final expression after applying Fix-It(s).
439 if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
440 error_stream << " Evaluated this expression after applying Fix-It(s):\n";
441 error_stream << " " << m_fixed_expression << "\n";
442 }
443
444 if (result_valobj_sp) {
445 result.GetValueObjectList().Append(result_valobj_sp);
446
447 Format format = m_format_options.GetFormat();
448
449 if (result_valobj_sp->GetError().Success()) {
450 if (format != eFormatVoid) {
451 if (format != eFormatDefault)
452 result_valobj_sp->SetFormat(format);
453
454 if (m_varobj_options.elem_count > 0) {
456 if (error.Fail()) {
458 "expression cannot be used with --element-count %s",
459 error.AsCString(""));
460 return false;
461 }
462 }
463
464 bool suppress_result =
465 m_command_options.ShouldSuppressResult(m_varobj_options);
466
467 DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
468 m_command_options.m_verbosity, format));
469 options.SetHideRootName(suppress_result);
470 options.SetVariableFormatDisplayLanguage(
471 result_valobj_sp->GetPreferredDisplayLanguage());
472
473 if (llvm::Error error =
474 result_valobj_sp->Dump(output_stream, options)) {
475 result.AppendError(toString(std::move(error)));
476 return false;
477 }
478
479 m_interpreter.PrintWarningsIfNecessary(result.GetOutputStream(),
480 m_cmd_name);
481
482 if (suppress_result)
483 if (auto result_var_sp =
484 target.GetPersistentVariable(result_valobj_sp->GetName())) {
485 auto language = result_valobj_sp->GetPreferredDisplayLanguage();
486 if (auto *persistent_state =
488 persistent_state->RemovePersistentVariable(result_var_sp);
489 }
492 } else {
493 if (result_valobj_sp->GetError().GetError() ==
495 if (format != eFormatVoid && GetDebugger().GetNotifyVoid()) {
496 error_stream.PutCString("(void)\n");
497 }
498
500 } else {
502 result.SetError(result_valobj_sp->GetError().ToError());
503 }
504 }
505 } else {
506 error_stream.Printf("error: unknown error\n");
508
509 return (success != eExpressionSetupError &&
510 success != eExpressionParseError);
511}
512
514 std::string &line) {
515 io_handler.SetIsDone(true);
516 StreamSP output_stream =
518 StreamSP error_stream =
521 CommandReturnObject return_obj(
522 GetCommandInterpreter().GetDebugger().GetUseColor());
523 EvaluateExpression(line.c_str(), *output_stream, *error_stream, return_obj);
524
525 output_stream->Flush();
526 *error_stream << return_obj.GetErrorString();
527}
528
530 StringList &lines) {
531 // An empty lines is used to indicate the end of input
532 const size_t num_lines = lines.GetSize();
533 if (num_lines > 0 && lines[num_lines - 1].empty()) {
534 // Remove the last empty line from "lines" so it doesn't appear in our
535 // resulting input and return true to indicate we are done getting lines
536 lines.PopBack();
537 return true;
538 }
539 return false;
540}
541
543 m_expr_lines.clear();
547 bool color_prompt = debugger.GetUseColor();
548 const bool multiple_lines = true; // Get multiple lines
549 IOHandlerSP io_handler_sp(
551 "lldb-expr", // Name of input reader for history
552 llvm::StringRef(), // No prompt
553 llvm::StringRef(), // Continuation prompt
554 multiple_lines, color_prompt,
555 1, // Show line numbers starting at 1
556 *this));
557
558 if (LockableStreamFileSP output_sp = io_handler_sp->GetOutputStreamFileSP()) {
559 LockedStreamFile locked_stream = output_sp->Lock();
560 locked_stream.PutCString(
561 "Enter expressions, then terminate with an empty line to evaluate:\n");
562 }
563 debugger.RunIOHandlerAsync(io_handler_sp);
564}
565
569 command_options.OptionParsingStarting(&ctx);
570
571 // Default certain settings for REPL regardless of the global settings.
572 command_options.unwind_on_error = false;
573 command_options.ignore_breakpoints = false;
574 command_options.debug = false;
575
576 EvaluateExpressionOptions expr_options;
577 expr_options.SetUnwindOnError(command_options.unwind_on_error);
578 expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
579 expr_options.SetTryAllThreads(command_options.try_all_threads);
580
581 if (command_options.timeout > 0)
582 expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
583 else
584 expr_options.SetTimeout(std::nullopt);
585
586 return expr_options;
587}
588
589void CommandObjectExpression::DoExecute(llvm::StringRef command,
590 CommandReturnObject &result) {
591 m_fixed_expression.clear();
594
595 if (command.empty()) {
597 // Still gathering input; the IOHandler will set the final status.
599 return;
600 }
601
602 OptionsWithRaw args(command);
603 llvm::StringRef expr = args.GetRawPart();
604
605 if (args.HasArgs()) {
606 if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group, exe_ctx))
607 return;
608
610 Target *target = GetTarget();
611 assert(target && "target guaranteed by eCommandAllowsDummyTarget");
612 // Drop into REPL
613 m_expr_lines.clear();
615
616 Debugger &debugger = target->GetDebugger();
617
618 // Check if the LLDB command interpreter is sitting on top of a REPL
619 // that launched it...
622 // the LLDB command interpreter is sitting on top of a REPL that
623 // launched it, so just say the command interpreter is done and
624 // fall back to the existing REPL
625 m_interpreter.GetIOHandler(false)->SetIsDone(true);
626 } else {
627 // We are launching the REPL on top of the current LLDB command
628 // interpreter, so just push one
629 bool initialize = false;
630 Status repl_error;
631 REPLSP repl_sp(target->GetREPL(repl_error, m_command_options.language,
632 nullptr, false));
633
634 if (!repl_sp) {
635 initialize = true;
636 repl_sp = target->GetREPL(repl_error, m_command_options.language,
637 nullptr, true);
638 if (repl_error.Fail()) {
639 result.SetError(std::move(repl_error));
640 return;
641 }
642 }
643
644 if (repl_sp) {
645 if (initialize) {
646 repl_sp->SetEvaluateOptions(
648 repl_sp->SetFormatOptions(m_format_options);
649 repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
650 }
651
652 IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
653 io_handler_sp->SetIsDone(false);
654 debugger.RunIOHandlerAsync(io_handler_sp);
655 } else {
657 "Couldn't create a REPL for %s",
659 result.SetError(std::move(repl_error));
660 return;
661 }
662 }
663 }
664 // No expression following options
665 else if (expr.empty()) {
667 // Still gathering input; the IOHandler will set the final status.
669 return;
670 }
671 }
672
673 // Previously the indent was set up for diagnosing command line
674 // parsing errors. Now point it to the expression.
675 std::optional<uint16_t> indent;
676 size_t pos = m_original_command.rfind(expr);
677 if (pos != llvm::StringRef::npos)
678 indent = pos;
679 result.SetDiagnosticIndent(indent);
680
681 Target *target = GetTarget();
682 assert(target && "target guaranteed by eCommandAllowsDummyTarget");
683 if (EvaluateExpression(expr, result.GetOutputStream(),
684 result.GetErrorStream(), result)) {
685
686 if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) {
687 CommandHistory &history = m_interpreter.GetCommandHistory();
688 // FIXME: Can we figure out what the user actually typed (e.g. some alias
689 // for expr???)
690 // If we can it would be nice to show that.
691 std::string fixed_command("expression ");
692 if (args.HasArgs()) {
693 // Add in any options that might have been in the original command:
694 fixed_command.append(std::string(args.GetArgStringWithDelimiter()));
695 fixed_command.append(m_fixed_expression);
696 } else
697 fixed_command.append(m_fixed_expression);
698 history.AppendString(fixed_command);
699 }
700 return;
701 }
703}
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(bool adopt_dummy_target=true) const
Returns the execution context the interpreter should run a command in.
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
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:100
lldb::StreamUP GetAsyncErrorStream()
bool GetUseColor() const
Definition Debugger.cpp:525
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:396
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition Target.h:354
void SetKeepInMemory(bool keep=true)
Definition Target.h:406
void SetCoerceToId(bool coerce=true)
Definition Target.h:392
void SetLanguage(lldb::LanguageType language_type)
Definition Target.h:360
void SetCppIgnoreContextQualifiers(bool value)
Definition Target.cpp:6090
void SetTryAllThreads(bool try_others=true)
Definition Target.h:429
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition Target.h:502
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:417
static constexpr ExecutionPolicy default_execution_policy
Definition Target.h:349
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:400
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition Target.h:411
"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:73
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:5486
uint64_t GetNumberOfRetriesWithFixits() const
Definition Target.cpp:5480
bool GetEnableAutoApplyFixIts() const
Definition Target.cpp:5474
Debugger & GetDebugger() const
Definition Target.h:1324
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
Definition Target.cpp:2743
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition Target.cpp:2985
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition Target.cpp:330
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:2763
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:2907
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)