10#include "lldb/Host/Config.h"
19#include "../lldb-python.h"
22#include "../SWIGPythonBridge.h"
23#include "../ScriptInterpreterPythonImpl.h"
30ScriptedStopHookPythonInterface::ScriptedStopHookPythonInterface(
31 ScriptInterpreterPythonImpl &interpreter)
34llvm::Expected<StructuredData::GenericSP>
35ScriptedStopHookPythonInterface::CreatePluginObject(llvm::StringRef class_name,
38 return ScriptedPythonInterface::CreatePluginObject(class_name,
nullptr,
46 std::make_shared<ExecutionContextRef>(exe_ctx);
50 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
54 return error.ToError();
57 return obj->GetBooleanValue();
61void ScriptedStopHookPythonInterface::Initialize() {
62 const std::vector<llvm::StringRef> ci_usages = {
63 "target stop-hook add -P <script-name> [-k key -v value ...]"};
64 const std::vector<llvm::StringRef> api_usages = {};
65 PluginManager::RegisterPlugin(
66 GetPluginNameStatic(),
67 llvm::StringRef(
"Perform actions whenever the process stops, before control is returned to the user."),
68 CreateInstance, eScriptLanguagePython, {ci_usages, api_usages});
71void ScriptedStopHookPythonInterface::Terminate() {
72 PluginManager::UnregisterPlugin(CreateInstance);
static llvm::raw_ostream & error(Stream &strm)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
std::shared_ptr< Object > ObjectSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP