简体   繁体   English

Visual C ++调试器可视化工具?

[英]Visual C++ debugger visualizer?

How does Visual Studio show the elements of a vector, or the characters of a string, in C++? Visual Studio如何在C ++中显示向量的元素或字符串的字符? Is there a way for me to make it show my own classes in a custom way? 有没有办法让我以自定义方式展示自己的课程?

http://msdn.microsoft.com/en-us/library/zf0e8s14(v=VS.100).aspx http://msdn.microsoft.com/en-us/library/zf0e8s14(v=VS.100).aspx

For native code, you can add custom data type expansions to the file autoexp.dat, which is located in the Program Files\\Microsoft Visual Studio 10.0\\Common7\\Packages\\Debugger directory. 对于本机代码,您可以将自定义数据类型扩展添加到文件autoexp.dat,该文件位于Program Files \\ Microsoft Visual Studio 10.0 \\ Common7 \\ Packages \\ Debugger目录中。 Instructions on how to write autoexp rules are located in the file itself. 有关如何编写autoexp规则的说明位于文件本身中。

For this class: 对于这堂课:

template<class T>
struct  auto_array {
     T* data;
     int Len;
};

the autoexp.data might look like: autoexp.data可能如下所示:

auto_array<*> {
    children
    (
        #array
        (
            expr :      $e.Data[$i],
            size :      $e.Len
        )
    )
    preview
    (
        #(
            "[", $e.Len , "](",
            #array
            (
                expr :  $e.Data[$i],
                size :  $e.Len
            ),
            ")"
        )
    )
}

KindDragon reports that Visual Studio 2012 uses a new file format: natvis KindDragon报告Visual Studio 2012使用新的文件格式: natvis

You can add visualizers for custom C++ types to the autoexp.dat file. 您可以将自定义C ++类型的可视化工具添加到autoexp.dat文件中。 The format used in the file and the location change from version to version of Visual Studio but if you Google for autoexp.dat you should find some examples of how to customize it. 文件中使用的格式和位置从Visual Studio的版本更改为版本,但如果您使用Google for autoexp.dat,则应该找到一些如何自定义它的示例。

对于VS2017 / 2015,使用Natvis可视化在Visual Studio调试器中创建本机对象的自定义视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM