Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programmatically invoking a break point

Tags:

rust

In rust is there any way to break into the debugger. C# has DebugBreak which when executed simply behaves the same way as though a break point was set there.

Breaking on panic I know how to do and thats not what I am looking for.

like image 876
pm100 Avatar asked Sep 18 '25 18:09

pm100


1 Answers

Yes, there's ::std::intrinsics::breakpoint (unstable/feature-gated, so only available on nightly Rust):

#![feature(core_intrinsics)]

use ::std::intrinsics::breakpoint;

fn main() {
    unsafe { breakpoint() };
}
like image 169
eggyal Avatar answered Sep 21 '25 08:09

eggyal