On Mon, 3 Jun 2024 at 14:36, Peter0x44 wrote: > > +void > > +std::breakpoint() noexcept > > +{ > > +#if _GLIBCXX_HAVE_DEBUGAPI_H && defined(_WIN32) && > > !defined(__CYGWIN__) > > + DebugBreak(); > > +#elif __has_builtin(__builtin_debugtrap) > > + __builtin_debugtrap(); // Clang > > +#elif defined(__i386__) || defined(__x86_64__) > > + __asm__ volatile ("int3"); > Worth noting, currently gcc has some bugs around its handling of int3,
s/gcc/gdb/ ? > https://sourceware.org/bugzilla/show_bug.cgi?id=31194 > int3;nop seems to work around it okay. __builtin_debugtrap() of clang > does run into the same issues. It seemed to work OK for me, maybe because there's no code after it? void breakpoint() { __asm__ volatile ("int3); }