Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding mutex, ranges, functional, any and format visualizers #2191

Merged
merged 20 commits into from
Jul 11, 2022
Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 239 additions & 6 deletions stl/debugger/STL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -1665,9 +1665,8 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
<Expand/>
</Type>


<!-- VC 2015 -->
<Type Name="std::recursive_mutex">
<Type Name="std::mutex">
<AlternativeType Name="std::recursive_mutex"/>
<DisplayString Condition="sizeof(void *) == 4u &amp;&amp; *(int *)((char *)(&amp;_Mtx_storage) + 44) == 0">unlocked</DisplayString>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<DisplayString Condition="sizeof(void *) == 4u &amp;&amp; *(int *)((char *)(&amp;_Mtx_storage) + 44) != 0">locked</DisplayString>
<DisplayString Condition="sizeof(void *) == 8u &amp;&amp; *(int *)((char *)(&amp;_Mtx_storage) + 76) == 0">unlocked</DisplayString>
Expand All @@ -1680,6 +1679,53 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
</Expand>
</Type>

<Type Name="std::timed_mutex">
<AlternativeType Name="std::recursive_timed_mutex"/>
<DisplayString>{_My_mutex}</DisplayString>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<Expand>
<Item Name="[internal_locking_thread_id]" Condition="sizeof(void *) == 4u &amp;&amp; *(int *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 44) != 0">*(long *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 40)</Item>
<Item Name="[internal_locking_thread_id]" Condition="sizeof(void *) == 8u &amp;&amp; *(int *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 76) != 0">*(long *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 72)</Item>
<Item Name="[internal_ownership_levels]" Condition="sizeof(void *) == 4u &amp;&amp; *(int *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 44) != 0">*(int *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 44)</Item>
<Item Name="[internal_ownership_levels]" Condition="sizeof(void *) == 8u &amp;&amp; *(int *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 76) != 0">*(int *)((char *)(&amp;(_My_mutex._Mtx_storage)) + 76)</Item>
<Item Name="[locking_thread_id]" Optional="true">_My_owner</Item>
<Item Name="[ownership_levels]" Optional="true">_My_locked</Item>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
</Expand>
AnjuDel marked this conversation as resolved.
Show resolved Hide resolved
</Type>

<Type Name="std::lock_guard&lt;*&gt;">
<DisplayString>{_My_mutex}</DisplayString>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
</Type>

<Type Name="std::unique_lock&lt;*&gt;">
<DisplayString>{*_Pmtx}</DisplayString>
<Expand>
<Item Name="owns">_Owns</Item>
</Expand>
</Type>

<Type Name="std::scoped_lock&lt;*&gt;">
<DisplayString>{_MyMutex}</DisplayString>
</Type>

<Type Name="std::scoped_lock&lt;*,*&gt;">
<DisplayString>{_MyMutexes}</DisplayString>
</Type>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved

<Type Name="std::defer_lock_t">
<DisplayString>defer lock</DisplayString>
</Type>

<Type Name="std::try_to_lock_t">
<DisplayString>try to lock</DisplayString>
</Type>

<Type Name="std::adopt_lock_t">
<DisplayString>adopt lock</DisplayString>
</Type>

<Type Name="std::once_flag">
<DisplayString>{(int)_Opaque}</DisplayString>
AnjuDel marked this conversation as resolved.
Show resolved Hide resolved
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
</Type>

<!-- VC 2015 -->
<Type Name="std::_Associated_state&lt;*&gt;">
Expand Down Expand Up @@ -1886,6 +1932,32 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
</Expand>
</Type>

<Type Name="std::ranges::view_interface&lt;*&gt;">
<DisplayString>{{ size={size()} }}</DisplayString>
<Expand>
<Item Optional="true" Name="empty">empty()</Item>
<Item Optional="true" Name="front">front()</Item>
<Item Optional="true" Name="back">back()</Item>
<Item Optional="true" Name="data">data()</Item>
</Expand>
</Type>

<Type Name="std::ranges::dangling">
<DisplayString>dangling</DisplayString>
</Type>

<Type Name="std::ranges::common_view&lt;*&gt;">
<DisplayString>{_Base}</DisplayString>
</Type>

<Type Name="std::ranges::istream_view&lt;*&gt;">
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<AlternativeType Name="std::ranges::basic_istream_view&lt;*&gt;"/>
<DisplayString>{_Stream}</DisplayString>
<Expand>
<Item Name="Val">_Val</Item>
</Expand>
</Type>

<Type Name="std::ranges::_Ioterator&lt;*&gt;">
<SmartPointer Usage="Minimal">&amp;_Current,na</SmartPointer>
<Expand>
Expand All @@ -1900,10 +1972,26 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
</Expand>
</Type>

<Type Name="std::ranges::ref_view&lt;*&gt;">
<DisplayString>{*_Range}</DisplayString>
<Type Name="std::ranges::take_while_view&lt;*&gt;">
<AlternativeType Name="std::ranges::drop_while_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::drop_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::join_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::transform_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::split_view&lt;*&gt;"/>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<AlternativeType Name="std::ranges::lazy_split_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::reverse_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::elements_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::keys_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::values_view&lt;*&gt;"/>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<AlternativeType Name="std::ranges::take_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::ref_view&lt;*&gt;"/>
<AlternativeType Name="std::ranges::filter_view&lt;*&gt;"/>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<DisplayString>{_Range}</DisplayString>
<Expand>
<ExpandedItem>*_Range</ExpandedItem>
<Item Optional="true" Name="Pred">_Pred</Item>
<Item Optional="true" Name="Count">_Count</Item>
<Item Optional="true" Name="Fun">_Fun</Item>
<Item Optional="true" Name="Pattern">_Pattern</Item>
</Expand>
</Type>

Expand Down Expand Up @@ -1955,4 +2043,149 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
<Expand/>
</Type>

<Type Name="std::formatter&lt;*,*&gt;">
<DisplayString>{_Specs._Dynamic_width_index}, {_Specs._Dynamic_precision_index}</DisplayString>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<Expand>
<Item Name="Dynamic width index">_Specs._Dynamic_width_index</Item>
<Item Name="Dynamic precision index">_Specs._Dynamic_precision_index</Item>
<Item Name="Width index">_Specs._Width</Item>
<Item Name="Precision index">_Specs._Precision</Item>
<Item Name="Width index">_Specs._Type</Item>
<Item Name="Precision index">_Specs._Alignment</Item>
<Item Name="Width index">_Specs._Sgn</Item>
<Item Name="Precision index">_Specs._Alt</Item>
<Item Name="Width index">_Specs._Localized</Item>
<Item Name="Precision index">_Specs._Leading_zero</Item>
<Item Name="Width index">_Specs._Fill_length</Item>
<Item Name="Precision index">_Specs._Fill</Item>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
</Expand>
</Type>

<Type Name="std::basic_format_parse_context&lt;*&gt;">
<DisplayString>{_Format_string}</DisplayString>
<Expand>
<Item Name="Arguments">_Num_args</Item>
<Item Name="Next arg id">_Next_arg_id</Item>
</Expand>
</Type>

<Type Name="std::basic_format_args&lt;*&gt;">
<DisplayString>Num args:{_Num_args}</DisplayString>
<Expand>
<Item Name="Type">_Index_array->_Type_</Item>
AnjuDel marked this conversation as resolved.
Show resolved Hide resolved
<IndexListItems>
<Size>_Num_args</Size>
<ValueNode Condition="_Index_array[$i]._Type_ == 1">
*(reinterpret_cast&lt;const int*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 2">
*(reinterpret_cast&lt;const unsigned int*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 3">
*(reinterpret_cast&lt;const long long*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 4">
*(reinterpret_cast&lt;const unsigned long long*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 5">
*(reinterpret_cast&lt;const bool*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 6">
*(reinterpret_cast&lt;const unsigned char*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 7">
*(reinterpret_cast&lt;const float*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 8">
*(reinterpret_cast&lt;const double*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 9">
*(reinterpret_cast&lt;const long double*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 10">
(void*)(*(reinterpret_cast&lt;const unsigned char*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index))
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 11">
reinterpret_cast&lt;char*&gt;(*((reinterpret_cast&lt;const long long *&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)+0))
</ValueNode>
<ValueNode Condition="_Index_array[$i]._Type_ == 12">
reinterpret_cast&lt;char*&gt;(*((reinterpret_cast&lt;const long long *&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index)+0))
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
</ValueNode>
<ValueNode>reinterpret_cast&lt;const unsigned char*&gt;(_Index_array + _Num_args) + _Index_array[$i]._Index</ValueNode>
</IndexListItems>
</Expand>
</Type>

<Type Name="std::basic_format_arg&lt;*&gt;">
<DisplayString Condition="_Active_state == 0">No state: {_No_state}</DisplayString>
<DisplayString Condition="_Active_state == 1">Int state: {_Int_state}</DisplayString>
<DisplayString Condition="_Active_state == 2">UInt state: {_UInt_state}</DisplayString>
<DisplayString Condition="_Active_state == 3">Long long state: {_Long_long_state}</DisplayString>
<DisplayString Condition="_Active_state == 4">ULong long state: {_ULong_long_state}</DisplayString>
<DisplayString Condition="_Active_state == 5">Bool state: {_Bool_state}</DisplayString>
<DisplayString Condition="_Active_state == 6">Char state: {_Char_state}</DisplayString>
<DisplayString Condition="_Active_state == 7">Float state: {_Float_state}</DisplayString>
<DisplayString Condition="_Active_state == 8">Double state: {_Double_state}</DisplayString>
<DisplayString Condition="_Active_state == 9">Long double state: {_Long_double_state}</DisplayString>
<DisplayString Condition="_Active_state == 10">Pointer state: {_Pointer_state}</DisplayString>
<DisplayString Condition="_Active_state == 11">CString state: {_CString_state}</DisplayString>
<DisplayString Condition="_Active_state == 12">String state: {_String_state}</DisplayString>
<DisplayString Condition="_Active_state == 13">Custom state: {_Custom_state}</DisplayString>
<DisplayString Condition="_Active_state >= 14">Active state: {_Active_state}</DisplayString>
</Type>

<Type Name="std::basic_format_context&lt;*&gt;">
<DisplayString>{_Args}</DisplayString>
<Expand>
<Item Name="Iterator">_OutputIt</Item>
<Item Name="Loc">_Loc</Item>
</Expand>
</Type>

<Type Name="std::exception">
<DisplayString>{what()}</DisplayString>
AnjuDel marked this conversation as resolved.
Show resolved Hide resolved
</Type>

<Type Name="std::function&lt;*&gt;">
<DisplayString>{target_type().name()}</DisplayString>
</Type>

<Type Name="std::default_searcher&lt;*&gt;">
<AlternativeType Name="std::boyer_moore_searcher&lt;*&gt;" />
<AlternativeType Name="std::boyer_moore_horspool_searcher&lt;*&gt;" />
<DisplayString>{_Data}</DisplayString>
</Type>

<Type Name="std::any">
<Intrinsic Name="has_value" Expression="_Storage._TypeData != 0"/>
<Intrinsic Name="_Rep" Expression="_Storage._TypeData &amp; _Rep_mask"/>
<Intrinsic Name="type" Expression="(const type_info*)(_Storage._TypeData &amp; ~_Rep_mask)"/>
<Intrinsic Name="_Is_trivial" Expression="has_value() &amp;&amp; _Rep() == 0"/>
<Intrinsic Name="_Is_big" Expression="has_value() &amp;&amp; _Rep() == 1"/>
<Intrinsic Name="_Is_small" Expression="has_value() &amp;&amp; _Rep() == 2"/>
<DisplayString Condition="!has_value()">[empty]</DisplayString>
<DisplayString Condition="_Is_trivial() || _Is_small()">[not empty (Small)]</DisplayString>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
<DisplayString Condition="_Is_big()">[not empty (Large)]</DisplayString>
<Expand>
<Item Name="[castable_ptr]" Condition="_Is_trivial()">(void*)(&amp;_Storage._TrivialData)</Item>
<Item Name="[castable_ptr]" Condition="_Is_small()">(void*)(&amp;_Storage._SmallStorage._Data)</Item>
<Item Name="[castable_ptr]" Condition="_Is_big()">(void*)(_Storage._BigStorage._Ptr)</Item>
<Synthetic Name="has_value">
<DisplayString>{has_value()}</DisplayString>
</Synthetic>
<Synthetic Name="type" Condition="has_value()">
<DisplayString>{type()}</DisplayString>
</Synthetic>
<Synthetic Name="[representation]" Condition="_Is_trivial()">
<DisplayString>(Small/Trivial Object)</DisplayString>
strega-nil-ms marked this conversation as resolved.
Show resolved Hide resolved
</Synthetic>
<Synthetic Name="[representation]" Condition="_Is_small()">
<DisplayString>(Small Object)</DisplayString>
</Synthetic>
<Synthetic Name="[representation]" Condition="_Is_big()">
<DisplayString>(Dynamic Allocation)</DisplayString>
</Synthetic>
</Expand>
</Type>

</AutoVisualizer>