LLDB  mainline
ScriptInterpreter.h
Go to the documentation of this file.
1 //===-- ScriptInterpreter.h -------------------------------------*- C++ -*-===//
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 #ifndef LLDB_INTERPRETER_SCRIPTINTERPRETER_H
10 #define LLDB_INTERPRETER_SCRIPTINTERPRETER_H
11 
12 #include "lldb/API/SBData.h"
13 #include "lldb/API/SBError.h"
18 #include "lldb/Core/SearchFilter.h"
19 #include "lldb/Core/StreamFile.h"
23 #include "lldb/Utility/Status.h"
25 #include "lldb/lldb-private.h"
26 
27 namespace lldb_private {
28 
30 public:
31  ScriptInterpreterLocker() = default;
32 
33  virtual ~ScriptInterpreterLocker() = default;
34 
35 private:
38  operator=(const ScriptInterpreterLocker &) = delete;
39 };
40 
42 public:
43  ExecuteScriptOptions() = default;
44 
45  bool GetEnableIO() const { return m_enable_io; }
46 
47  bool GetSetLLDBGlobals() const { return m_set_lldb_globals; }
48 
49  // If this is true then any exceptions raised by the script will be
50  // cleared with PyErr_Clear(). If false then they will be left for
51  // the caller to clean up
52  bool GetMaskoutErrors() const { return m_maskout_errors; }
53 
55  m_enable_io = enable;
56  return *this;
57  }
58 
61  return *this;
62  }
63 
65  m_maskout_errors = maskout;
66  return *this;
67  }
68 
69 private:
70  bool m_enable_io = true;
71  bool m_set_lldb_globals = true;
72  bool m_maskout_errors = true;
73 };
74 
76 public:
77  LoadScriptOptions() = default;
78 
79  bool GetInitSession() const { return m_init_session; }
80  bool GetSilent() const { return m_silent; }
81 
83  m_init_session = b;
84  return *this;
85  }
86 
88  m_silent = b;
89  return *this;
90  }
91 
92 private:
93  bool m_init_session = false;
94  bool m_silent = false;
95 };
96 
98 public:
99  /// Create an IO redirect. If IO is enabled, this will redirects the output
100  /// to the command return object if set or to the debugger otherwise. If IO
101  /// is disabled, it will redirect all IO to /dev/null.
102  static llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
103  Create(bool enable_io, Debugger &debugger, CommandReturnObject *result);
104 
106 
107  lldb::FileSP GetInputFile() const { return m_input_file_sp; }
108  lldb::FileSP GetOutputFile() const { return m_output_file_sp->GetFileSP(); }
109  lldb::FileSP GetErrorFile() const { return m_error_file_sp->GetFileSP(); }
110 
111  /// Flush our output and error file handles.
112  void Flush();
113 
114 private:
115  ScriptInterpreterIORedirect(std::unique_ptr<File> input,
116  std::unique_ptr<File> output);
118 
119  lldb::FileSP m_input_file_sp;
120  lldb::StreamFileSP m_output_file_sp;
121  lldb::StreamFileSP m_error_file_sp;
124 };
125 
127 public:
144  };
145 
147  Debugger &debugger, lldb::ScriptLanguage script_lang,
148  lldb::ScriptedProcessInterfaceUP scripted_process_interface_up =
149  std::make_unique<ScriptedProcessInterface>());
150 
152 
153  ~ScriptInterpreter() override = default;
154 
155  virtual bool Interrupt() { return false; }
156 
157  virtual bool ExecuteOneLine(
158  llvm::StringRef command, CommandReturnObject *result,
159  const ExecuteScriptOptions &options = ExecuteScriptOptions()) = 0;
160 
161  virtual void ExecuteInterpreterLoop() = 0;
162 
164  llvm::StringRef in_string, ScriptReturnType return_type, void *ret_value,
165  const ExecuteScriptOptions &options = ExecuteScriptOptions()) {
166  return true;
167  }
168 
170  const char *in_string,
171  const ExecuteScriptOptions &options = ExecuteScriptOptions()) {
172  Status error;
173  error.SetErrorString("not implemented");
174  return error;
175  }
176 
177  virtual Status
179  Status error;
180  error.SetErrorString("not implemented");
181  return error;
182  }
183 
185  StringList &input,
186  std::string &output,
187  bool has_extra_args) {
188  Status error;
189  error.SetErrorString("not implemented");
190  return error;
191  }
192 
194  std::string &output) {
195  return false;
196  }
197 
198  virtual bool GenerateTypeScriptFunction(const char *oneliner,
199  std::string &output,
200  const void *name_token = nullptr) {
201  return false;
202  }
203 
205  std::string &output,
206  const void *name_token = nullptr) {
207  return false;
208  }
209 
211  std::string &output) {
212  return false;
213  }
214 
215  virtual bool GenerateTypeSynthClass(StringList &input, std::string &output,
216  const void *name_token = nullptr) {
217  return false;
218  }
219 
220  virtual bool GenerateTypeSynthClass(const char *oneliner, std::string &output,
221  const void *name_token = nullptr) {
222  return false;
223  }
224 
226  CreateSyntheticScriptedProvider(const char *class_name,
227  lldb::ValueObjectSP valobj) {
228  return StructuredData::ObjectSP();
229  }
230 
232  CreateScriptCommandObject(const char *class_name) {
233  return StructuredData::GenericSP();
234  }
235 
237  CreateFrameRecognizer(const char *class_name) {
238  return StructuredData::GenericSP();
239  }
240 
241  virtual lldb::ValueObjectListSP GetRecognizedArguments(
242  const StructuredData::ObjectSP &implementor,
243  lldb::StackFrameSP frame_sp) {
244  return lldb::ValueObjectListSP();
245  }
246 
248  OSPlugin_CreatePluginObject(const char *class_name,
249  lldb::ProcessSP process_sp) {
250  return StructuredData::GenericSP();
251  }
252 
256  }
257 
260  return StructuredData::ArraySP();
261  }
262 
265  lldb::tid_t thread_id) {
266  return StructuredData::StringSP();
267  }
268 
271  lldb::tid_t tid, lldb::addr_t context) {
273  }
274 
276  CreateScriptedThreadPlan(const char *class_name,
277  const StructuredDataImpl &args_data,
278  std::string &error_str,
279  lldb::ThreadPlanSP thread_plan_sp) {
280  return StructuredData::ObjectSP();
281  }
282 
283  virtual bool
285  Event *event, bool &script_error) {
286  script_error = true;
287  return true;
288  }
289 
290  virtual bool
292  Event *event, bool &script_error) {
293  script_error = true;
294  return true;
295  }
296 
297  virtual bool
299  bool &script_error) {
300  script_error = true;
301  return true;
302  }
303 
304  virtual lldb::StateType
306  bool &script_error) {
307  script_error = true;
308  return lldb::eStateStepping;
309  }
310 
312  CreateScriptedBreakpointResolver(const char *class_name,
313  const StructuredDataImpl &args_data,
314  lldb::BreakpointSP &bkpt_sp) {
315  return StructuredData::GenericSP();
316  }
317 
318  virtual bool
320  SymbolContext *sym_ctx)
321  {
322  return false;
323  }
324 
325  virtual lldb::SearchDepth
327  {
329  }
330 
332  CreateScriptedStopHook(lldb::TargetSP target_sp, const char *class_name,
333  const StructuredDataImpl &args_data, Status &error) {
334  error.SetErrorString("Creating scripted stop-hooks with the current "
335  "script interpreter is not supported.");
336  return StructuredData::GenericSP();
337  }
338 
339  // This dispatches to the handle_stop method of the stop-hook class. It
340  // returns a "should_stop" bool.
341  virtual bool
343  ExecutionContext &exc_ctx,
344  lldb::StreamSP stream_sp) {
345  return true;
346  }
347 
350  return StructuredData::ObjectSP();
351  }
352 
355  const char *setting_name, lldb_private::Status &error) {
357  }
358 
359  virtual Status GenerateFunction(const char *signature,
360  const StringList &input) {
361  Status error;
362  error.SetErrorString("unimplemented");
363  return error;
364  }
365 
367  std::vector<std::reference_wrapper<BreakpointOptions>> &options,
368  CommandReturnObject &result);
369 
370  virtual void
372  CommandReturnObject &result);
373 
374  /// Set the specified text as the callback for the breakpoint.
376  std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
377  const char *callback_text);
378 
380  const char *callback_text) {
381  Status error;
382  error.SetErrorString("unimplemented");
383  return error;
384  }
385 
386  /// This one is for deserialization:
388  BreakpointOptions &bp_options,
389  std::unique_ptr<BreakpointOptions::CommandData> &data_up) {
390  Status error;
391  error.SetErrorString("unimplemented");
392  return error;
393  }
394 
396  std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
397  const char *function_name, StructuredData::ObjectSP extra_args_sp);
398 
399  /// Set a script function as the callback for the breakpoint.
400  virtual Status
402  const char *function_name,
403  StructuredData::ObjectSP extra_args_sp) {
404  Status error;
405  error.SetErrorString("unimplemented");
406  return error;
407  }
408 
409  /// Set a one-liner as the callback for the watchpoint.
411  const char *oneliner) {}
412 
413  virtual bool GetScriptedSummary(const char *function_name,
414  lldb::ValueObjectSP valobj,
415  StructuredData::ObjectSP &callee_wrapper_sp,
416  const TypeSummaryOptions &options,
417  std::string &retval) {
418  return false;
419  }
420 
421  virtual void Clear() {
422  // Clean up any ref counts to SBObjects that might be in global variables
423  }
424 
425  virtual size_t
427  uint32_t max) {
428  return 0;
429  }
430 
431  virtual lldb::ValueObjectSP
433  return lldb::ValueObjectSP();
434  }
435 
436  virtual int
438  const char *child_name) {
439  return UINT32_MAX;
440  }
441 
442  virtual bool
444  return false;
445  }
446 
448  const StructuredData::ObjectSP &implementor) {
449  return true;
450  }
451 
452  virtual lldb::ValueObjectSP
454  return nullptr;
455  }
456 
457  virtual ConstString
459  return ConstString();
460  }
461 
462  virtual bool
463  RunScriptBasedCommand(const char *impl_function, llvm::StringRef args,
464  ScriptedCommandSynchronicity synchronicity,
466  Status &error,
467  const lldb_private::ExecutionContext &exe_ctx) {
468  return false;
469  }
470 
471  virtual bool RunScriptBasedCommand(
472  StructuredData::GenericSP impl_obj_sp, llvm::StringRef args,
473  ScriptedCommandSynchronicity synchronicity,
475  const lldb_private::ExecutionContext &exe_ctx) {
476  return false;
477  }
478 
479  virtual bool RunScriptFormatKeyword(const char *impl_function,
480  Process *process, std::string &output,
481  Status &error) {
482  error.SetErrorString("unimplemented");
483  return false;
484  }
485 
486  virtual bool RunScriptFormatKeyword(const char *impl_function, Thread *thread,
487  std::string &output, Status &error) {
488  error.SetErrorString("unimplemented");
489  return false;
490  }
491 
492  virtual bool RunScriptFormatKeyword(const char *impl_function, Target *target,
493  std::string &output, Status &error) {
494  error.SetErrorString("unimplemented");
495  return false;
496  }
497 
498  virtual bool RunScriptFormatKeyword(const char *impl_function,
499  StackFrame *frame, std::string &output,
500  Status &error) {
501  error.SetErrorString("unimplemented");
502  return false;
503  }
504 
505  virtual bool RunScriptFormatKeyword(const char *impl_function,
506  ValueObject *value, std::string &output,
507  Status &error) {
508  error.SetErrorString("unimplemented");
509  return false;
510  }
511 
512  virtual bool GetDocumentationForItem(const char *item, std::string &dest) {
513  dest.clear();
514  return false;
515  }
516 
517  virtual bool
519  std::string &dest) {
520  dest.clear();
521  return false;
522  }
523 
524  virtual uint32_t
526  return 0;
527  }
528 
530  std::string &dest) {
531  dest.clear();
532  return false;
533  }
534 
535  virtual bool CheckObjectExists(const char *name) { return false; }
536 
537  virtual bool
538  LoadScriptingModule(const char *filename, const LoadScriptOptions &options,
540  StructuredData::ObjectSP *module_sp = nullptr,
541  FileSpec extra_search_dir = {});
542 
543  virtual bool IsReservedWord(const char *word) { return false; }
544 
545  virtual std::unique_ptr<ScriptInterpreterLocker> AcquireInterpreterLock();
546 
547  const char *GetScriptInterpreterPtyName();
548 
549  virtual llvm::Expected<unsigned>
550  GetMaxPositionalArgumentsForCallable(const llvm::StringRef &callable_name) {
551  return llvm::createStringError(
552  llvm::inconvertibleErrorCode(), "Unimplemented function");
553  }
554 
556 
557  static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string);
558 
560 
563  }
564 
565  lldb::DataExtractorSP
566  GetDataExtractorFromSBData(const lldb::SBData &data) const;
567 
569 
570  llvm::Optional<MemoryRegionInfo> GetOpaqueTypeFromSBMemoryRegionInfo(
571  const lldb::SBMemoryRegionInfo &mem_region) const;
572 
573 protected:
576  lldb::ScriptedProcessInterfaceUP m_scripted_process_interface_up;
577 };
578 
579 } // namespace lldb_private
580 
581 #endif // LLDB_INTERPRETER_SCRIPTINTERPRETER_H
lldb_private::ScriptInterpreter::RunScriptBasedCommand
virtual bool RunScriptBasedCommand(StructuredData::GenericSP impl_obj_sp, llvm::StringRef args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
Definition: ScriptInterpreter.h:471
lldb_private::ScriptInterpreter::SetBreakpointCommandCallback
Status SetBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions >> &bp_options_vec, const char *callback_text)
Set the specified text as the callback for the breakpoint.
Definition: ScriptInterpreter.cpp:109
lldb_private::ScriptInterpreter::SetBreakpointCommandCallback
virtual Status SetBreakpointCommandCallback(BreakpointOptions &bp_options, std::unique_ptr< BreakpointOptions::CommandData > &data_up)
This one is for deserialization:
Definition: ScriptInterpreter.h:387
lldb_private::ExecuteScriptOptions::GetEnableIO
bool GetEnableIO() const
Definition: ScriptInterpreter.h:45
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::ExecuteScriptOptions::GetMaskoutErrors
bool GetMaskoutErrors() const
Definition: ScriptInterpreter.h:52
lldb::ScriptLanguage
ScriptLanguage
Script interpreter types.
Definition: lldb-enumerations.h:216
lldb::SearchDepth
SearchDepth
Definition: lldb-enumerations.h:283
lldb_private::ScriptInterpreterIORedirect
Definition: ScriptInterpreter.h:97
lldb_private::Event
Definition: Event.h:180
lldb_private::ScriptInterpreter::ExecuteMultipleLines
virtual Status ExecuteMultipleLines(const char *in_string, const ExecuteScriptOptions &options=ExecuteScriptOptions())
Definition: ScriptInterpreter.h:169
lldb_private::ScriptInterpreter::GenerateTypeSynthClass
virtual bool GenerateTypeSynthClass(const char *oneliner, std::string &output, const void *name_token=nullptr)
Definition: ScriptInterpreter.h:220
lldb_private::ScriptInterpreter::GetScriptInterpreterPtyName
const char * GetScriptInterpreterPtyName()
lldb_private::StructuredData::GenericSP
std::shared_ptr< Generic > GenericSP
Definition: StructuredData.h:68
StructuredData.h
lldb_private::ScriptInterpreter::CreateScriptedBreakpointResolver
virtual StructuredData::GenericSP CreateScriptedBreakpointResolver(const char *class_name, const StructuredDataImpl &args_data, lldb::BreakpointSP &bkpt_sp)
Definition: ScriptInterpreter.h:312
lldb_private::ScriptInterpreter::ScriptedBreakpointResolverSearchDepth
virtual lldb::SearchDepth ScriptedBreakpointResolverSearchDepth(StructuredData::GenericSP implementor_sp)
Definition: ScriptInterpreter.h:326
lldb_private::ScriptInterpreter::OSPlugin_RegisterInfo
virtual StructuredData::DictionarySP OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp)
Definition: ScriptInterpreter.h:254
lldb::SBError
Definition: SBError.h:20
lldb_private::ScriptInterpreterIORedirect::GetErrorFile
lldb::FileSP GetErrorFile() const
Definition: ScriptInterpreter.h:109
lldb_private::ScriptInterpreter::CreateScriptedThreadPlan
virtual StructuredData::ObjectSP CreateScriptedThreadPlan(const char *class_name, const StructuredDataImpl &args_data, std::string &error_str, lldb::ThreadPlanSP thread_plan_sp)
Definition: ScriptInterpreter.h:276
lldb_private::ScriptInterpreter::GetIndexOfChildWithName
virtual int GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name)
Definition: ScriptInterpreter.h:437
lldb_private::ScriptInterpreter::GetRecognizedArguments
virtual lldb::ValueObjectListSP GetRecognizedArguments(const StructuredData::ObjectSP &implementor, lldb::StackFrameSP frame_sp)
Definition: ScriptInterpreter.h:241
lldb_private::PluginInterface
Definition: PluginInterface.h:16
lldb_private::ScriptInterpreter::eScriptReturnTypeLongIntUnsigned
@ eScriptReturnTypeLongIntUnsigned
Definition: ScriptInterpreter.h:136
lldb_private::ScriptInterpreterIORedirect::m_error_file_sp
lldb::StreamFileSP m_error_file_sp
Definition: ScriptInterpreter.h:121
lldb_private::ExecuteScriptOptions::m_enable_io
bool m_enable_io
Definition: ScriptInterpreter.h:70
lldb_private::ScriptInterpreter::OSPlugin_CreatePluginObject
virtual StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp)
Definition: ScriptInterpreter.h:248
lldb_private::ScriptInterpreter::LoadScriptingModule
virtual bool LoadScriptingModule(const char *filename, const LoadScriptOptions &options, lldb_private::Status &error, StructuredData::ObjectSP *module_sp=nullptr, FileSpec extra_search_dir={})
Definition: ScriptInterpreter.cpp:53
lldb_private::ScriptInterpreter::CheckObjectExists
virtual bool CheckObjectExists(const char *name)
Definition: ScriptInterpreter.h:535
lldb_private::Process
Definition: Process.h:338
lldb_private::ScriptInterpreter::GetStatusFromSBError
Status GetStatusFromSBError(const lldb::SBError &error) const
Definition: ScriptInterpreter.cpp:83
lldb_private::ScriptInterpreter::StringToLanguage
static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string)
Definition: ScriptInterpreter.cpp:99
lldb_private::ScriptInterpreter::eScriptReturnTypeCharStrOrNone
@ eScriptReturnTypeCharStrOrNone
Definition: ScriptInterpreter.h:142
lldb_private::ScriptInterpreter::GenerateScriptAliasFunction
virtual bool GenerateScriptAliasFunction(StringList &input, std::string &output)
Definition: ScriptInterpreter.h:210
lldb_private::ScriptInterpreter::SetBreakpointCommandCallbackFunction
Status SetBreakpointCommandCallbackFunction(std::vector< std::reference_wrapper< BreakpointOptions >> &bp_options_vec, const char *function_name, StructuredData::ObjectSP extra_args_sp)
Definition: ScriptInterpreter.cpp:121
lldb_private::ScriptInterpreter::Interrupt
virtual bool Interrupt()
Definition: ScriptInterpreter.h:155
ScriptedProcessInterface.h
lldb_private::ScriptInterpreter::ScriptedBreakpointResolverSearchCallback
virtual bool ScriptedBreakpointResolverSearchCallback(StructuredData::GenericSP implementor_sp, SymbolContext *sym_ctx)
Definition: ScriptInterpreter.h:319
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
SBMemoryRegionInfo.h
lldb_private::ScriptInterpreter::GetDynamicSettings
virtual StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, lldb_private::Status &error)
Definition: ScriptInterpreter.h:354
lldb_private::ScriptInterpreterIORedirect::Create
static llvm::Expected< std::unique_ptr< ScriptInterpreterIORedirect > > Create(bool enable_io, Debugger &debugger, CommandReturnObject *result)
Create an IO redirect.
Definition: ScriptInterpreter.cpp:149
lldb_private::ScriptInterpreter::eScriptReturnTypeBool
@ eScriptReturnTypeBool
Definition: ScriptInterpreter.h:130
lldb_private::ScriptInterpreter::GetScriptedProcessInterface
ScriptedProcessInterface & GetScriptedProcessInterface()
Definition: ScriptInterpreter.h:561
lldb_private::LoadScriptOptions::GetInitSession
bool GetInitSession() const
Definition: ScriptInterpreter.h:79
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:452
lldb_private::ScriptInterpreter::eScriptReturnTypeLongLongUnsigned
@ eScriptReturnTypeLongLongUnsigned
Definition: ScriptInterpreter.h:138
lldb_private::ScriptInterpreter::OSPlugin_RegisterContextData
virtual StructuredData::StringSP OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t thread_id)
Definition: ScriptInterpreter.h:264
lldb_private::ScriptInterpreter::ExecuteOneLine
virtual bool ExecuteOneLine(llvm::StringRef command, CommandReturnObject *result, const ExecuteScriptOptions &options=ExecuteScriptOptions())=0
lldb_private::ScriptInterpreter::eScriptReturnTypeDouble
@ eScriptReturnTypeDouble
Definition: ScriptInterpreter.h:140
lldb_private::ScriptInterpreter::GetDataExtractorFromSBData
lldb::DataExtractorSP GetDataExtractorFromSBData(const lldb::SBData &data) const
Definition: ScriptInterpreter.cpp:78
lldb_private::ScriptInterpreter::RunScriptFormatKeyword
virtual bool RunScriptFormatKeyword(const char *impl_function, Thread *thread, std::string &output, Status &error)
Definition: ScriptInterpreter.h:486
lldb_private::ScriptInterpreter::CalculateNumChildren
virtual size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor, uint32_t max)
Definition: ScriptInterpreter.h:426
lldb_private::ScriptInterpreter::m_debugger
Debugger & m_debugger
Definition: ScriptInterpreter.h:574
Broadcaster.h
lldb_private::ScriptInterpreter::ScriptedThreadPlanGetRunState
virtual lldb::StateType ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error)
Definition: ScriptInterpreter.h:305
lldb_private::Communication
Definition: Communication.h:84
lldb_private::ScriptInterpreterIORedirect::ScriptInterpreterIORedirect
ScriptInterpreterIORedirect(std::unique_ptr< File > input, std::unique_ptr< File > output)
Definition: ScriptInterpreter.cpp:169
lldb_private::ScriptInterpreter::GetLanguage
lldb::ScriptLanguage GetLanguage()
Definition: ScriptInterpreter.h:559
lldb_private::FileSpec
Definition: FileSpec.h:56
SBData.h
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ScriptInterpreter::eScriptReturnTypeShortIntUnsigned
@ eScriptReturnTypeShortIntUnsigned
Definition: ScriptInterpreter.h:132
lldb_private::ScriptInterpreterLocker::ScriptInterpreterLocker
ScriptInterpreterLocker()=default
lldb_private::StructuredData::StringSP
std::shared_ptr< String > StringSP
Definition: StructuredData.h:66
lldb_private::ScriptInterpreter::SetBreakpointCommandCallback
virtual Status SetBreakpointCommandCallback(BreakpointOptions &bp_options, const char *callback_text)
Definition: ScriptInterpreter.h:379
lldb_private::ScriptInterpreter::CollectDataForWatchpointCommandCallback
virtual void CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options, CommandReturnObject &result)
Definition: ScriptInterpreter.cpp:43
lldb_private::ScriptInterpreter::ScriptInterpreter
ScriptInterpreter(Debugger &debugger, lldb::ScriptLanguage script_lang, lldb::ScriptedProcessInterfaceUP scripted_process_interface_up=std::make_unique< ScriptedProcessInterface >())
Definition: ScriptInterpreter.cpp:29
lldb_private::ExecuteScriptOptions::SetSetLLDBGlobals
ExecuteScriptOptions & SetSetLLDBGlobals(bool set)
Definition: ScriptInterpreter.h:59
lldb_private::LoadScriptOptions::LoadScriptOptions
LoadScriptOptions()=default
lldb_private::ScriptInterpreter::GetSyntheticValue
virtual lldb::ValueObjectSP GetSyntheticValue(const StructuredData::ObjectSP &implementor)
Definition: ScriptInterpreter.h:453
lldb_private::ScriptInterpreterIORedirect::GetOutputFile
lldb::FileSP GetOutputFile() const
Definition: ScriptInterpreter.h:108
SearchFilter.h
lldb_private::Thread
Definition: Thread.h:60
lldb_private::ScriptInterpreter::GetOpaqueTypeFromSBMemoryRegionInfo
llvm::Optional< MemoryRegionInfo > GetOpaqueTypeFromSBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &mem_region) const
Definition: ScriptInterpreter.cpp:91
lldb_private::ScriptInterpreter::eScriptReturnTypeFloat
@ eScriptReturnTypeFloat
Definition: ScriptInterpreter.h:139
lldb_private::ScriptInterpreter::eScriptReturnTypeOpaqueObject
@ eScriptReturnTypeOpaqueObject
Definition: ScriptInterpreter.h:143
lldb_private::ScriptInterpreter::ExecuteOneLineWithReturn
virtual bool ExecuteOneLineWithReturn(llvm::StringRef in_string, ScriptReturnType return_type, void *ret_value, const ExecuteScriptOptions &options=ExecuteScriptOptions())
Definition: ScriptInterpreter.h:163
lldb_private::ScriptInterpreter::GenerateTypeScriptFunction
virtual bool GenerateTypeScriptFunction(StringList &input, std::string &output, const void *name_token=nullptr)
Definition: ScriptInterpreter.h:204
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::ExecuteScriptOptions::SetMaskoutErrors
ExecuteScriptOptions & SetMaskoutErrors(bool maskout)
Definition: ScriptInterpreter.h:64
lldb_private::WatchpointOptions
Definition: WatchpointOptions.h:25
lldb_private::ScriptInterpreter::ScriptReturnType
ScriptReturnType
Definition: ScriptInterpreter.h:128
lldb_private::ScriptInterpreter::m_scripted_process_interface_up
lldb::ScriptedProcessInterfaceUP m_scripted_process_interface_up
Definition: ScriptInterpreter.h:576
lldb_private::ScriptInterpreter::OSPlugin_ThreadsInfo
virtual StructuredData::ArraySP OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp)
Definition: ScriptInterpreter.h:259
lldb_private::ScriptInterpreter::Clear
virtual void Clear()
Definition: ScriptInterpreter.h:421
lldb_private::StringList
Definition: StringList.h:26
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::ScriptInterpreter::eScriptReturnTypeLongLong
@ eScriptReturnTypeLongLong
Definition: ScriptInterpreter.h:137
lldb_private::BreakpointOptions
Definition: BreakpointOptions.h:27
lldb_private::ScriptInterpreterIORedirect::m_disconnect
bool m_disconnect
Definition: ScriptInterpreter.h:123
lldb_private::StructuredDataImpl
Definition: StructuredDataImpl.h:26
lldb_private::ScriptInterpreter::RunScriptBasedCommand
virtual bool RunScriptBasedCommand(const char *impl_function, llvm::StringRef args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
Definition: ScriptInterpreter.h:463
PluginInterface.h
lldb_private::LoadScriptOptions::m_silent
bool m_silent
Definition: ScriptInterpreter.h:94
lldb_private::ScriptInterpreter::eScriptReturnTypeIntUnsigned
@ eScriptReturnTypeIntUnsigned
Definition: ScriptInterpreter.h:134
lldb_private::ExecuteScriptOptions
Definition: ScriptInterpreter.h:41
lldb_private::ScriptInterpreter::ExecuteInterpreterLoop
virtual void ExecuteInterpreterLoop()=0
lldb_private::ScriptInterpreter::GetDocumentationForItem
virtual bool GetDocumentationForItem(const char *item, std::string &dest)
Definition: ScriptInterpreter.h:512
lldb_private::ScriptInterpreter::GetSyntheticTypeName
virtual ConstString GetSyntheticTypeName(const StructuredData::ObjectSP &implementor)
Definition: ScriptInterpreter.h:458
lldb_private::ScriptInterpreter::GenerateBreakpointCommandCallbackData
virtual Status GenerateBreakpointCommandCallbackData(StringList &input, std::string &output, bool has_extra_args)
Definition: ScriptInterpreter.h:184
lldb_private::StructuredData::DictionarySP
std::shared_ptr< Dictionary > DictionarySP
Definition: StructuredData.h:67
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::ScriptInterpreter::eScriptReturnTypeInt
@ eScriptReturnTypeInt
Definition: ScriptInterpreter.h:133
lldb_private::ScriptInterpreterIORedirect::m_communication
Communication m_communication
Definition: ScriptInterpreter.h:122
lldb_private::ScriptInterpreter::RunScriptFormatKeyword
virtual bool RunScriptFormatKeyword(const char *impl_function, Process *process, std::string &output, Status &error)
Definition: ScriptInterpreter.h:479
set
set(option_framework FRAMEWORK) endif() if(LLDB_ENABLE_PYTHON) get_target_property(python_bindings_dir swig_wrapper_python BINARY_DIR) set(lldb_python_wrapper $
Definition: API/CMakeLists.txt:5
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
Communication.h
lldb_private::ScriptInterpreter::GetScriptedSummary
virtual bool GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp, const TypeSummaryOptions &options, std::string &retval)
Definition: ScriptInterpreter.h:413
lldb_private::LoadScriptOptions::SetInitSession
LoadScriptOptions & SetInitSession(bool b)
Definition: ScriptInterpreter.h:82
lldb_private::ScriptInterpreterIORedirect::~ScriptInterpreterIORedirect
~ScriptInterpreterIORedirect()
Definition: ScriptInterpreter.cpp:228
lldb_private::ExecuteScriptOptions::GetSetLLDBGlobals
bool GetSetLLDBGlobals() const
Definition: ScriptInterpreter.h:47
lldb_private::ScriptInterpreterLocker::operator=
const ScriptInterpreterLocker & operator=(const ScriptInterpreterLocker &)=delete
lldb_private::ScriptInterpreter::CreateFrameRecognizer
virtual StructuredData::GenericSP CreateFrameRecognizer(const char *class_name)
Definition: ScriptInterpreter.h:237
lldb_private::ScriptInterpreter::GenerateFunction
virtual Status GenerateFunction(const char *signature, const StringList &input)
Definition: ScriptInterpreter.h:359
lldb_private::ScriptInterpreter::UpdateSynthProviderInstance
virtual bool UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor)
Definition: ScriptInterpreter.h:443
BreakpointOptions.h
lldb_private::ScriptInterpreter::GenerateTypeSynthClass
virtual bool GenerateTypeSynthClass(StringList &input, std::string &output, const void *name_token=nullptr)
Definition: ScriptInterpreter.h:215
lldb-private.h
lldb_private::ScriptInterpreter::eScriptReturnTypeShortInt
@ eScriptReturnTypeShortInt
Definition: ScriptInterpreter.h:131
lldb_private::ScriptInterpreter::SetWatchpointCommandCallback
virtual void SetWatchpointCommandCallback(WatchpointOptions *wp_options, const char *oneliner)
Set a one-liner as the callback for the watchpoint.
Definition: ScriptInterpreter.h:410
lldb::eSearchDepthModule
@ eSearchDepthModule
Definition: lldb-enumerations.h:286
lldb_private::ScriptInterpreter::CreateScriptedStopHook
virtual StructuredData::GenericSP CreateScriptedStopHook(lldb::TargetSP target_sp, const char *class_name, const StructuredDataImpl &args_data, Status &error)
Definition: ScriptInterpreter.h:332
lldb_private::ScriptInterpreter::ScriptedStopHookHandleStop
virtual bool ScriptedStopHookHandleStop(StructuredData::GenericSP implementor_sp, ExecutionContext &exc_ctx, lldb::StreamSP stream_sp)
Definition: ScriptInterpreter.h:342
lldb_private::ScriptInterpreter::IsReservedWord
virtual bool IsReservedWord(const char *word)
Definition: ScriptInterpreter.h:543
StreamFile.h
lldb::eStateStepping
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
Definition: lldb-enumerations.h:86
lldb_private::ScriptInterpreter::MightHaveChildrenSynthProviderInstance
virtual bool MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor)
Definition: ScriptInterpreter.h:447
lldb_private::ScriptInterpreter::eScriptReturnTypeCharPtr
@ eScriptReturnTypeCharPtr
Definition: ScriptInterpreter.h:129
lldb_private::ScriptInterpreter::GetShortHelpForCommandObject
virtual bool GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string &dest)
Definition: ScriptInterpreter.h:518
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::ExecuteScriptOptions::m_maskout_errors
bool m_maskout_errors
Definition: ScriptInterpreter.h:72
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:25
uint32_t
lldb_private::ScriptInterpreter::RunScriptFormatKeyword
virtual bool RunScriptFormatKeyword(const char *impl_function, ValueObject *value, std::string &output, Status &error)
Definition: ScriptInterpreter.h:505
lldb_private::ExecuteScriptOptions::SetEnableIO
ExecuteScriptOptions & SetEnableIO(bool enable)
Definition: ScriptInterpreter.h:54
lldb_private::ScriptedProcessInterface
Definition: ScriptedProcessInterface.h:22
lldb_private::ScriptInterpreter::ScriptedThreadPlanIsStale
virtual bool ScriptedThreadPlanIsStale(StructuredData::ObjectSP implementor_sp, bool &script_error)
Definition: ScriptInterpreter.h:298
lldb_private::ScriptInterpreter::OSPlugin_CreateThread
virtual StructuredData::DictionarySP OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid, lldb::addr_t context)
Definition: ScriptInterpreter.h:270
lldb_private::ScriptInterpreter::GenerateWatchpointCommandCallbackData
virtual bool GenerateWatchpointCommandCallbackData(StringList &input, std::string &output)
Definition: ScriptInterpreter.h:193
lldb_private::ScriptInterpreter::SetBreakpointCommandCallbackFunction
virtual Status SetBreakpointCommandCallbackFunction(BreakpointOptions &bp_options, const char *function_name, StructuredData::ObjectSP extra_args_sp)
Set a script function as the callback for the breakpoint.
Definition: ScriptInterpreter.h:401
lldb::SBData
Definition: SBData.h:20
lldb::SBMemoryRegionInfo
Definition: SBMemoryRegionInfo.h:17
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::ScriptInterpreterLocker
Definition: ScriptInterpreter.h:29
lldb_private::ScriptInterpreter::~ScriptInterpreter
~ScriptInterpreter() override=default
lldb_private::ScriptInterpreter::LanguageToString
static std::string LanguageToString(lldb::ScriptLanguage language)
Definition: ScriptInterpreter.cpp:63
PseudoTerminal.h
lldb_private::TypeSummaryOptions
Definition: TypeSummary.h:26
lldb_private::ScriptInterpreter::ExportFunctionDefinitionToInterpreter
virtual Status ExportFunctionDefinitionToInterpreter(StringList &function_def)
Definition: ScriptInterpreter.h:178
lldb_private::ScriptInterpreter::CreateSyntheticScriptedProvider
virtual StructuredData::ObjectSP CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj)
Definition: ScriptInterpreter.h:226
lldb_private::ScriptInterpreter
Definition: ScriptInterpreter.h:126
lldb_private::ScriptInterpreter::RunScriptFormatKeyword
virtual bool RunScriptFormatKeyword(const char *impl_function, Target *target, std::string &output, Status &error)
Definition: ScriptInterpreter.h:492
lldb_private::ScriptInterpreterIORedirect::Flush
void Flush()
Flush our output and error file handles.
Definition: ScriptInterpreter.cpp:221
lldb_private::ScriptInterpreter::GetMaxPositionalArgumentsForCallable
virtual llvm::Expected< unsigned > GetMaxPositionalArgumentsForCallable(const llvm::StringRef &callable_name)
Definition: ScriptInterpreter.h:550
lldb_private::ScriptInterpreter::AcquireInterpreterLock
virtual std::unique_ptr< ScriptInterpreterLocker > AcquireInterpreterLock()
Definition: ScriptInterpreter.cpp:135
lldb_private::ScriptInterpreter::GetInterpreterInfo
virtual StructuredData::DictionarySP GetInterpreterInfo()
Definition: ScriptInterpreter.cpp:49
lldb_private::LoadScriptOptions::SetSilent
LoadScriptOptions & SetSilent(bool b)
Definition: ScriptInterpreter.h:87
lldb_private::ScriptInterpreter::eScriptReturnTypeLongInt
@ eScriptReturnTypeLongInt
Definition: ScriptInterpreter.h:135
lldb_private::ExecuteScriptOptions::ExecuteScriptOptions
ExecuteScriptOptions()=default
lldb_private::ScriptInterpreter::GetFlagsForCommandObject
virtual uint32_t GetFlagsForCommandObject(StructuredData::GenericSP cmd_obj_sp)
Definition: ScriptInterpreter.h:525
lldb_private::ScriptInterpreterIORedirect::m_input_file_sp
lldb::FileSP m_input_file_sp
Definition: ScriptInterpreter.h:119
Status.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ScriptInterpreter::ScriptedThreadPlanExplainsStop
virtual bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
Definition: ScriptInterpreter.h:284
lldb_private::LoadScriptOptions::m_init_session
bool m_init_session
Definition: ScriptInterpreter.h:93
lldb_private::ScriptInterpreter::GenerateTypeScriptFunction
virtual bool GenerateTypeScriptFunction(const char *oneliner, std::string &output, const void *name_token=nullptr)
Definition: ScriptInterpreter.h:198
lldb_private::ScriptInterpreter::CreateScriptCommandObject
virtual StructuredData::GenericSP CreateScriptCommandObject(const char *class_name)
Definition: ScriptInterpreter.h:232
lldb_private::ScriptInterpreter::GetChildAtIndex
virtual lldb::ValueObjectSP GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx)
Definition: ScriptInterpreter.h:432
lldb_private::LoadScriptOptions
Definition: ScriptInterpreter.h:75
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::StructuredData::ArraySP
std::shared_ptr< Array > ArraySP
Definition: StructuredData.h:62
lldb_private::ExecuteScriptOptions::m_set_lldb_globals
bool m_set_lldb_globals
Definition: ScriptInterpreter.h:71
lldb_private::ScriptInterpreter::LoadPluginModule
virtual StructuredData::ObjectSP LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error)
Definition: ScriptInterpreter.h:349
lldb_private::ScriptInterpreter::RunScriptFormatKeyword
virtual bool RunScriptFormatKeyword(const char *impl_function, StackFrame *frame, std::string &output, Status &error)
Definition: ScriptInterpreter.h:498
lldb_private::ScriptInterpreter::GetLongHelpForCommandObject
virtual bool GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string &dest)
Definition: ScriptInterpreter.h:529
lldb_private::ScriptInterpreter::eScriptReturnTypeChar
@ eScriptReturnTypeChar
Definition: ScriptInterpreter.h:141
lldb_private::ScriptInterpreterIORedirect::m_output_file_sp
lldb::StreamFileSP m_output_file_sp
Definition: ScriptInterpreter.h:120
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::ScriptInterpreter::m_script_lang
lldb::ScriptLanguage m_script_lang
Definition: ScriptInterpreter.h:575
lldb_private::ScriptInterpreterLocker::~ScriptInterpreterLocker
virtual ~ScriptInterpreterLocker()=default
lldb_private::ScriptedCommandSynchronicity
ScriptedCommandSynchronicity
Definition: lldb-private-enumerations.h:152
SBError.h
lldb_private::ScriptInterpreter::ScriptedThreadPlanShouldStop
virtual bool ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
Definition: ScriptInterpreter.h:291
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb_private::LoadScriptOptions::GetSilent
bool GetSilent() const
Definition: ScriptInterpreter.h:80
lldb_private::ScriptInterpreter::CollectDataForBreakpointCommandCallback
virtual void CollectDataForBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions >> &options, CommandReturnObject &result)
Definition: ScriptInterpreter.cpp:36
lldb_private::ScriptInterpreterIORedirect::GetInputFile
lldb::FileSP GetInputFile() const
Definition: ScriptInterpreter.h:107