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