- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
{{ key={key} value={value}-6ren">
我正在为 Qt 类创建一个 natvis 文件,但遇到了问题。
为了可视化 QHash 对象,我创建了这两种类型:
<Type Name="QHashNode<*,*>">
<DisplayString Condition="next->next == 0">{{ key={key} value={value} h={h}}}</DisplayString>
<DisplayString>{{ key={key} value={value} h={h} withCollision }}</DisplayString>
<Expand>
<Item Name="NextNode">reinterpret_cast<QHashNode<$T1,$T2> *>(next)</Item>
</Expand>
</Type>
<Type Name="QHash<*,*>">
<DisplayString>{{ size={d->size} buckets={d->numBuckets} }}</DisplayString>
<Expand>
<IndexListItems>
<Size>d->numBuckets</Size>
<ValueNode Condition="reinterpret_cast<QHashNode<$T1,$T2> *>(d->buckets[$i]) != e">reinterpret_cast<QHashNode<$T1,$T2> *>(d->buckets[$i])</ValueNode>
</IndexListItems>
</Expand>
</Type>
它几乎可以工作,但是由于 QHash 在内存中不是连续的,所以有很多无效条目。条件
reinterpret_cast<QHashNode<
$T1,$T2> *>(d->buckets[$i]) != e
已经过滤掉那些无效的,但它们仍然显示为<Unable to display value>
.
有谁知道是否有办法完全跳过这些条目?
我从来没有真正使用过 autoexp.dat 文件,这是旧方法,但是在查看安装了 Qt 插件的文件时,在我看来该声明
#switch ($e.next != 0) #case 1 (
$e
)
确实如此,所以我希望在 natvis 文件中也有办法做到这一点?
如果有人有兴趣,我可以给你 natvis 文件,但我现在只有 QString、QByteArray、QList、QVector、QMap 和(有问题的)QHash。
最佳答案
根据MSDN page on writing type visualizers , <IndexListItems>
根据定义是连续的:
IndexListItems Expansion
ArrayItems assume array elements are laid out contiguously in memory. Debugger gets to the next element by simply incrementing its pointer to the current element. To support cases where you need to manipulate the index to the value node, index list items can be used. Here’s a visualizer using 'IndexListItems' node: [....] The only difference between ArrayItems and IndexListItems is that the 'ValueNode' expects the full expression to the ith element with the implicit '$i' parameter.
另外,我可以指点您the Qt Labs VSTools repository吗?和 its documentation ?特别是 tools/Qt4EEAddin/qt5.natvis
看起来很像我认为你要写的东西? (或者实际上你在写什么?^_^)不管怎样,我认为你能做的最好的就是qt5.natvis
中的内容。 ,它有一个特殊的 <DisplayString>
为空 QHashNodes
但不会尝试忽略 QHash
中的空桶.
关于c++ - Visual Studio 2012 Natvis 跳过 IndexListItems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13748209/
我从这里实现了元组:https://voidnish.wordpress.com/2013/07/13/tuple-implementation-via-variadic-templates/ 是否可
我们经常为枚举使用前缀。 在 NatVis 中显示全名非常冗长。 是否可以删除枚举名称的前缀(又名返回枚举名称的子字符串)? enum FooFormat { FooFormat_Foo, F
我正在尝试为部分专用类型创建 Visual Studio 调试可视化工具。例如,假设我有这样的东西: template struct Foo { T bar; }; template st
我正在尝试创建一个 .natvis Visual Studio 的文件。根据这个page我可以使用 $T1, $T2 引用模板参数等等。所以在 MyClass 的情况下$T1将引用类型 A .这行得通
natvis 中有没有一种方法可以将类型重新解释为已经由 natvis 定义的类型?还是别名? 例如,我想做这种“技巧”(在我的上下文中确实是必要的,即使这对您来说听起来很奇怪,这是 JIT 符号生成
我正在尝试为 uint32_t 类型定义一个 .natvis ,以显示为一个包含四个字符的数组,在调试期间,在 Watch 窗口中,它会被表示为一点像这样:(char*)&fourcc,4。 不幸的是
我刚刚了解了 Visual Studio 中的 .natvis 文件,并且一直在为我的 Ruby C++ 扩展项目设置一些文件。 http://msdn.microsoft.com/en-us/lib
昨天我发现MSVC's "Natvis" tool ,它允许您调整调试器以智能方式呈现您的类型。我很快开始美化我的数学库。 这是我的 3*3 矩阵类的外观(未初始化的数据): 很漂亮,对吧?我的下午没
我目前正在为 natvis 中的日期类型编写可视化工具。日期类型以通常的 unix 方式存储自 1970 年以来的秒数,但如果不使用临时变量,从中导出年、月和月的日期会非常冗长。我希望能够存储工作变量
假设我必须遵循结构: template struct TSH2SizedArray { inline void Add(const Type & Value); inline Type
我有一个类型定义为: typedef unsigned short StringChecksum; 我最终打算使用 NatVis 在我们加载到内存中的全局字符串表中显示相应的值。 所以我定义了一个新的
VS2013 中 shared_ptr 的默认可视化工具有这个(很多很多东西被删除了!): _Ptr 这意味着在调试器中,您必须展开 shared_ptr,然后展开 [ptr]
我无法在调试时对 VS2015 中的基本 std:string 有一个像样的 View 。我按照此地址给出的说明进行操作:https://msdn.microsoft.com/fr-fr/librar
我正在尝试使用在 natvis.xsd(natvis 模式文件)中定义的标签来编写 C# 或 C++ 代码来可视化类型。我找不到任何关于此的文档,所以我不确定它是如何工作的。特别是我需要为 Custo
我正在使用 Visual Studio 2017 为某些类编写可视化工具,但遇到了 .natvis 代码可读性方面的问题。我有一个自定义数组类型,我想在 Watch 窗口的 Value 字段中直接显示
我正在使用 VS Ultimate 2012 Update 5: Microsoft Visual Studio Ultimate 2012 版本 11.0.61219.00 更新 5 微软 .NET
我有一个自定义数据结构,其中包含一个 char* 缓冲区,该缓冲区具有两个关联的长度:最大长度和实际长度: struct MyData { char* data; int length;
我正在 Microsoft Visual Studio 2015 中使用 .natvis 文件编写调试器可视化工具。如果可能的话,我想在我的类(class)中获得一条信息。我想知道获取该变量的语法是什
我正在为 visual studio 2012 编写一个 natvis 文件,以帮助自定义调试时显示的内容。我正在尝试将 void* 转换为模板类,但我看到以下错误: Fatal error: Ele
我正在尝试在 Visual Studio 2013 调试器中显示一个矩阵类。该类(class)的相关部分是这样的: class mat { private: size_t rowdim, co
我是一名优秀的程序员,十分优秀!