Remix.run Logo
nulld3v 4 days ago

On Unix platforms, you could just raise SIGTRAP directly, it will pause the attached debugger and works regardless of architecture.

This is the macro I use for example:

  #[doc(hidden)]
  pub use libc as __libc;
  
  // This is a macro instead of a function to ensure the debugger shows the breakpoint as being at
  // the caller instead of this file.
  #[cfg(unix)]
  #[macro_export]
  macro_rules! breakpoint {
      () => {
          unsafe {
              use $crate::__libc as libc;
              libc::raise(libc::SIGTRAP);
          }
      };
  }