1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! 特定于 ARM 编译器的内部函数
//!
//! # References
//!
//! - [ARM Compiler v 6.10 - armclang Reference Guide][arm_comp_ref]
//!
//! [arm_comp_ref]: https://developer.arm.com/docs/100067/0610

#[cfg(test)]
use stdarch_test::assert_instr;

/// 插入断点指令。
///
/// `VAL` 是 `[0, 65535]` 范围内的编译时常量整数。
///
/// 插入的断点指令是 A64 上的 `BRK`。
#[cfg_attr(test, assert_instr(brk, VAL = 0))]
#[inline(always)]
#[rustc_legacy_const_generics(0)]
pub unsafe fn __breakpoint<const VAL: i32>() {
    static_assert_uimm_bits!(VAL, 16);
    crate::arch::asm!("brk {}", const VAL);
}