LLDB
mainline
llvm-project
lldb
source
Plugins
ScriptInterpreter
Python
Interfaces
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
12
#include "
lldb/Interpreter/Interfaces/ScriptedHookInterface.h
"
13
14
#include "
ScriptedPythonInterface.h
"
15
16
namespace
lldb_private
{
17
class
ScriptedHookPythonInterface
:
public
ScriptedHookInterface
,
18
public
ScriptedPythonInterface
,
19
public
PluginInterface
{
20
public
:
21
ScriptedHookPythonInterface
(
ScriptInterpreterPythonImpl
&interpreter);
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>
31
GetAbstractMethodRequirements
()
const override
{
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
ScriptedHookInterface.h
ScriptedPythonInterface.h
lldb_private::ExecutionContext
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Definition
ExecutionContext.h:294
lldb_private::PluginInterface::PluginInterface
PluginInterface()=default
lldb_private::ScriptInterpreterPythonImpl
Definition
ScriptInterpreterPythonImpl.h:25
lldb_private::ScriptedHookInterface
Definition
ScriptedHookInterface.h:17
lldb_private::ScriptedHookPythonInterface::GetSupportedMethods
SupportedHookMethods GetSupportedMethods() override
Check which of the three hook methods the Python class implements.
Definition
ScriptedHookPythonInterface.cpp:28
lldb_private::ScriptedHookPythonInterface::GetAbstractMethodRequirements
llvm::SmallVector< AbstractMethodRequirement > GetAbstractMethodRequirements() const override
A hook class must implement at least one callback.
Definition
ScriptedHookPythonInterface.h:31
lldb_private::ScriptedHookPythonInterface::HandleModuleUnloaded
void HandleModuleUnloaded(lldb::StreamSP &output_sp) override
Called when modules are unloaded from the target. Optional.
Definition
ScriptedHookPythonInterface.cpp:67
lldb_private::ScriptedHookPythonInterface::Initialize
static void Initialize()
Definition
ScriptedHookPythonInterface.cpp:92
lldb_private::ScriptedHookPythonInterface::GetPluginName
llvm::StringRef GetPluginName() override
Definition
ScriptedHookPythonInterface.h:50
lldb_private::ScriptedHookPythonInterface::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition
ScriptedHookPythonInterface.h:46
lldb_private::ScriptedHookPythonInterface::HandleModuleLoaded
void HandleModuleLoaded(lldb::StreamSP &output_sp) override
Called when modules are loaded into the target.
Definition
ScriptedHookPythonInterface.cpp:61
lldb_private::ScriptedHookPythonInterface::HandleStop
llvm::Expected< bool > HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP &output_sp) override
Called when the process stops.
Definition
ScriptedHookPythonInterface.cpp:74
lldb_private::ScriptedHookPythonInterface::ScriptedHookPythonInterface
ScriptedHookPythonInterface(ScriptInterpreterPythonImpl &interpreter)
Definition
ScriptedHookPythonInterface.cpp:23
lldb_private::ScriptedHookPythonInterface::CreatePluginObject
llvm::Expected< StructuredData::GenericSP > CreatePluginObject(llvm::StringRef class_name, lldb::TargetSP target_sp, const StructuredDataImpl &args_sp) override
Definition
ScriptedHookPythonInterface.cpp:54
lldb_private::ScriptedHookPythonInterface::Terminate
static void Terminate()
Definition
ScriptedHookPythonInterface.cpp:103
lldb_private::ScriptedPythonInterface::ScriptedPythonInterface
ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter)
Definition
ScriptedPythonInterface.cpp:25
lldb_private::StructuredDataImpl
Definition
StructuredDataImpl.h:26
lldb_private
A class that represents a running process on the host machine.
Definition
SBAddressRange.h:14
lldb::StreamSP
std::shared_ptr< lldb_private::Stream > StreamSP
Definition
lldb-forward.h:452
lldb::TargetSP
std::shared_ptr< lldb_private::Target > TargetSP
Definition
lldb-forward.h:470
Generated on
for LLDB by
1.14.0