| |
| Posted by bauss in reply to Dennis | PermalinkReply |
|
bauss
Posted in reply to Dennis
| On Thursday, 28 October 2021 at 09:54:44 UTC, Dennis wrote:
> On Wednesday, 27 October 2021 at 16:54:49 UTC, Simon wrote:
> What is the equivalent in D?
With LDC, you have:
import ldc.intrinsics: llvm_debugtrap;
Combining that with previous answers, you can make something like this:
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
}
}
Shouldn't it be this instead, unless D_InlineAsm_X86_64 isn't available for ldc?
There's also D_InlineAsm_X86 btw.
void debugbreak() nothrow @nogc @trusted {
version(LDC) {
import ldc.intrinsics: llvm_debugtrap;
llvm_debugtrap();
} else version(D_InlineAsm_X86_64) {
asm nothrow @nogc {
int 3;
}
} else {
assert(0); // No `breakPoint` for this compiler configuration
}
}
|