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