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 
9 #include "llvm/ADT/StringRef.h"
10 
12 #include "lldb/Core/Debugger.h"
13 #include "lldb/Expression/REPL.h"
15 #include "lldb/Host/OptionParser.h"
19 #include "lldb/Target/Language.h"
20 #include "lldb/Target/Process.h"
21 #include "lldb/Target/StackFrame.h"
22 #include "lldb/Target/Target.h"
23 
24 using namespace lldb;
25 using namespace lldb_private;
26 
27 CommandObjectExpression::CommandOptions::CommandOptions() : OptionGroup() {}
28 
30 
31 static constexpr OptionEnumValueElement g_description_verbosity_type[] = {
32  {
34  "compact",
35  "Only show the description string",
36  },
37  {
39  "full",
40  "Show the full output, including persistent variable's name and type",
41  },
42 };
43 
44 static constexpr OptionEnumValues DescriptionVerbosityTypes() {
45  return OptionEnumValues(g_description_verbosity_type);
46 }
47 
48 #define LLDB_OPTIONS_expression
49 #include "CommandOptions.inc"
50 
52  uint32_t option_idx, llvm::StringRef option_arg,
53  ExecutionContext *execution_context) {
54  Status error;
55 
56  const int short_option = GetDefinitions()[option_idx].short_option;
57 
58  switch (short_option) {
59  case 'l':
63  "unknown language type: '%s' for expression",
64  option_arg.str().c_str());
65  break;
66 
67  case 'a': {
68  bool success;
69  bool result;
70  result = OptionArgParser::ToBoolean(option_arg, true, &success);
71  if (!success)
73  "invalid all-threads value setting: \"%s\"",
74  option_arg.str().c_str());
75  else
76  try_all_threads = result;
77  } break;
78 
79  case 'i': {
80  bool success;
81  bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
82  if (success)
83  ignore_breakpoints = tmp_value;
84  else
86  "could not convert \"%s\" to a boolean value.",
87  option_arg.str().c_str());
88  break;
89  }
90 
91  case 'j': {
92  bool success;
93  bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
94  if (success)
95  allow_jit = tmp_value;
96  else
98  "could not convert \"%s\" to a boolean value.",
99  option_arg.str().c_str());
100  break;
101  }
102 
103  case 't':
104  if (option_arg.getAsInteger(0, timeout)) {
105  timeout = 0;
106  error.SetErrorStringWithFormat("invalid timeout setting \"%s\"",
107  option_arg.str().c_str());
108  }
109  break;
110 
111  case 'u': {
112  bool success;
113  bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
114  if (success)
115  unwind_on_error = tmp_value;
116  else
118  "could not convert \"%s\" to a boolean value.",
119  option_arg.str().c_str());
120  break;
121  }
122 
123  case 'v':
124  if (option_arg.empty()) {
126  break;
127  }
130  option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
131  if (!error.Success())
133  "unrecognized value for description-verbosity '%s'",
134  option_arg.str().c_str());
135  break;
136 
137  case 'g':
138  debug = true;
139  unwind_on_error = false;
140  ignore_breakpoints = false;
141  break;
142 
143  case 'p':
144  top_level = true;
145  break;
146 
147  case 'X': {
148  bool success;
149  bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
150  if (success)
152  else
154  "could not convert \"%s\" to a boolean value.",
155  option_arg.str().c_str());
156  break;
157  }
158 
159  default:
160  llvm_unreachable("Unimplemented option");
161  }
162 
163  return error;
164 }
165 
167  ExecutionContext *execution_context) {
168  auto process_sp =
169  execution_context ? execution_context->GetProcessSP() : ProcessSP();
170  if (process_sp) {
171  ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions();
172  unwind_on_error = process_sp->GetUnwindOnErrorInExpressions();
173  } else {
174  ignore_breakpoints = true;
175  unwind_on_error = true;
176  }
177 
178  show_summary = true;
179  try_all_threads = true;
180  timeout = 0;
181  debug = false;
185  top_level = false;
186  allow_jit = true;
187 }
188 
189 llvm::ArrayRef<OptionDefinition>
191  return llvm::makeArrayRef(g_expression_options);
192 }
193 
195  CommandInterpreter &interpreter)
196  : CommandObjectRaw(interpreter, "expression",
197  "Evaluate an expression on the current "
198  "thread. Displays any returned value "
199  "with LLDB's default formatting.",
200  "",
201  eCommandProcessMustBePaused | eCommandTryTargetAPILock),
204  m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false,
205  true),
207  SetHelpLong(
208  R"(
209 Single and multi-line expressions:
210 
211 )"
212  " The expression provided on the command line must be a complete expression \
213 with no newlines. To evaluate a multi-line expression, \
214 hit a return after an empty expression, and lldb will enter the multi-line expression editor. \
215 Hit return on an empty line to end the multi-line expression."
216 
217  R"(
218 
219 Timeouts:
220 
221 )"
222  " If the expression can be evaluated statically (without running code) then it will be. \
223 Otherwise, by default the expression will run on the current thread with a short timeout: \
224 currently .25 seconds. If it doesn't return in that time, the evaluation will be interrupted \
225 and resumed with all threads running. You can use the -a option to disable retrying on all \
226 threads. You can use the -t option to set a shorter timeout."
227  R"(
228 
229 User defined variables:
230 
231 )"
232  " You can define your own variables for convenience or to be used in subsequent expressions. \
233 You define them the same way you would define variables in C. If the first character of \
234 your user defined variable is a $, then the variable's value will be available in future \
235 expressions, otherwise it will just be available in the current expression."
236  R"(
237 
238 Continuing evaluation after a breakpoint:
239 
240 )"
241  " If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \
242 you are done with your investigation, you can either remove the expression execution frames \
243 from the stack with \"thread return -x\" or if you are still interested in the expression result \
244 you can issue the \"continue\" command and the expression evaluation will complete and the \
245 expression result will be available using the \"thread.completed-expression\" key in the thread \
246 format."
247 
248  R"(
249 
250 Examples:
251 
252  expr my_struct->a = my_array[3]
253  expr -f bin -- (index * 8) + 5
254  expr unsigned int $foo = 5
255  expr char c[] = \"foo\"; c[0])");
256 
258  CommandArgumentData expression_arg;
259 
260  // Define the first (and only) variant of this arg.
261  expression_arg.arg_type = eArgTypeExpression;
262  expression_arg.arg_repetition = eArgRepeatPlain;
263 
264  // There is only one variant this argument could be; put it into the argument
265  // entry.
266  arg.push_back(expression_arg);
267 
268  // Push the data for the first argument into the m_arguments vector.
269  m_arguments.push_back(arg);
270 
271  // Add the "--format" and "--gdb-format"
281 }
282 
284 
286 
292  options.SetAutoApplyFixIts(false);
293  options.SetGenerateDebugInfo(false);
294 
295  // We need a valid execution context with a frame pointer for this
296  // completion, so if we don't have one we should try to make a valid
297  // execution context.
298  if (m_interpreter.GetExecutionContext().GetFramePtr() == nullptr)
300 
301  // This didn't work, so let's get out before we start doing things that
302  // expect a valid frame pointer.
303  if (m_interpreter.GetExecutionContext().GetFramePtr() == nullptr)
304  return;
305 
307 
308  Target *target = exe_ctx.GetTargetPtr();
309 
310  if (!target)
311  target = &GetDummyTarget();
312 
313  unsigned cursor_pos = request.GetRawCursorPos();
314  // Get the full user input including the suffix. The suffix is necessary
315  // as OptionsWithRaw will use it to detect if the cursor is cursor is in the
316  // argument part of in the raw input part of the arguments. If we cut of
317  // of the suffix then "expr -arg[cursor] --" would interpret the "-arg" as
318  // the raw input (as the "--" is hidden in the suffix).
319  llvm::StringRef code = request.GetRawLineWithUnusedSuffix();
320 
321  const std::size_t original_code_size = code.size();
322 
323  // Remove the first token which is 'expr' or some alias/abbreviation of that.
324  code = llvm::getToken(code).second.ltrim();
325  OptionsWithRaw args(code);
326  code = args.GetRawPart();
327 
328  // The position where the expression starts in the command line.
329  assert(original_code_size >= code.size());
330  std::size_t raw_start = original_code_size - code.size();
331 
332  // Check if the cursor is actually in the expression string, and if not, we
333  // exit.
334  // FIXME: We should complete the options here.
335  if (cursor_pos < raw_start)
336  return;
337 
338  // Make the cursor_pos again relative to the start of the code string.
339  assert(cursor_pos >= raw_start);
340  cursor_pos -= raw_start;
341 
342  auto language = exe_ctx.GetFrameRef().GetLanguage();
343 
344  Status error;
345  lldb::UserExpressionSP expr(target->GetUserExpressionForLanguage(
346  code, llvm::StringRef(), language, UserExpression::eResultTypeAny,
347  options, nullptr, error));
348  if (error.Fail())
349  return;
350 
351  expr->Complete(exe_ctx, request, cursor_pos);
352 }
353 
356  CompilerType type(valobj.GetCompilerType());
357  CompilerType pointee;
358  if (!type.IsPointerType(&pointee))
359  return Status("as it does not refer to a pointer");
360  if (pointee.IsVoidType())
361  return Status("as it refers to a pointer to void");
362  return Status();
363 }
364 
371  options.SetKeepInMemory(true);
376  options.SetExecutionPolicy(
380 
381  bool auto_apply_fixits;
383  auto_apply_fixits = target.GetEnableAutoApplyFixIts();
384  else
385  auto_apply_fixits = m_command_options.auto_apply_fixits == eLazyBoolYes;
386 
387  options.SetAutoApplyFixIts(auto_apply_fixits);
389 
392 
393  // If there is any chance we are going to stop and want to see what went
394  // wrong with our expression, we should generate debug info
397  options.SetGenerateDebugInfo(true);
398 
399  if (m_command_options.timeout > 0)
400  options.SetTimeout(std::chrono::microseconds(m_command_options.timeout));
401  else
402  options.SetTimeout(llvm::None);
403  return options;
404 }
405 
407  Stream &output_stream,
408  Stream &error_stream,
409  CommandReturnObject &result) {
410  // Don't use m_exe_ctx as this might be called asynchronously after the
411  // command object DoExecute has finished when doing multi-line expression
412  // that use an input reader...
414 
415  Target *target = exe_ctx.GetTargetPtr();
416 
417  if (!target)
418  target = &GetDummyTarget();
419 
420  lldb::ValueObjectSP result_valobj_sp;
421  StackFrame *frame = exe_ctx.GetFramePtr();
422 
423  const EvaluateExpressionOptions options = GetEvalOptions(*target);
424  ExpressionResults success = target->EvaluateExpression(
425  expr, frame, result_valobj_sp, options, &m_fixed_expression);
426 
427  // We only tell you about the FixIt if we applied it. The compiler errors
428  // will suggest the FixIt if it parsed.
429  if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) {
430  if (success == eExpressionCompleted)
431  error_stream.Printf(" Fix-it applied, fixed expression was: \n %s\n",
432  m_fixed_expression.c_str());
433  }
434 
435  if (result_valobj_sp) {
436  Format format = m_format_options.GetFormat();
437 
438  if (result_valobj_sp->GetError().Success()) {
439  if (format != eFormatVoid) {
440  if (format != eFormatDefault)
441  result_valobj_sp->SetFormat(format);
442 
443  if (m_varobj_options.elem_count > 0) {
444  Status error(CanBeUsedForElementCountPrinting(*result_valobj_sp));
445  if (error.Fail()) {
446  result.AppendErrorWithFormat(
447  "expression cannot be used with --element-count %s\n",
448  error.AsCString(""));
450  return false;
451  }
452  }
453 
455  m_command_options.m_verbosity, format));
456  options.SetVariableFormatDisplayLanguage(
457  result_valobj_sp->GetPreferredDisplayLanguage());
458 
459  result_valobj_sp->Dump(output_stream, options);
460 
462  }
463  } else {
464  if (result_valobj_sp->GetError().GetError() ==
466  if (format != eFormatVoid && GetDebugger().GetNotifyVoid()) {
467  error_stream.PutCString("(void)\n");
468  }
469 
471  } else {
472  const char *error_cstr = result_valobj_sp->GetError().AsCString();
473  if (error_cstr && error_cstr[0]) {
474  const size_t error_cstr_len = strlen(error_cstr);
475  const bool ends_with_newline = error_cstr[error_cstr_len - 1] == '\n';
476  if (strstr(error_cstr, "error:") != error_cstr)
477  error_stream.PutCString("error: ");
478  error_stream.Write(error_cstr, error_cstr_len);
479  if (!ends_with_newline)
480  error_stream.EOL();
481  } else {
482  error_stream.PutCString("error: unknown error\n");
483  }
484 
486  }
487  }
488  }
489 
490  return (success != eExpressionSetupError &&
491  success != eExpressionParseError);
492 }
493 
495  std::string &line) {
496  io_handler.SetIsDone(true);
497  // StreamSP output_stream =
498  // io_handler.GetDebugger().GetAsyncOutputStream();
499  // StreamSP error_stream = io_handler.GetDebugger().GetAsyncErrorStream();
500  StreamFileSP output_sp = io_handler.GetOutputStreamFileSP();
501  StreamFileSP error_sp = io_handler.GetErrorStreamFileSP();
502 
503  CommandReturnObject return_obj(
504  GetCommandInterpreter().GetDebugger().GetUseColor());
505  EvaluateExpression(line.c_str(), *output_sp, *error_sp, return_obj);
506  if (output_sp)
507  output_sp->Flush();
508  if (error_sp)
509  error_sp->Flush();
510 }
511 
513  StringList &lines) {
514  // An empty lines is used to indicate the end of input
515  const size_t num_lines = lines.GetSize();
516  if (num_lines > 0 && lines[num_lines - 1].empty()) {
517  // Remove the last empty line from "lines" so it doesn't appear in our
518  // resulting input and return true to indicate we are done getting lines
519  lines.PopBack();
520  return true;
521  }
522  return false;
523 }
524 
526  m_expr_lines.clear();
527  m_expr_line_count = 0;
528 
530  bool color_prompt = debugger.GetUseColor();
531  const bool multiple_lines = true; // Get multiple lines
532  IOHandlerSP io_handler_sp(
534  "lldb-expr", // Name of input reader for history
535  llvm::StringRef(), // No prompt
536  llvm::StringRef(), // Continuation prompt
537  multiple_lines, color_prompt,
538  1, // Show line numbers starting at 1
539  *this, nullptr));
540 
541  StreamFileSP output_sp = io_handler_sp->GetOutputStreamFileSP();
542  if (output_sp) {
543  output_sp->PutCString(
544  "Enter expressions, then terminate with an empty line to evaluate:\n");
545  output_sp->Flush();
546  }
547  debugger.RunIOHandlerAsync(io_handler_sp);
548 }
549 
552  CommandObjectExpression::CommandOptions command_options) {
553  command_options.OptionParsingStarting(&ctx);
554 
555  // Default certain settings for REPL regardless of the global settings.
556  command_options.unwind_on_error = false;
557  command_options.ignore_breakpoints = false;
558  command_options.debug = false;
559 
560  EvaluateExpressionOptions expr_options;
561  expr_options.SetUnwindOnError(command_options.unwind_on_error);
562  expr_options.SetIgnoreBreakpoints(command_options.ignore_breakpoints);
563  expr_options.SetTryAllThreads(command_options.try_all_threads);
564 
565  if (command_options.timeout > 0)
566  expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
567  else
568  expr_options.SetTimeout(llvm::None);
569 
570  return expr_options;
571 }
572 
573 bool CommandObjectExpression::DoExecute(llvm::StringRef command,
574  CommandReturnObject &result) {
575  m_fixed_expression.clear();
576  auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
578 
579  if (command.empty()) {
581  return result.Succeeded();
582  }
583 
584  OptionsWithRaw args(command);
585  llvm::StringRef expr = args.GetRawPart();
586 
587  if (args.HasArgs()) {
588  if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group, exe_ctx))
589  return false;
590 
592  Target &target = GetSelectedOrDummyTarget();
593  // Drop into REPL
594  m_expr_lines.clear();
595  m_expr_line_count = 0;
596 
597  Debugger &debugger = target.GetDebugger();
598 
599  // Check if the LLDB command interpreter is sitting on top of a REPL
600  // that launched it...
603  // the LLDB command interpreter is sitting on top of a REPL that
604  // launched it, so just say the command interpreter is done and
605  // fall back to the existing REPL
606  m_interpreter.GetIOHandler(false)->SetIsDone(true);
607  } else {
608  // We are launching the REPL on top of the current LLDB command
609  // interpreter, so just push one
610  bool initialize = false;
611  Status repl_error;
612  REPLSP repl_sp(target.GetREPL(repl_error, m_command_options.language,
613  nullptr, false));
614 
615  if (!repl_sp) {
616  initialize = true;
617  repl_sp = target.GetREPL(repl_error, m_command_options.language,
618  nullptr, true);
619  if (!repl_error.Success()) {
620  result.SetError(repl_error);
621  return result.Succeeded();
622  }
623  }
624 
625  if (repl_sp) {
626  if (initialize) {
627  repl_sp->SetEvaluateOptions(
629  repl_sp->SetFormatOptions(m_format_options);
630  repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
631  }
632 
633  IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
634  io_handler_sp->SetIsDone(false);
635  debugger.RunIOHandlerAsync(io_handler_sp);
636  } else {
637  repl_error.SetErrorStringWithFormat(
638  "Couldn't create a REPL for %s",
640  result.SetError(repl_error);
641  return result.Succeeded();
642  }
643  }
644  }
645  // No expression following options
646  else if (expr.empty()) {
648  return result.Succeeded();
649  }
650  }
651 
652  Target &target = GetSelectedOrDummyTarget();
653  if (EvaluateExpression(expr, result.GetOutputStream(),
654  result.GetErrorStream(), result)) {
655 
656  if (!m_fixed_expression.empty() && target.GetEnableNotifyAboutFixIts()) {
658  // FIXME: Can we figure out what the user actually typed (e.g. some alias
659  // for expr???)
660  // If we can it would be nice to show that.
661  std::string fixed_command("expression ");
662  if (args.HasArgs()) {
663  // Add in any options that might have been in the original command:
664  fixed_command.append(std::string(args.GetArgStringWithDelimiter()));
665  fixed_command.append(m_fixed_expression);
666  } else
667  fixed_command.append(m_fixed_expression);
668  history.AppendString(fixed_command);
669  }
670  // Increment statistics to record this expression evaluation success.
672  return true;
673  }
674 
675  // Increment statistics to record this expression evaluation failure.
678  return false;
679 }
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:289
A class to manage flag bits.
Definition: Debugger.h:70
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
Definition: Debugger.cpp:914
std::vector< CommandArgumentData > CommandArgumentEntry
void SetExecutionPolicy(ExecutionPolicy policy=eExecutionPolicyAlways)
Definition: Target.h:260
CommandObjectExpression(CommandInterpreter &interpreter)
CompilerType GetCompilerType()
A class that represents a running process on the host machine.
CommandInterpreter & m_interpreter
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
lldb::StreamFileSP & GetErrorStreamFileSP()
Definition: IOHandler.cpp:109
bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines) override
Called to determine whether typing enter after the last line in lines should end input.
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
OptionGroupValueObjectDisplay m_varobj_options
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void SetUseDynamic(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
Definition: Target.h:300
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:285
int history(History *, HistEvent *, int,...)
bool GetNotifyVoid() const
Definition: Debugger.cpp:261
Encapsulates a single expression for use in lldb.
Definition: Expression.h:33
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool ParseOptionsAndNotify(Args &args, CommandReturnObject &result, OptionGroupOptions &group_options, ExecutionContext &exe_ctx)
bool HasArgs() const
Returns true if there are any arguments before the raw suffix.
Definition: Args.h:326
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition: Stream.h:101
void IOHandlerInputComplete(IOHandler &io_handler, std::string &line) override
Called when a line or lines have been retrieved.
A delegate class for use with IOHandler subclasses.
Definition: IOHandler.h:193
DumpValueObjectOptions GetAsDumpOptions(LanguageRuntimeDescriptionDisplayVerbosity lang_descr_verbosity=eLanguageRuntimeDescriptionDisplayVerbosityFull, lldb::Format format=lldb::eFormatDefault, lldb::TypeSummaryImplSP summary_sp=lldb::TypeSummaryImplSP())
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Format
Display format definitions.
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
llvm::StringRef GetArgStringWithDelimiter() const
Returns the part of the input string that was used for parsing the argument list. ...
Definition: Args.h:349
bool EvaluateExpression(llvm::StringRef expr, Stream &output_stream, Stream &error_stream, CommandReturnObject &result)
Evaluates the given expression.
void SetRetriesWithFixIts(uint64_t number_of_retries)
Definition: Target.h:385
#define LLDB_OPT_SET_3
Definition: lldb-defines.h:113
llvm::StringRef GetRawLineWithUnusedSuffix() const
Returns the full raw user input used to create this CompletionRequest.
"lldb/Utility/ArgCompletionRequest.h"
void IncrementStats(lldb_private::StatisticKind key)
Definition: Target.h:1342
void SetKeepInMemory(bool keep=true)
Definition: Target.h:295
uint64_t GetNumberOfRetriesWithFixits() const
Definition: Target.cpp:3717
virtual void SetHelpLong(llvm::StringRef str)
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:306
static llvm::raw_ostream & error(Stream &strm)
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:128
lldb::StreamFileSP & GetOutputStreamFileSP()
Definition: IOHandler.cpp:107
lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create)
Definition: Target.cpp:208
static const uint32_t OPTION_GROUP_FORMAT
void UpdateExecutionContext(ExecutionContext *override_context)
void SetError(const Status &error, const char *fallback_error_cstr=nullptr)
lldb::IOHandlerSP GetIOHandler(bool force_create=false, CommandInterpreterRunOptions *options=nullptr)
const std::string & GetRawPart() const
Returns the raw suffix part of the parsed string.
Definition: Args.h:364
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
Do not print this.
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)
static constexpr ExecutionPolicy default_execution_policy
Definition: Target.h:253
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
static constexpr OptionEnumValueElement g_description_verbosity_type[]
bool Success() const
Test for success condition.
Definition: Status.cpp:288
static const Status::ValueType kNoResult
ValueObject::GetError() returns this if there is no result from the expression.
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
static EvaluateExpressionOptions GetExprOptions(ExecutionContext &ctx, CommandObjectExpression::CommandOptions command_options)
Target & GetSelectedOrDummyTarget(bool prefer_dummy=false)
size_t GetSize() const
Definition: StringList.cpp:68
ExpressionResults
The results of expression evaluation.
void SetLanguage(lldb::LanguageType language)
Definition: Target.h:266
#define LLDB_OPT_SET_2
Definition: lldb-defines.h:112
A command line option parsing protocol class.
Definition: Options.h:62
void SetCoerceToId(bool coerce=true)
Definition: Target.h:281
void AppendString(llvm::StringRef str, bool reject_if_dupe=true)
CommandInterpreter & GetCommandInterpreter()
static constexpr OptionEnumValues DescriptionVerbosityTypes()
bool GetUseColor() const
Definition: Debugger.cpp:336
Unknown or invalid language value.
bool Fail() const
Test for error condition.
Definition: Status.cpp:182
void HandleCompletion(CompletionRequest &request) override
This default version handles calling option argument completions and then calls HandleArgumentComplet...
Definition: SBAddress.h:15
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:318
void OptionParsingStarting(ExecutionContext *execution_context) override
Represents a generic type in a programming language.
Definition: CompilerType.h:33
virtual void SetIsDone(bool b)
Definition: IOHandler.h:88
bool GetEnableAutoApplyFixIts() const
Definition: Target.cpp:3711
#define LLDB_OPT_SET_ALL
Definition: lldb-defines.h:110
OptionValueBoolean & GetOptionValue()
bool GetEnableNotifyAboutFixIts() const
Definition: Target.cpp:3723
Args & GetArgs()
Returns the list of arguments.
Definition: Args.h:331
static const uint32_t OPTION_GROUP_GDB_FMT
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
Definition: Status.cpp:256
void RunIOHandlerAsync(const lldb::IOHandlerSP &reader_sp, bool cancel_top_handler=true)
Run the given IO handler and return immediately.
Definition: Debugger.cpp:941
void Append(OptionGroup *group)
Append options from a OptionGroup class.
Definition: Options.cpp:813
#define LLDB_OPT_SET_1
Definition: lldb-defines.h:111
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:131
EvaluateExpressionOptions GetEvalOptions(const Target &target)
Return the appropriate expression options used for evaluating the expression in the given target...
A pair of an option list with a &#39;raw&#39; string as a suffix.
Definition: Args.h:315
static const char * GetNameForLanguageType(lldb::LanguageType language)
Definition: Language.cpp:206
void SetStatus(lldb::ReturnStatus status)
This base class provides an interface to stack frames.
Definition: StackFrame.h:40
Debugger & GetDebugger()
Definition: Target.h:975
void NotifyOptionParsingStarting(ExecutionContext *execution_context)
Definition: Options.cpp:32
static lldb_private::Status CanBeUsedForElementCountPrinting(ValueObject &valobj)
An error handling class.
Definition: Status.h:44
std::vector< CommandArgumentEntry > m_arguments