Skip to content

Commit ed26cfb

Browse files
committed
debug-trap: use int3 on x86 instead of int $03
See Peter Cordes' comment on Stack Overflow: https://stackoverflow.com/questions/173618/is-there-a-portable-equivalent-to-debugbreak-debugbreak/49079078#comment112451699_49079078 > For x86 (including x86-64) GAS syntax, it's better to write `int3` to > make it explicit that you want the special case debug-break > instruction, one byte `CC` not `CD 03`, for the rare cases where that > matter (code size, and v8086 mode). > (felixcloutier.com/x86/intn:into:int3:int1). With NASM they actually > assemble differently, GAS optimizes both to int3.
1 parent f596f8b commit ed26cfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

debug-trap/debug-trap.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# elif defined(__DMC__) && defined(_M_IX86)
3434
static inline void psnip_trap(void) { __asm int 3h; }
3535
# elif defined(__i386__) || defined(__x86_64__)
36-
static inline void psnip_trap(void) { __asm__ __volatile__("int $03"); }
36+
static inline void psnip_trap(void) { __asm__ __volatile__("int3"); }
3737
# elif defined(__thumb__)
3838
static inline void psnip_trap(void) { __asm__ __volatile__(".inst 0xde01"); }
3939
# elif defined(__aarch64__)

0 commit comments

Comments
 (0)