section .data
section .text
global _start
_start:
mov eax, loop ; eax <- addr of loop
mov ebx, new
mov ecx, new
mov esi, 2
loop:
mov edx, [eax] ; edx <- instruction of loop, but not worked
mov [ebx], edx
add eax, esi
add ebx, esi
cmp eax, ecx
jne loop
mov ecx, ebx
new:
What I want in this code is to put the Instruction Hex code of the loop in edx.
If you see here, mov edx and [eax] are stored in the loop, and I think the instruction code is 0x1389108b, but the actual saved value is 0x13cc10cc. I don't know how to get this value 0x1389108b.
The instruction at loop
is 8b 10, and the next instruction is 89 13. However you have set a breakpoint at each of those instructions, so the debugger has overwritten the first byte of each instruction with a breakpoint instruction. The code for a breakpoint is cc, so that’s what your program reads. If you run it without setting breakpoints, you’ll get the value you expect.