简体   繁体   中英

How to make multiple list expansions for a single type using natvis Visual Studio C++ debugger visualizer

I'm trying to make debugger visualizer for container that stores values in chunks. I want to make list expansion both for values and for chunks, but as far as I can see single type can have only one list expansion. There may be multiple Expand subnodes like ArrayItems but they all produce single list. Yes, I can make chunks expansion for container and then make value expansion for each chunk. But I want two container subnodes with expandsions like this:

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

Is there a way to do it using natvis xml?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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