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
//! # Constants Module
//!
//! Defines signal constants and codes used in Linux ptrace debugging.
//!
//! These constants are primarily related to signal handling and are used to interpret
//! signals received from the debugged process. Many of these constants are not directly
//! available from the [`nix`] or Rust bindings of [`libc`](nix::libc), so they're defined here for convenience.
//!
//! Source reference: <https://elixir.bootlin.com/linux/v6.13.1/source/include/uapi/asm-generic/siginfo.h#L227>
/// Signal from the kernel
///
/// This constant indicates that a signal was generated by the kernel rather than
/// a user process or other source.
pub const SI_KERNEL: i32 = 0x80;
// ---------------- SIGTRAP si_codes ---------------------------------------------------------------
/// Process breakpoint
///
/// Generated when a process hits a breakpoint instruction (`int3`/`0xCC`).
/// Used by the debugger to detect when a breakpoint has been triggered.
pub const TRAP_BRKPT: i32 = 0x1;
/// Process trace trap
///
/// Generated during single-stepping operations through the process.
/// Indicates that a single instruction has been executed.
pub const TRAP_TRACE: i32 = 0x2;
/// Process taken branch trap
///
/// Generated when the processor takes a branch that was being monitored.
/// Used in branch trace debugging.
pub const TRAP_BRANCH: i32 = 0x3;
/// Hardware breakpoint/watchpoint
///
/// Generated when a hardware breakpoint or watchpoint is triggered.
/// Different from software breakpoints which use `TRAP_BRKPT`.
pub const TRAP_HWBKPT: i32 = 0x4;
/// Undiagnosed trap
///
/// Generated when the cause of a trap cannot be determined.
pub const TRAP_UNK: i32 = 0x5;
/// Perf event with sigtrap=1
///
/// Generated by the performance monitoring subsystem when
/// configured to generate `SIGTRAP` signals.
pub const TRAP_PERF: i32 = 0x6;