From 25c0a66934375dc7ef8a7d7c8b5e13d716ba6057 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Mon, 10 Oct 2022 10:06:55 -0700 Subject: [PATCH] Natvis adjustments to make debugging bearable (#13237) ### Description - Fix Abseil::InlinedVector inlined storage visualization - Fix typo in protobuf natvis. - Add basic gsl.natvis ### Motivation and Context Debugging is hard. --- cmake/external/abseil-cpp.natvis | 28 +++++++++++++++++----------- cmake/external/gsl.natvis | 14 ++++++++++++++ cmake/external/onnx_protobuf.natvis | 2 +- cmake/onnxruntime_common.cmake | 6 +++++- 4 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 cmake/external/gsl.natvis diff --git a/cmake/external/abseil-cpp.natvis b/cmake/external/abseil-cpp.natvis index c9f3a93f24..dd74a92bce 100644 --- a/cmake/external/abseil-cpp.natvis +++ b/cmake/external/abseil-cpp.natvis @@ -1,19 +1,25 @@ - {{ size={ storage_.metadata_.value >> 1 } }} + + + + + {{ size={ _size() }}} - $T2 - storage_.data_.allocated.allocated_capacity + $T2 + storage_.data_.allocated.allocated_capacity $T2 - storage_.metadata_ - - storage_.metadata_.value >> 1 - (($T1 &)(storage_.data_.inlined.inlined_data[$i])) + _size() + _is_allocated() + storage_.metadata_ + + _size() + _inlined_data()[$i] - - storage_.metadata_.value >> 1 - storage_.data_.allocated.allocated_data[$i] + + _size() + _allocated_data()[$i] @@ -45,4 +51,4 @@ value.second - \ No newline at end of file + diff --git a/cmake/external/gsl.natvis b/cmake/external/gsl.natvis new file mode 100644 index 0000000000..5fbe9b9da1 --- /dev/null +++ b/cmake/external/gsl.natvis @@ -0,0 +1,14 @@ + + + + + {{ size={ _size() }}} + + _size() + + _size() + first_[$i] + + + + diff --git a/cmake/external/onnx_protobuf.natvis b/cmake/external/onnx_protobuf.natvis index ee32395d20..c0a6fec4db 100644 --- a/cmake/external/onnx_protobuf.natvis +++ b/cmake/external/onnx_protobuf.natvis @@ -192,7 +192,7 @@ - {{ elem_type={ *elem_type_ } }} + {{ elem_type={ *elem_type_ } }} elem_type_ _has_element_type() diff --git a/cmake/onnxruntime_common.cmake b/cmake/onnxruntime_common.cmake index 5b383ce27b..a4426d6713 100644 --- a/cmake/onnxruntime_common.cmake +++ b/cmake/onnxruntime_common.cmake @@ -115,7 +115,11 @@ if(NOT onnxruntime_DISABLE_ABSEIL) set(ABSEIL_NATVIS_FILE "abseil-cpp.natvis") target_sources( onnxruntime_common - INTERFACE $ + INTERFACE $) + set(GSL_NATVIS_FILE "gsl.natvis") + target_sources( + onnxruntime_common + INTERFACE $ ) endif() endif()