gpt4 book ai didi

visual-studio - Visual Studio 调试器提示和技巧(适用于 C/C++ 项目)

转载 作者:行者123 更新时间:2023-12-03 15:16:32 25 4
gpt4 key购买 nike

我对在 Visual Studio 的调试器中调试 C/C++ 项目的提示和技巧感兴趣。我最近发现,如果您有一个指向特定数据类型的指针,例如 char* ptr,那么您可以使用以下语法在监视窗口中将其视为数组:

ptr,10

这将显示 ptr 地址的前 10 个元素,其方式与定义如下时的显示方式相同:

字符指针[10];

关于 Visual Studio 调试器,您还知道哪些其他提示和技巧?

PS:我希望这个话题还没有被讨论过。如果你找到类似的帖子,请告诉我。

最佳答案

我真的很喜欢通过 调整类型和结构的调试器显示的可能性。 AutoExp.dat .该文件位于

..\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat



并允许定义自己的模板以在调试期间显示数据:

While debugging, Data Tips and items in the Watch and Variable windows are automatically expanded to show their most important elements. The expansion follows the format given by the rules in this file. You can add rules for your types or change the predefined rules.



该文件充满了很好的示例,您可以轻松地根据自己的需要调整某些模板或为自己的类添加新模板。

关于visual-studio - Visual Studio 调试器提示和技巧(适用于 C/C++ 项目),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/218056/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com