55llvm::Expected<StructuredData::GenericSP>
77 std::make_shared<ExecutionContextRef>(exe_ctx);
78 llvm::Expected<StructuredData::ObjectSP> obj_or_err =
79 Dispatch(
"handle_stop", exe_ctx_ref_sp, output_sp);
81 return obj_or_err.takeError();
86 if (!obj || !obj->IsValid())
89 return obj->GetBooleanValue();
93 const std::vector<llvm::StringRef> ci_usages = {
94 "target hook add -P <script-name> [-k key -v value ...]"};
95 const std::vector<llvm::StringRef> api_usages = {};
98 llvm::StringRef(
"Perform actions on target lifecycle events (module "
99 "load/unload, process stop)."),
101 {ci_usages, api_usages});
ScriptInterpreterPythonImpl::Locker Locker
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
SupportedHookMethods GetSupportedMethods() override
Check which of the three hook methods the Python class implements.
static llvm::StringRef GetPluginNameStatic()
llvm::Expected< StructuredData::GenericSP > CreatePluginObject(const ScriptedMetadata &scripted_metadata, lldb::TargetSP target_sp) override
llvm::Expected< bool > HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP &output_sp) override
Called when the process stops.
ScriptedHookPythonInterface(ScriptInterpreterPythonImpl &interpreter)
llvm::Error HandleModuleUnloaded(lldb::StreamSP &output_sp) override
Called when modules are unloaded from the target. Optional.
llvm::Error HandleModuleLoaded(lldb::StreamSP &output_sp) override
Called when modules are loaded into the target.
static bool CreateInstance(lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
StructuredData::GenericSP m_object_instance_sp
ScriptInterpreterPythonImpl & m_interpreter
ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter)
llvm::Expected< T > Dispatch(llvm::StringRef method_name, Args &&...args)
Call method_name on the scripted object.
llvm::Expected< std::optional< T > > DispatchToOptional(llvm::StringRef method_name, Args &&...args)
Call an optional method_name, reporting "the script doesn't implementit" as std::nullopt rather than ...
llvm::Expected< StructuredData::GenericSP > CreatePluginObject(const ScriptedMetadata &scripted_metadata, StructuredData::Generic *script_obj, Args... args)
std::shared_ptr< Object > ObjectSP
bool HasAttribute(llvm::StringRef attribute) const
A class that represents a running process on the host machine.
@ eScriptedExtensionScriptedHook
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP
Describes which hook callback methods the Python class implements.
bool handle_module_unloaded
bool handle_module_loaded