vtable in polymorphic class of C++ using gdb [duplicate]

佐手、 提交于 2019-11-27 06:04:43

问题


How to display vtable using a pointer to base class object having virtual functions?


回答1:


Did you try set print object on ?

(gdb) help set print object
Set printing of object's derived type based on vtable info.



回答2:


If you have a sufficiently new version of gdb, you may want to look at the "info vtbl" command (or perhaps it is called "info vtable"; my own version of gdb is not sufficiently new, and so I cannot test the feature out myself).

I only noticed the feature when googling for an answer to this question and I noticed posts to the gdb mailing list circa 2012, notably this one from March 2012:

http://permalink.gmane.org/gmane.comp.gdb.patches/73957



来源:https://stackoverflow.com/questions/2529561/vtable-in-polymorphic-class-of-c-using-gdb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!