Visual C++转储类层次结构的编译器选项

发布于 2024-09-05 16:31:28 字数 76 浏览 5 评论 0原文

MS Visual C++ 中是否有相当于 GCC 的 -fdump-class-hierarchy 的编译器选项?即显示虚拟功能表布局。

Is there any compiler option in MS Visual C++ equivalent to GCC's -fdump-class-hierarchy? i.e. showing the virtual function table layout.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

奶气 2024-09-12 16:31:28

尝试

cl.exe /d1reportAllClassLayout test.cpp

输出类似于:

class request_handlerAttribute  size(8):
        +---
 0      | name
 4      | sdl
        +---



class perfmonAttribute  size(8):
        +---
 0      | name
 4      | register
        |  (size=3)
        +---

发现正在做:

+ findstr /i class c1xx.dll > c1xx.txt
+ and then manually inspecting c1xx.txt

希望它能有所帮助,
Benedetto

PS:这显然是一个未记录且不受支持的开关。
另请参阅此处 对于类似的开关。

try

cl.exe /d1reportAllClassLayout test.cpp

The output is something like:

class request_handlerAttribute  size(8):
        +---
 0      | name
 4      | sdl
        +---



class perfmonAttribute  size(8):
        +---
 0      | name
 4      | register
        |  (size=3)
        +---

Found doing:

+ findstr /i class c1xx.dll > c1xx.txt
+ and then manually inspecting c1xx.txt

Hope it can help,
Benedetto

PS: This obviously is an undocumented and unsupported switch.
Look also here for a similar switch.

公布 2024-09-12 16:31:28

我很确定没有任何记录在案的开关。如果您稍微查看一下 cl.exe,您可以找到各种字符串,其中一些似乎与命令行选项相关。其中之一是这样的:“分区(选项 = %s)\0nul\0map\0ast”。

这个“ast”可能指的是一个抽象语法树,这可能意味着编译器的 AST 的某种转储是可能的——但我还没有真正仔细查看任何细节来弄清楚它在谈论什么、目标是什么,或者还有很多其他的事情。就此而言,“ast”和“options =”可能根本不相关。即使它可以转储 AST,也不一定意味着它可以告诉您有关 vtable 布局的任何信息。

长话短说,有足够多的因素使得很难真正确定地排除这一可能性。同时,那里的信息还不够多,除了暗示编译器可能具有转储某些内部结构的某种未记录的能力这一模糊可能性之外,还需要做更多的工作。

I'm quite certain there's not any documented switch. If you do a bit of looking at cl.exe, you can find various strings, some of which appear to be related to command line options. One of those says something like: "Partitioning (options = %s)\0nul\0map\0ast".

That "ast" may refer to an abstract syntax tree, which may imply that some sort of dump of the compiler's AST is possible -- but I haven't really looked in any detail to figure out what it's talking about, aimed at, or much of anything else. For that matter, the "ast" and "options = " may not be related at all. Even if it can dump ASTs, that doesn't necessarily mean it can tell you anything about vtable layout.

To make a long story short, there's enough there to make it difficult to rule out with real certainty. At the same time, there's little enough there that it would take a lot more work to do more than hint at the vague possibility that the compiler may have some undocumented ability to dump some internal structures.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文