1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
//! # Extension Points
//!
//! Defines the [`ExtensionPoint`](steckrs::hook::ExtensionPoint) where [plugins](steckrs::Plugin)
//! can hook into the debugger.
//!
//! Extension points represent specific events or phases in the debugging process
//! where plugins can register hooks to execute custom behavior. Each extension point
//! defines a trait that plugin hooks must implement.
//!
//! This module uses the [`extension_point!`](steckrs::extension_point) macro from the [`steckrs`]
//! crate to define extension points in a concise and type-safe manner.
//!
//! ## Available Extension Points
//!
//! - [`EPreSignalHandler`]: Called before the debugger processes signals from the debuggee
//!
//! ## Usage
//!
//! Extension points are used by the debugger to invoke plugin hooks at appropriate times.
//! Plugins register hooks for specific extension points, and the debugger calls those hooks
//! when the corresponding event occurs.
//!
//! ```rust
//! use steckrs::simple_plugin;
//! use coreminer::plugins::extension_points::{EPreSignalHandler, EPreSignalHandlerF};
//! use coreminer::errors::Result;
//! use coreminer::feedback::{Feedback, Status};
//! use nix::sys::wait::WaitStatus;
//! use nix::libc::siginfo_t;
//! use nix::sys::signal::Signal;
//!
//! // Define a hook implementation
//! struct MySignalHandler;
//! impl EPreSignalHandlerF for MySignalHandler {
//! fn pre_handle_signal(
//! &mut self,
//! feedback: &Feedback,
//! siginfo: &siginfo_t,
//! sig: &Signal,
//! wait_status: &WaitStatus,
//! ) -> Result<Status> {
//! // Custom signal handling logic
//! Ok(Status::PluginContinue)
//! }
//! }
//!
//! // Register the hook in a plugin
//! simple_plugin!(
//! MyPlugin,
//! "my_plugin",
//! "A plugin that handles signals",
//! hooks: [(EPreSignalHandler, MySignalHandler)]
//! );
//! ```
use WaitStatus;
use extension_point;
use siginfo_t;
use Signal;
use crateResult;
use crateFeedback;
use crateStatus;
extension_point!;
extension_point!;