Introduction
Single-step breakpoints are fundamental debugging mechanism that allows execution to pause after every single instruction. Unlike hardware breakpoints which trigger at a specific address, single-step mode traces every instruction sequentially.
In this post, we will see these breakpoints in detail with NASM + QEMU.
Single-Step Breakpoints and Trap Flag
A debugger can determine single-step breakpoints with DR6 register. DR6 register holds BS (Single-Step Bit) and a debugger can use this bit. BS is 14 bit of DR6 register:
I assigned the value 0x5 to the step_count variable, so each step is performed based on this value. Also my breakpoint is based on DebugTarget function:
DebugTarget:
mov rax, 0x1
mov rbx, 0x2
add rax, rbx
mov rcx, rax
mov rdx, 0x0
ret
SOCIAL SHARE CARD GENERATOR