@@ -42,3 +42,30 @@ pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?)
4242pub macro global_asm ( "assembly template" , $( operands, ) * $( options ( $( option) , * ) ) ?) {
4343 /* compiler built-in */
4444}
45+
46+ /// Compiles to a target-specific software breakpoint instruction or equivalent.
47+ ///
48+ /// This will typically abort the program. It may result in a core dump, and/or the system logging
49+ /// debug information. Additional target-specific capabilities may be possible depending on
50+ /// debuggers or other tooling; in particular, a debugger may be able to resume execution.
51+ ///
52+ /// If possible, this will produce an instruction sequence that allows a debugger to resume *after*
53+ /// the breakpoint, rather than resuming *at* the breakpoint; however, the exact behavior is
54+ /// target-specific and debugger-specific, and not guaranteed.
55+ ///
56+ /// If the target platform does not have any kind of debug breakpoint instruction, this may compile
57+ /// to a trapping instruction (e.g. an undefined instruction) instead, or to some other form of
58+ /// target-specific abort that may or may not support convenient resumption.
59+ ///
60+ /// The precise behavior and the precise instruction generated are not guaranteed, except that in
61+ /// normal execution with no debug tooling involved this will not continue executing.
62+ ///
63+ /// - On x86 targets, this produces an `int3` instruction.
64+ /// - On aarch64 targets, this produces a `brk #0xf000` instruction.
65+ // When stabilizing this, update the comment on `core::intrinsics::breakpoint`.
66+ #[ unstable( feature = "breakpoint" , issue = "133724" ) ]
67+ #[ inline( always) ]
68+ #[ cfg( not( bootstrap) ) ]
69+ pub fn breakpoint ( ) {
70+ core:: intrinsics:: breakpoint ( ) ;
71+ }
0 commit comments