如何像编译器一样获取每个虚函数索引? [英] How to get every virtual function index just as the compiler does?
问题描述
是否有一些插件或工具可以读取.h文件(或简单地修改Intellisense本身)并吐出每个函数及其虚拟函数表索引?我还没有弄清楚与多态性有关的一种模式,当您开始有彼此衍生的5个或更多类时,它会变得困难5倍.但是,无论如何,MSVC ++编译器在编译从C ++到Assembly的虚拟函数调用时,总是会发出正确的虚拟函数表索引.必须有一种更好的方法来获取该索引,而无需加载,断点,读取偏移量和重写代码,对吧?
Is there some plugin or tool which can read a .h file (or simply modify Intellisense itself) and spit out every function and it's virtual function table index? There's a pattern which I have yet to figure out having to do with polymorphism, and it gets 5x harder when you start to have 5 classes or more deriving from each other. No matter what, though, the MSVC++ compiler always spits out the correct virtual function table index when it compiles the virtual function call from C++ to Assembly. There has to be a better way to get that index without loading, break-pointing, reading the offset, and rewriting the code, right?
谢谢!
推荐答案
使用隐藏的Microsoft C/C ++编译器选项"/d1 reportAllClassLayout".这将打印出所有类的内存布局和vtable.
Use the hidden Microsoft C/C++ compiler option "/d1 reportAllClassLayout". This will print out the memory layout and vtables of all your classes.
这篇关于如何像编译器一样获取每个虚函数索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!