C++ 如何在C++;汇编代码?

C++ 如何在C++;汇编代码?,c++,linux,gcc,code-generation,vptr,C++,Linux,Gcc,Code Generation,Vptr,我使用GCC5.4.0编译代码,并使用objdump-sa.out反汇编二进制文件。我想查找Base的vptr,但只显示未知地址0x80487d4。最大地址号是0x80487b7,我不明白。 命令列表:g++test.cpp-O0;objdump-S a.out class Base { public: Base() {} virtual void Get() { } }; class Derivered : public Base { public: virtual void

我使用GCC5.4.0编译代码,并使用
objdump-sa.out
反汇编二进制文件。我想查找Base的vptr,但只显示未知地址
0x80487d4
。最大地址号是
0x80487b7
,我不明白。 命令列表:
g++test.cpp-O0;objdump-S a.out

class Base {
 public:
  Base() {}
  virtual void Get() { }
};

class Derivered : public Base {
 public:
  virtual void Get() { }
};

int main() {
  Base* base = new Derivered();
  base->Get();
  return 0;
}
080486fe:
80486fe:55推力%ebp
80486ff:89 e5移动百分比esp,%ebp
8048701:ba d4 87 04 08 mov$0x80487d4,%edx
8048706:8b 45 08 mov 0x8(%ebp),%eax
8048709:89 10 mov%edx,(%eax)

确保优化已关闭。您读过这篇文章吗?如果您打开优化,编译器很容易对函数调用进行设备化、内联,甚至消除它,就像在本文中一样,是的,优化已关闭。显示
objdump-h a.out的输出
确保优化已关闭。您读过吗?如果您打开优化,编译器很容易对函数调用进行设备化、内联,甚至消除它,就像在本上下文中一样,是的,优化已关闭。显示
objdump-h a.out的输出
080486fe <_ZN4BaseC1Ev>:
 80486fe:   55                      push   %ebp
 80486ff:   89 e5                   mov    %esp,%ebp
 8048701:   ba d4 87 04 08          mov    $0x80487d4,%edx
 8048706:   8b 45 08                mov    0x8(%ebp),%eax
 8048709:   89 10                   mov    %edx,(%eax)
080486fe <_ZN4BaseC1Ev>:
  80486fe:   55                      push   %ebp
  80486ff:   89 e5                   mov    %esp,%ebp
  8048701:   ba d4 87 04 08          mov    $0x80487d4,%edx
  8048706:   8b 45 08                mov    0x8(%ebp),%eax
  8048709:   89 10                   mov    %edx,(%eax)
push %ebp             ;- save frame pointer
mov %esp, %ebp        ;- mov esp-> ebp -ebp is frame pointer
mov $0x80487d4, %edx  ; load vptr address into edx
mov 0x8(%ebp), %eax   ; ld eax with address of this
mov %edx,(%eax)       ; store vptr in this byte 0