0

我正在尝试为以块形式存储值的容器制作调试器可视化工具。我想为值和块进行列表扩展,但据我所知,单一类型只能有一个列表扩展。可能有多Expand个子节点,ArrayItems但它们都产生单个列表。是的,我可以为容器进行块扩展,然后为每个块进行值扩展。但我想要两个具有如下扩展的容器子节点:

MyList
|-values
| |-0
| |-1
|
|-chunks
| |-0
| |-1

有没有办法使用 natvis xml 来做到这一点?

4

1 回答 1

0

You can use <Synthetic> for that. The code inside <Synthetic> can be for example <Item> or <ArrayItems>, but also any other item type.

<Type Name="MyList">
  <DisplayString>...</DisplayString>
  <Expand>
    <Synthetic Name="values">
      <DisplayString>...</DisplayString>
      <Expand>
        <!-- code for displaying as values -->
      </Expand>
    </Synthetic>
    <Synthetic Name="chunks">
      <DisplayString>...</DisplayString>
      <Expand>
        <!-- code for displaying as chunks-->
      </Expand>
    </Synthetic>
  </Expand>
</Type>
于 2021-01-03T12:16:58.680 回答