From 98ad3bec2a7ee1a5cbabdcabc25252572dcb1d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 4 Sep 2026 03:56:07 +0000 Subject: [PATCH] Fixed debugBreak. Fixes #425. (#426) --- src/debug.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 76b9018..c2a2626 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -104,6 +104,8 @@ namespace bx #elif BX_CPU_ARM __builtin_trap(); // asm("bkpt 0"); +#elif BX_CPU_RISCV && (BX_COMPILER_GCC || BX_COMPILER_CLANG) + __asm__ volatile("ebreak"); #elif BX_CPU_X86 && (BX_COMPILER_GCC || BX_COMPILER_CLANG) // NaCl doesn't like int 3: // NativeClient: NaCl module load failed: Validation failure. File violates Native Client safety rules. @@ -119,9 +121,10 @@ namespace bx // Doing emscripten_debugger() disables asm.js validation due to an emscripten bug //emscripten_debugger(); EM_ASM({ debugger; }); -#else // cross platform implementation - int* int3 = (int*)3L; - *int3 = 3; +#elif BX_COMPILER_GCC || BX_COMPILER_CLANG + __builtin_trap(); +#else +# error "Unknown BX_CPU_? / BX_COMPILER_?" #endif // BX }