Comment

Comment by dundarious

Yes, although for usage in an assertion like in TFA, you want SIGTRAP outside of a debugger to cause a core dump, which is the default, so you must not SIG_IGN it.

In priority order:

- msvc: __debugbreak()

- clang: __builtin_debugtrap()

- linux (and probably some other posix-ish systems): raise(SIGTRAP)

- gcc x86: asm("int3; nop")

- otherwise: you're out of luck, just abort()/__builtin_trap()

parent dundarious 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton