[英]Limit display of char* in natvis file to specific length
I've got a custom data structure holding a char*
buffer with two lengths associated: maximum and actual length: 我有一个自定义数据结构,其中包含两个相关长度的
char*
缓冲区:最大长度和实际长度:
struct MyData {
char* data;
int length;
int capacity;
};
In the Visual Studio (2015) debugger visualizer I only want to display the first length
elements of the data
buffer and not the (usually uninitialized) remaining elements. 在Visual Studio(2015)调试器可视化工具中,我只想显示
data
缓冲区的第一个length
元素,而不是(通常未初始化的)剩余元素。
I've the following rule in my custom .natvis
file for displaying my custom data structure: 我在自定义
.natvis
文件中有以下规则来显示我的自定义数据结构:
<Type Name="MyData">
<DisplayString>content="{data,su}" length={length}</DisplayString>
</Type>
Is it possible to only display data
as a " su
"-encoded string from data[0]
to data[length-1]
? 是否可以仅将
data
显示为从data[0]
到data[length-1]
的“ su
”编码字符串?
This will limit the length of the string in the debugger: 这将限制调试器中字符串的长度:
<Type Name="MyData">
<DisplayString>{data,[length]su}</DisplayString>
</Type>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.