What is D's "__debugbreak()" equivalent?
Dennis
dkorpel at gmail.com
Thu Oct 28 09:54:44 UTC 2021
On Wednesday, 27 October 2021 at 16:54:49 UTC, Simon wrote:
> What is the equivalent in D?
With LDC, you have:
```D
import ldc.intrinsics: llvm_debugtrap;
```
Combining that with previous answers, you can make something like
this:
```D
void debugbreak() nothrow @nogc @trusted {
version(D_InlineAsm_X86_64) {
asm nothrow @nogc {
int 3;
}
} else version(LDC) {
import ldc.intrinsics: llvm_debugtrap;
llvm_debugtrap();
} else {
assert(0); // No `breakPoint` for this compiler configuration
}
}
```
More information about the Digitalmars-d-learn
mailing list