如何在x86中获取指令十六进制代码?[重复]

问题描述 投票:0回答:1
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:

x86代码图片

在这段代码中,我想要的是把循环的指令十六进制代码放在edx中。

如果你看到这里,mov edx和[eax]都存储在循环中,我想指令代码就是 0x1389108b但实际的保存值是 0x13cc10cc. 我不知道怎么得到这个值。0x1389108b.

assembly x86 gdb machine-code self-modifying
1个回答
1
投票

指令在 loop 是8b 10,下一条指令是89 13。然而你在每条指令上都设置了一个断点,所以调试器已经用断点指令覆盖了每条指令的第一个字节。断点的代码是cc,所以你的程序读到的就是这个。如果你运行时不设置断点,你会得到你所期望的值。

© www.soinside.com 2019 - 2024. All rights reserved.