9#ifndef LLDB_INTERPRETER_INTERFACES_SCRIPTEDINTERFACE_H
10#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDINTERFACE_H
22#include "llvm/Support/Compiler.h"
66 virtual llvm::SmallVector<AbstractMethodRequirement>
81 return llvm::make_error<UnimplementedError>();
85 llvm::SmallVector<llvm::StringLiteral> abstract_methods;
88 return requirement.name;
90 return abstract_methods;
93 template <
typename Ret>
103 std::string existing_error =
error.Fail() ?
error.AsCString() :
"";
104 if (existing_error.empty())
120 std::string class_name,
FileSpec source_path,
122 assert(registry_sp &&
"registering with an invalid registry");
123 assert(!
m_registry_wp.lock() &&
"script object is already registered");
131 info.
args_sp = std::move(args_sp);
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
virtual llvm::StringRef GetPluginName()=0
The name this interface is registered under with the PluginManager.
static Ret ErrorWithMessage(llvm::StringRef caller_name, llvm::StringRef user_msg, Status &error, LLDBLog log_category=LLDBLog::Process)
virtual ~ScriptedInterface()
std::optional< ScriptedMetadata > m_scripted_metadata
llvm::SmallVector< llvm::StringLiteral > const GetAbstractMethods() const
virtual llvm::SmallVector< AbstractMethodRequirement > GetAbstractMethodRequirements() const =0
void UnregisterInstance()
lldb::ScriptedInstanceRegistryWP m_registry_wp
virtual bool UserCanRunDirectly() const
Whether the user can invoke this extension directly, the way a scripted command can.
virtual llvm::Expected< FileSpec > GetScriptedModulePath()
ScriptedInterface()=default
StructuredData::GenericSP GetScriptObjectInstance()
ScriptedInterface & operator=(const ScriptedInterface &)=delete
static bool CreateInstance(lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
ScriptedInterface(const ScriptedInterface &)=delete
Delete the copy constructor.
void RegisterInstance(const lldb::ScriptedInstanceRegistrySP ®istry_sp, std::string class_name, FileSpec source_path, StructuredData::DictionarySP args_sp)
virtual llvm::SmallVector< llvm::StringLiteral > GetOptionalMethods() const
Methods a script may legitimately leave out, for which LLDB has a documented answer.
const std::optional< ScriptedMetadata > & GetScriptedMetadata() const
StructuredData::GenericSP m_object_instance_sp
static Status FromErrorString(const char *str)
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
std::shared_ptr< Generic > GenericSP
std::shared_ptr< Dictionary > DictionarySP
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
ScriptLanguage
Script interpreter types.
std::weak_ptr< lldb_private::ScriptedInstanceRegistry > ScriptedInstanceRegistryWP
std::shared_ptr< lldb_private::ScriptedInstanceRegistry > ScriptedInstanceRegistrySP
StructuredData::DictionarySP args_sp
llvm::StringRef plugin_name
The interface's PluginManager name, from the string literal its GetPluginNameStatic() returns,...
lldb::addr_t object_address