Self-modifying code sees a 0xCC byte but the debugger doesn't show it?

前端 未结 1 1048
花落未央
花落未央 2021-01-13 04:56

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         


        
相关标签:
1条回答
  • 2021-01-13 05:26

    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.

    0 讨论(0)
提交回复
热议问题