$ gdb a.exe GNU gdb(GDB) 7.6.1 Copyright(C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "mingw32". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from F:\zkangHUST\C++\a.exe...done. (gdb) start Temporary breakpoint 1 at 0x40146e: file test3.cpp, line 32. Starting program: F:\zkangHUST\C++/a.exe [New Thread 10860.0x2e0c] [New Thread 10860.0x3e64] [New Thread 10860.0x3e94] [New Thread 10860.0x8] Temporary breakpoint 1, main () at test3.cpp:32 32 A a; (gdb) n 33 B b; (gdb) 51return0; (gdb) p a $1 = {_vptr.A = 0x405178 <vtable for A+8>, a = 4194432} (gdb) p (int*)*((int*)0x405178) $2 = (int *) 0x403c08 <A::f()> (gdb) p (int*)*((int*)0x405178 + 1) $3 = (int *) 0x403c3c <A::g()> (gdb) p (int*)*((int*)0x405178 + 2) $4 = (int *) 0x0 (gdb) p b $5 = {<A> = {_vptr.A = 0x405188 <vtable for B+8>, a = 4200896}, b = 0} (gdb) p (int*)*((int*)0x405188) $6 = (int *) 0x403ca0 <B::f()> (gdb) p (int*)*((int*)0x405188+1) $7 = (int *) 0x403c3c <A::g()> (gdb) p (int*)*((int*)0x405188+2) $8 = (int *) 0x403cd4 <B::g1()> (gdb) p (int*)*((int*)0x405188+3) $9 = (int *) 0x3a434347 (gdb)