LLDB
mainline
llvm-project
lldb
include
lldb
Interpreter
Interfaces
ScriptedHookInterface.h
Go to the documentation of this file.
1
//===-- ScriptedHookInterface.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_INTERPRETER_INTERFACES_SCRIPTEDHOOKINTERFACE_H
10
#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDHOOKINTERFACE_H
11
12
#include "
lldb/lldb-private.h
"
13
14
#include "
ScriptedInterface.h
"
15
16
namespace
lldb_private
{
17
class
ScriptedHookInterface
:
public
ScriptedInterface
{
18
public
:
19
/// Describes which hook callback methods the Python class implements.
20
struct
SupportedHookMethods
{
21
bool
handle_module_loaded
=
false
;
22
bool
handle_module_unloaded
=
false
;
23
bool
handle_stop
=
false
;
24
25
bool
any
()
const
{
26
return
handle_module_loaded
||
handle_module_unloaded
||
handle_stop
;
27
}
28
};
29
30
virtual
llvm::Expected<StructuredData::GenericSP>
31
CreatePluginObject
(llvm::StringRef class_name,
lldb::TargetSP
target_sp,
32
const
StructuredDataImpl
&args_sp) = 0;
33
34
/// Check which hook callback methods the Python class implements.
35
/// Called after CreatePluginObject to determine the trigger mask.
36
virtual
SupportedHookMethods
GetSupportedMethods
() {
return
{}; }
37
38
/// Called when modules are loaded into the target.
39
virtual
void
HandleModuleLoaded
(
lldb::StreamSP
&output_sp) {}
40
41
/// Called when modules are unloaded from the target. Optional.
42
virtual
void
HandleModuleUnloaded
(
lldb::StreamSP
&output_sp) {}
43
44
/// Called when the process stops. Returns "should_stop" if false, the
45
/// process will continue. Defaults to true (stop on unimplemented).
46
virtual
llvm::Expected<bool>
HandleStop
(
ExecutionContext
&exe_ctx,
47
lldb::StreamSP
&output_sp) {
48
return
true
;
49
}
50
};
51
}
// namespace lldb_private
52
53
#endif
// LLDB_INTERPRETER_INTERFACES_SCRIPTEDHOOKINTERFACE_H
ScriptedInterface.h
lldb_private::ExecutionContext
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Definition
ExecutionContext.h:294
lldb_private::ScriptedHookInterface
Definition
ScriptedHookInterface.h:17
lldb_private::ScriptedHookInterface::CreatePluginObject
virtual llvm::Expected< StructuredData::GenericSP > CreatePluginObject(llvm::StringRef class_name, lldb::TargetSP target_sp, const StructuredDataImpl &args_sp)=0
lldb_private::ScriptedHookInterface::GetSupportedMethods
virtual SupportedHookMethods GetSupportedMethods()
Check which hook callback methods the Python class implements.
Definition
ScriptedHookInterface.h:36
lldb_private::ScriptedHookInterface::HandleStop
virtual llvm::Expected< bool > HandleStop(ExecutionContext &exe_ctx, lldb::StreamSP &output_sp)
Called when the process stops.
Definition
ScriptedHookInterface.h:46
lldb_private::ScriptedHookInterface::HandleModuleUnloaded
virtual void HandleModuleUnloaded(lldb::StreamSP &output_sp)
Called when modules are unloaded from the target. Optional.
Definition
ScriptedHookInterface.h:42
lldb_private::ScriptedHookInterface::HandleModuleLoaded
virtual void HandleModuleLoaded(lldb::StreamSP &output_sp)
Called when modules are loaded into the target.
Definition
ScriptedHookInterface.h:39
lldb_private::ScriptedInterface::ScriptedInterface
ScriptedInterface()=default
lldb_private::StructuredDataImpl
Definition
StructuredDataImpl.h:26
lldb-private.h
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
lldb_private::ScriptedHookInterface::SupportedHookMethods
Describes which hook callback methods the Python class implements.
Definition
ScriptedHookInterface.h:20
lldb_private::ScriptedHookInterface::SupportedHookMethods::any
bool any() const
Definition
ScriptedHookInterface.h:25
lldb_private::ScriptedHookInterface::SupportedHookMethods::handle_stop
bool handle_stop
Definition
ScriptedHookInterface.h:23
lldb_private::ScriptedHookInterface::SupportedHookMethods::handle_module_unloaded
bool handle_module_unloaded
Definition
ScriptedHookInterface.h:22
lldb_private::ScriptedHookInterface::SupportedHookMethods::handle_module_loaded
bool handle_module_loaded
Definition
ScriptedHookInterface.h:21
Generated on
for LLDB by
1.14.0