LLDB mainline
ScriptedHookPythonInterface.h
Go to the documentation of this file.
1//===-- ScriptedHookPythonInterface.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_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDHOOKPYTHONINTERFACE_H
10#define LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDHOOKPYTHONINTERFACE_H
11
13
15
16namespace lldb_private {
19 public PluginInterface {
20public:
22
23 llvm::Expected<StructuredData::GenericSP>
24 CreatePluginObject(llvm::StringRef class_name, lldb::TargetSP target_sp,
25 const StructuredDataImpl &args_sp) override;
26
27 /// A hook class must implement at least one callback. All three are
28 /// individually optional; hooks that implement none will be rejected
29 /// at creation time.
30 llvm::SmallVector<AbstractMethodRequirement>
32 return {};
33 }
34
35 /// Check which of the three hook methods the Python class implements.
36 SupportedHookMethods GetSupportedMethods() override;
37
38 void HandleModuleLoaded(lldb::StreamSP &output_sp) override;
39 void HandleModuleUnloaded(lldb::StreamSP &output_sp) override;
40 llvm::Expected<bool> HandleStop(ExecutionContext &exe_ctx,
41 lldb::StreamSP &output_sp) override;
42
43 static void Initialize();
44 static void Terminate();
45
46 static llvm::StringRef GetPluginNameStatic() {
47 return "ScriptedHookPythonInterface";
48 }
49
50 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
51};
52} // namespace lldb_private
53
54#endif // LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDHOOKPYTHONINTERFACE_H
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
SupportedHookMethods GetSupportedMethods() override
Check which of the three hook methods the Python class implements.
llvm::SmallVector< AbstractMethodRequirement > GetAbstractMethodRequirements() const override
A hook class must implement at least one callback.
void HandleModuleUnloaded(lldb::StreamSP &output_sp) override
Called when modules are unloaded from the target. Optional.
void HandleModuleLoaded(lldb::StreamSP &output_sp) override
Called when modules are loaded into the target.
llvm::Expected< bool > HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP &output_sp) override
Called when the process stops.
ScriptedHookPythonInterface(ScriptInterpreterPythonImpl &interpreter)
llvm::Expected< StructuredData::GenericSP > CreatePluginObject(llvm::StringRef class_name, lldb::TargetSP target_sp, const StructuredDataImpl &args_sp) override
ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter)
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