Instructions
x86-64INT3 (Breakpoint — 0xCC)
The single-byte INT3 instruction (0xCC) raises exception #BP, making it the universal software breakpoint mechanism used by all x86 debuggers.
INT3 is the dedicated 1-byte software interrupt instruction encoded as
0xCC. It raises exception vector 3 (Debug Exception / Breakpoint), which the
OS delivers to any attached debugger.
Encoding
CC INT3 ; 1 byte — the only true 1-byte breakpoint
CD 03 ; INT 3 — 2-byte form; less commonDebuggers use the 1-byte form because overwriting exactly one byte of a target instruction is atomic on x86 and easy to restore.
How software breakpoints work
- Debugger saves the original byte at target address.
- Debugger writes
0xCCover the first byte. - CPU executes
0xCC→ raises#BP. - OS notifies debugger; debugger restores original byte.
- Debugger decrements
RIPby 1 (execution stopped after theCC).
; Original
48 8B 45 F8 mov rax, [rbp-8]
; After breakpoint set (only first byte patched)
CC 8B 45 F8 INT3 ; <breakpoint>Appearances in binaries
- Debug builds: MSVC fills uninitialised stack variables with
0xCCbytes (CC CC CC CC=int3; int3; int3; int3) to trap use-before-init bugs. __debugbreak()/DebugBreak(): compile toint3— a programmatic breakpoint.- Anti-debug tricks: a process can set a
SIGTRAP/ exception handler for#BP; if no debugger is present the handler runs normally; if a debugger intercepts the exception the handler is skipped, leaking debugger presence. - Function padding: MSVC fills the gap between functions with
0xCCbytes instead of NOPs — a distinctive pattern in Windows binaries.
Reverse-engineering notes
- A
0xCCbyte that is never reached by normal flow but sits at a hot-patch slot (5-byte NOP sled before a function) is a Windows hot-patch header — not a real breakpoint. - Seeing
CC CC CC CCin data is the MSVC0xCC-fill of uninitialised heap/ stack memory — check whether you are looking at code or data. - Some anti-tamper systems scan their own code sections for
0xCCbytes to detect debugger breakpoints at runtime.