のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

debbuger natvis

  • intrinsic.natvis
  • liballoc.natvis
  • libcore.natvis
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="str">
    <DisplayString>{data_ptr,[length]s8}</DisplayString>
    <StringView>data_ptr,[length]s8</StringView>
    <Expand>
      <Item Name="[size]" ExcludeView="simple">length</Item>
      <ArrayItems>
        <Size>length</Size>
        <ValuePointer>data_ptr</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
  <Type Name="slice&lt;*&gt;">
    <DisplayString>{{ length={length} }}</DisplayString>
    <Expand>
      <Item Name="[size]" ExcludeView="simple">length</Item>
      <ArrayItems>
        <Size>length</Size>
        <ValuePointer>data_ptr</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
</AutoVisualizer>
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="alloc::vec::Vec&lt;*&gt;">
    <DisplayString>{{ size={len} }}</DisplayString>
    <Expand>
      <Item Name="[size]" ExcludeView="simple">len</Item>
      <Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
      <ArrayItems>
        <Size>len</Size>
        <ValuePointer>buf.ptr.pointer</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
  <Type Name="alloc::collections::vec_deque::VecDeque&lt;*&gt;">
    <DisplayString>{{ size={tail &lt;= head ? head - tail : buf.cap - tail + head} }}</DisplayString>
    <Expand>
      <Item Name="[size]" ExcludeView="simple">tail &lt;= head ? head - tail : buf.cap - tail + head</Item>
      <Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
      <CustomListItems>
        <Variable Name="i" InitialValue="tail" />

        <Size>tail &lt;= head ? head - tail : buf.cap - tail + head</Size>
        <Loop>
          <If Condition="i == head">
            <Break/>
          </If>
          <Item>buf.ptr.pointer[i]</Item>
          <Exec>i = (i + 1 == buf.cap ? 0 : i + 1)</Exec>
        </Loop>
      </CustomListItems>
    </Expand>
  </Type>
  <Type Name="alloc::collections::linked_list::LinkedList&lt;*&gt;">
    <DisplayString>{{ size={len} }}</DisplayString>
    <Expand>
      <LinkedListItems>
        <Size>len</Size>
        <HeadPointer>*(alloc::collections::linked_list::Node&lt;$T1&gt; **)&amp;head</HeadPointer>
        <NextPointer>*(alloc::collections::linked_list::Node&lt;$T1&gt; **)&amp;next</NextPointer>
        <ValueNode>element</ValueNode>
      </LinkedListItems>
    </Expand>
  </Type>
  <Type Name="alloc::string::String">
    <DisplayString>{*(char**)this,[vec.len]s8}</DisplayString>
    <StringView>*(char**)this,[vec.len]s8</StringView>
    <Expand>
      <Item Name="[size]" ExcludeView="simple">vec.len</Item>
      <Item Name="[capacity]" ExcludeView="simple">vec.buf.cap</Item>
      <ArrayItems>
        <Size>vec.len</Size>
        <ValuePointer>*(char**)this</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
</AutoVisualizer>
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="core::ptr::Unique&lt;*&gt;">
    <DisplayString>{{ Unique {pointer} }}</DisplayString>
    <Expand>
      <Item Name="[ptr]">pointer</Item>
    </Expand>
  </Type>
  <Type Name="core::ptr::Shared&lt;*&gt;">
    <DisplayString>{{ Shared {pointer} }}</DisplayString>
    <Expand>
      <Item Name="[ptr]">pointer</Item>
    </Expand>
  </Type>
  <Type Name="core::option::Option&lt;*&gt;">
    <DisplayString Condition="RUST$ENUM$DISR == 0x0">{{ None }}</DisplayString>
    <DisplayString Condition="RUST$ENUM$DISR == 0x1">{{ Some {__0} }}</DisplayString>
    <Expand>
      <Item Name="[size]" ExcludeView="simple">(ULONG)(RUST$ENUM$DISR != 0)</Item>
      <Item Name="[value]" ExcludeView="simple">__0</Item>
      <ArrayItems>
        <Size>(ULONG)(RUST$ENUM$DISR != 0)</Size>
        <ValuePointer>&amp;__0</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
  <Type Name="core::option::Option&lt;*&gt;" Priority="MediumLow">
    <DisplayString Condition="*(PVOID *)this == nullptr">{{ None }}</DisplayString>
    <DisplayString>{{ Some {($T1 *)this} }}</DisplayString>
    <Expand>
      <Item Name="[size]" ExcludeView="simple">(ULONG)(*(PVOID *)this != nullptr)</Item>
      <Item Name="[value]" ExcludeView="simple" Condition="*(PVOID *)this != nullptr">($T1 *)this</Item>
      <ArrayItems>
        <Size>(ULONG)(*(PVOID *)this != nullptr)</Size>
        <ValuePointer>($T1 *)this</ValuePointer>
      </ArrayItems>
    </Expand>
  </Type>
</AutoVisualizer>

github.com

書いてあった本:

実践Rust入門[言語仕様から開発手法まで]

実践Rust入門[言語仕様から開発手法まで]