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
(
const
ScriptedMetadata
&scripted_metadata,
25
lldb::TargetSP
target_sp)
override
;
26
27
/// `handle_stop` is required so a hook can always be attached via
28
/// `target stop-hook add -P`. `handle_module_loaded` and
29
/// `handle_module_unloaded` are optional; if a hook doesn't implement
30
/// them, the corresponding events are simply not delivered.
31
llvm::SmallVector<AbstractMethodRequirement>
32
GetAbstractMethodRequirements
()
const override
{
33
return
llvm::SmallVector<AbstractMethodRequirement>({{
"handle_stop"
, 2}});
34
}
35
36
/// Check which of the three hook methods the Python class implements.
37
SupportedHookMethods
GetSupportedMethods
()
override
;
38
39
void
HandleModuleLoaded
(
lldb::StreamSP
&output_sp)
override
;
40
void
HandleModuleUnloaded
(
lldb::StreamSP
&output_sp)
override
;
41
llvm::Expected<bool>
HandleStop
(
ExecutionContext
&exe_ctx,
42
lldb::StreamSP
&output_sp)
override
;
43
44
static
void
Initialize
();
45
static
void
Terminate
();
46
47
static
llvm::StringRef
GetPluginNameStatic
() {
48
return
"ScriptedHookPythonInterface"
;
49
}
50
51
llvm::StringRef
GetPluginName
()
override
{
return
GetPluginNameStatic
(); }
52
};
53
}
// namespace lldb_private
54
55
#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:30
lldb_private::ScriptedHookPythonInterface::GetAbstractMethodRequirements
llvm::SmallVector< AbstractMethodRequirement > GetAbstractMethodRequirements() const override
handle_stop is required so a hook can always be attached via target stop-hook add -P.
Definition
ScriptedHookPythonInterface.h:32
lldb_private::ScriptedHookPythonInterface::HandleModuleUnloaded
void HandleModuleUnloaded(lldb::StreamSP &output_sp) override
Called when modules are unloaded from the target. Optional.
Definition
ScriptedHookPythonInterface.cpp:69
lldb_private::ScriptedHookPythonInterface::Initialize
static void Initialize()
Definition
ScriptedHookPythonInterface.cpp:94
lldb_private::ScriptedHookPythonInterface::GetPluginName
llvm::StringRef GetPluginName() override
Definition
ScriptedHookPythonInterface.h:51
lldb_private::ScriptedHookPythonInterface::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition
ScriptedHookPythonInterface.h:47
lldb_private::ScriptedHookPythonInterface::HandleModuleLoaded
void HandleModuleLoaded(lldb::StreamSP &output_sp) override
Called when modules are loaded into the target.
Definition
ScriptedHookPythonInterface.cpp:63
lldb_private::ScriptedHookPythonInterface::CreatePluginObject
llvm::Expected< StructuredData::GenericSP > CreatePluginObject(const ScriptedMetadata &scripted_metadata, lldb::TargetSP target_sp) override
Definition
ScriptedHookPythonInterface.cpp:56
lldb_private::ScriptedHookPythonInterface::HandleStop
llvm::Expected< bool > HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP &output_sp) override
Called when the process stops.
Definition
ScriptedHookPythonInterface.cpp:76
lldb_private::ScriptedHookPythonInterface::ScriptedHookPythonInterface
ScriptedHookPythonInterface(ScriptInterpreterPythonImpl &interpreter)
Definition
ScriptedHookPythonInterface.cpp:25
lldb_private::ScriptedHookPythonInterface::Terminate
static void Terminate()
Definition
ScriptedHookPythonInterface.cpp:106
lldb_private::ScriptedMetadata
Definition
ScriptedMetadata.h:18
lldb_private::ScriptedPythonInterface::ScriptedPythonInterface
ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter)
Definition
ScriptedPythonInterface.cpp:25
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:462
lldb::TargetSP
std::shared_ptr< lldb_private::Target > TargetSP
Definition
lldb-forward.h:480
Generated on
for LLDB by
1.14.0