Program which behaves differently in/out of a debugger The challenge is to write a deterministic program (any language/OS) which takes no arguments or other input and behaves differently in a debugger from how it behaves when not being debugged.

For example, the program may output something when being debugged but not output anything when not being debugged. Or output something different in each case. Or it may crash when being debugged but not crash when not being debugged. Or vice-versa.

Caveats and clarifications:


Timing differences do not count.
Interpreted languages are permitted.
To emphasize determinism: the behaviour must be exactly reproducible both in and out of debugging context.
The presence of the debugger itself should the only difference between the two cases.


Telling the debugger to add inputs (stdin or argv ENV or whatever) is cheating, the debugger should run the program "as-is".
Changing the environment (e.g. running in a virtual machine or different OS, or changing OS settings such as memory limits) between debug and non-debug runs is not permitted.



Shortest code wins. I may award a bounty which reveals something interesting about how debuggers work.
x86 and x64_64 machine language on Linux and OSX, 1 byte

0x0:  CC    int3 


Try it online!

int 3 throws a SIGTRAP which will cause a debugger to stop as if it encountered a breakpoint. Outside of a debugger, the kernel terminates the process (thanks to @Ruslan for the correction).

C (gcc) (x86 Linux and OSX), 14 11 9 bytes



main=204;


Try it online!

The integer 204 corresponds to the int 3 instruction; the TIO link is the same as above.