I\'m trying to write self modifying asm code.
At some point, I try the following : (NASM compiler)
start_of_code:
; ... snip ...
cmp byte [rax], 0x6
0xcc is the machine code for int3 which is the software breakpoint interrupt. gdb places this into your code at breakpoints so it gets control back. It doesn't play well with code that reads itself. Use the hbreak command instead, to set a hardware breakpoint that doesn't need to modify your code.