GDB反汇编填充零

时间:2018-04-19 05:39:38

标签: operating-system gdb kernel elf qemu

当我在我的文件上运行objdump -D时,我得到了我期望的汇编代码。

kernel.elf:     file format elf32-i386

Disassembly of section .text:

00100000 <__code>:
  100000:       02 b0 ad 1b 03 00       add    0x31bad(%eax),%dh
  100006:       00 00                   add    %al,(%eax)
  100008:       fb                      sti
  100009:       4f                      dec    %edi
  10000a:       52                      push   %edx
  10000b:       e4 00                   in     $0x0,%al
  10000d:       00 10                   add    %dl,(%eax)
  10000f:       00 00                   add    %al,(%eax)
  100011:       00 10                   add    %dl,(%eax)
  100013:       00 00                   add    %al,(%eax)
  100015:       20 10                   and    %dl,(%eax)
  100017:       00 00                   add    %al,(%eax)
  100019:       40                      inc    %eax
  10001a:       10 00                   adc    %al,(%eax)
  10001c:       20 00                   and    %al,(%eax)
  10001e:       10 00                   adc    %al,(%eax)

00100020 <start>:
  100020:       fa                      cli
  100021:       bc 00 40 10 00          mov    $0x104000,%esp
  100026:       53                      push   %ebx
  100027:       e8 02 00 00 00          call   10002e <main>
  10002c:       eb fe                   jmp    10002c <start+0xc>

0010002e <main>:
  10002e:       55                      push   %ebp
  10002f:       89 e5                   mov    %esp,%ebp
  100031:       83 ec 10                sub    $0x10,%esp
  100034:       c7 45 fc 28 23 00 00    movl   $0x2328,-0x4(%ebp)
  10003b:       b8 ef be ad de          mov    $0xdeadbeef,%eax
  100040:       c9                      leave
  100041:       c3                      ret
  100042:       66 90                   xchg   %ax,%ax
  100044:       66 90                   xchg   %ax,%ax
  100046:       66 90                   xchg   %ax,%ax
  100048:       66 90                   xchg   %ax,%ax
  ...

但是,当我在GDB上打开文件(通过QEMU和目标远程)并运行(gdb) disassemble时,相同的位置保存空值而不是预期的指令(add %al,(%eax)相当于{{1 }})。

00 00

为什么会这样?为什么GDB不读取(加载?)正确的值?

0 个答案:

没有答案