[llvm] r290224 - Improve natvis for llvm::SmallString so that it correctly displays only the valid portion of the string
Antonio Maiorano via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 17:05:29 PST 2016
Author: amaiorano
Date: Tue Dec 20 19:05:29 2016
New Revision: 290224
URL: http://llvm.org/viewvc/llvm-project?rev=290224&view=rev
Log:
Improve natvis for llvm::SmallString so that it correctly displays only the valid portion of the string
The usual method, and the one employed before my change, of displaying strings in natvis is to make use of the "<variable>,s" format specifier; however, this method only works for null-terminated strings. My fix here is to use the "<pointer>,[size]" format specifier to display a bounded array, and then cast it to "const char*", which in the MSVC debugger has the desired effect of rendering the character array as a string.
Differential Revision: https://reviews.llvm.org/D27972
Modified:
llvm/trunk/utils/LLVMVisualizers/llvm.natvis
Modified: llvm/trunk/utils/LLVMVisualizers/llvm.natvis
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/LLVMVisualizers/llvm.natvis?rev=290224&r1=290223&r2=290224&view=diff
==============================================================================
--- llvm/trunk/utils/LLVMVisualizers/llvm.natvis (original)
+++ llvm/trunk/utils/LLVMVisualizers/llvm.natvis Tue Dec 20 19:05:29 2016
@@ -56,8 +56,8 @@ For later versions of Visual Studio, no
</Expand>
</Type>
<Type Name="llvm::SmallString<*>">
- <DisplayString>{BeginX,s}</DisplayString>
- <StringView>BeginX,s</StringView>
+ <DisplayString>{(const char*)BeginX,[(char*)EndX - (char*)BeginX] na}</DisplayString>
+ <StringView>(const char*)BeginX,[(char*)EndX - (char*)BeginX]</StringView>
<Expand>
<Item Name="[size]">(char*)EndX - (char*)BeginX</Item>
<Item Name="[capacity]">(char*)CapacityX - (char*)BeginX</Item>
More information about the llvm-commits
mailing list