From ab3e21d12b58190bf6ffa9f9bbab8e81bb286af2 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Tue, 5 Jul 2022 13:12:36 -0700 Subject: [PATCH 1/3] .natvis: Add view for unique_ptr/vector of chars This PR adds .natvis entries using `std::unique_ptr`/`std::vector` to hold various character types so that these are displayed as null terminated strings instead as generic arrays. This is useful when debugging code that uses one of these types as a character buffer, for example in order to call a Windows API. NOTE: For std::vector, I considered setting the display string to use `[size()]` or similar as a format specifier in order to better handle the case that the string wasn't null terminated. But this winds up with a worse result if it is null terminated, so I wound up deciding to leave it as-is. --- stl/debugger/STL.natvis | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/stl/debugger/STL.natvis b/stl/debugger/STL.natvis index 1a377d313d7..85f2a6e8b05 100644 --- a/stl/debugger/STL.natvis +++ b/stl/debugger/STL.natvis @@ -337,6 +337,18 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + + + + + {{empty}} + {_Mypair._Myval2} + _Mypair._Myval2 + + _Mypair._Myval2,hv + + default @@ -1182,6 +1194,27 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + + + + + + + + data() + {data(),na} (size = {size()}) + {{empty}} + + capacity() + _Mypair + + size() + data() + + + + _Ptr,na From 7113f40e70229e354d20b8b1d8d97fa15b099eae Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Wed, 6 Jul 2022 10:35:52 -0700 Subject: [PATCH 2/3] Add '[deleter]' --- stl/debugger/STL.natvis | 1 + 1 file changed, 1 insertion(+) diff --git a/stl/debugger/STL.natvis b/stl/debugger/STL.natvis index 85f2a6e8b05..c911976e21a 100644 --- a/stl/debugger/STL.natvis +++ b/stl/debugger/STL.natvis @@ -346,6 +346,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception {_Mypair._Myval2} _Mypair._Myval2 + _Mypair _Mypair._Myval2,hv From 917d25037f4d95fc37a854605a9aebd42e4bba20 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Wed, 6 Jul 2022 16:12:12 -0700 Subject: [PATCH 3/3] Add const versions --- stl/debugger/STL.natvis | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stl/debugger/STL.natvis b/stl/debugger/STL.natvis index c911976e21a..ef806a198e3 100644 --- a/stl/debugger/STL.natvis +++ b/stl/debugger/STL.natvis @@ -342,6 +342,11 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + + + + + {{empty}} {_Mypair._Myval2} _Mypair._Myval2