Commit 2187893b authored by brettw's avatar brettw Committed by Commit bot

Improve Visual Studio debug visualizers

Links the native visualizers into the PDB so that Visual Studio will pick up the visualizers with no user action.

Adds visualizers for base::flat_set, base::flat_tree (these two had the info buried in several levels of tree), base::ManualConstructor (requires a cast), and base::Value (decodes the union).

Removes some aura visualizers. I didn't see these as adding much value.

Simplifies many of the other visualizers to only improve the summary and not list any <Expand> items. This causes VS to show the default expansion. Many of these seemed unhelpful and possibly confusing (converting gfx::Point's "x_" to "X"), dangerously misleading (converting Skia's rect which is left, top, right, button to use width, height format), and broken (GURL's components had typos and didn't work).

Review-Url: https://codereview.chromium.org/2895043002
Cr-Commit-Position: refs/heads/master@{#473767}
parent 4df44c0c
...@@ -1452,7 +1452,10 @@ component("base") { ...@@ -1452,7 +1452,10 @@ component("base") {
"userenv.lib", "userenv.lib",
"winmm.lib", "winmm.lib",
] ]
all_dependent_configs += [ ":base_win_linker_flags" ] all_dependent_configs += [
":base_win_linker_flags",
"//tools/win/DebugVisualizers:chrome",
]
} else if ((!is_nacl && !is_fuchsia) || is_nacl_nonsfi) { } else if ((!is_nacl && !is_fuchsia) || is_nacl_nonsfi) {
# Non-Windows. # Non-Windows.
deps += [ "//base/third_party/libevent" ] deps += [ "//base/third_party/libevent" ]
......
...@@ -280,6 +280,10 @@ component("wtf") { ...@@ -280,6 +280,10 @@ component("wtf") {
sources -= [ "ThreadingPthreads.cpp" ] sources -= [ "ThreadingPthreads.cpp" ]
cflags = [ "/wd4068" ] # Unknown pragma. cflags = [ "/wd4068" ] # Unknown pragma.
# Inject Visual Studio debug visualizers for our types into all targets
# that reference this.
all_dependent_configs = [ "//tools/win/DebugVisualizers:webkit" ]
} else { } else {
# Non-Windows. # Non-Windows.
sources -= [ sources -= [
......
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# The .natvis files define "native visualizers" for the Visual Studio debugger
# that allow one to define how custom types appear.
#
# One can use them by adding them to a project in visual studio, and they can
# be embedded in a project's PDB file using the undocumented linker flag
# /NATVIS. These configs would generally be added to all_dependent_configs
# on a target so all targets that link to them will reference the visualizers
# from their PDB files.
#
# See https://msdn.microsoft.com/en-us/library/jj620914.aspx for how they work.
#
# Since these only add ldflags, the targets themselves are not rebuilt when the
# natvis files are updated. To debug, erase the .pdb file and build to re-link.
assert(is_win)
config("chrome") {
ldflags = [ "/NATVIS:" + rebase_path("chrome.natvis", root_build_dir) ]
}
config("skia") {
ldflags = [ "/NATVIS:" + rebase_path("skia.natvis", root_build_dir) ]
}
config("webkit") {
ldflags = [ "/NATVIS:" + rebase_path("webkit.natvis", root_build_dir) ]
}
...@@ -4,65 +4,14 @@ ...@@ -4,65 +4,14 @@
<Type Name="gfx::Point"> <Type Name="gfx::Point">
<AlternativeType Name="gfx::PointF"/> <AlternativeType Name="gfx::PointF"/>
<DisplayString>({x_}, {y_})</DisplayString> <DisplayString>({x_}, {y_})</DisplayString>
<Expand>
<Item Name="X">x_</Item>
<Item Name="Y">y_</Item>
</Expand>
</Type> </Type>
<Type Name="gfx::Size"> <Type Name="gfx::Size">
<AlternativeType Name="gfx::SizeF"/> <AlternativeType Name="gfx::SizeF"/>
<DisplayString>({width_}, {height_})</DisplayString> <DisplayString>({width_}, {height_})</DisplayString>
<Expand>
<Item Name="Width">width_</Item>
<Item Name="Height">height_</Item>
</Expand>
</Type> </Type>
<Type Name="gfx::Rect"> <Type Name="gfx::Rect">
<AlternativeType Name="gfx::RectF"/> <AlternativeType Name="gfx::RectF"/>
<DisplayString>({origin_.x_}, {origin_.y_}) x ({size_.width_}, {size_.height_})</DisplayString> <DisplayString>({origin_.x_}, {origin_.y_}) x ({size_.width_}, {size_.height_})</DisplayString>
<Expand>
<Item Name="Left">origin_.x_</Item>
<Item Name="Top">origin_.y_</Item>
<Item Name="Width">size_.width_</Item>
<Item Name="Height">size_.height_</Item>
</Expand>
</Type>
<Type Name="aura::Window::Value">
<DisplayString>{name,s}: {value}</DisplayString>
<Expand/>
</Type>
<Type Name="aura::Window">
<DisplayString>{name_,s}</DisplayString>
<Expand>
<Item Name="Name">name_</Item>
<Item Name="Id">id_</Item>
<Item Name="Parent">parent_</Item>
<Item Name="Children">children_</Item>
<Item Name="Bounds">bounds_</Item>
<Item Name="Type">type_</Item>
<Item Name="Visible">visible_</Item>
<Item Name="Transparent">transparent_</Item>
<!--<Synthetic Name="Property Map">
<DisplayString>Size = {prop_map_._Mysize}</DisplayString>
<Expand>
<TreeItems>
<Size>prop_map_._Mysize</Size>
<HeadPointer>prop_map_._Myhead-&gt;_Parent</HeadPointer>
<LeftPointer>_Left</LeftPointer>
<RightPointer>_Right</RightPointer>
<ValueNode Condition="_Isnil == 0">_Myval.second</ValueNode>
</TreeItems>
</Expand>
</Synthetic>-->
<Item Name="Layer">layer_</Item>
</Expand>
</Type>
<Type Name="scoped_ptr&lt;*,*&gt;">
<DisplayString Condition="impl_.data_.ptr == 0">null</DisplayString>
<DisplayString>{impl_.data_.ptr}</DisplayString>
<Expand>
<ExpandedItem>impl_.data_.ptr</ExpandedItem>
</Expand>
</Type> </Type>
<Type Name="scoped_refptr&lt;*&gt;"> <Type Name="scoped_refptr&lt;*&gt;">
<DisplayString Condition="ptr_ == 0">null</DisplayString> <DisplayString Condition="ptr_ == 0">null</DisplayString>
...@@ -182,89 +131,48 @@ ...@@ -182,89 +131,48 @@
</Type> </Type>
<Type Name="GURL"> <Type Name="GURL">
<DisplayString>{spec_}</DisplayString> <DisplayString>{spec_}</DisplayString>
<Expand>
<Item Name="Spec">spec_</Item>
<Item Name="IsValid">is_valid_</Item>
<Synthetic Name="Scheme">
<DisplayString
Condition="parsed_.scheme.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.scheme.begin][</DisplayString>
</Synthetic>
<Synthetic Name="Username">
<DisplayString
Condition="parsed_.username.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.username.begin][</DisplayString>
</Synthetic>
<Synthetic Name="Password">
<DisplayString
Condition="parsed_.password.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.password.begin][</DisplayString>
</Synthetic>
<Synthetic Name="Host">
<DisplayString
Condition="parsed_.host.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.host.begin][</DisplayString>
</Synthetic>
<Synthetic Name="Port">
<DisplayString
Condition="parsed_.port.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.port.begin][</DisplayString>
</Synthetic>
<Synthetic Name="Path">
<DisplayString
Condition="parsed_.path.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.path.begin][</DisplayString>
</Synthetic>
<Synthetic Name="Query">
<DisplayString
Condition="parsed_.query.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.query.begin][</DisplayString>
</Synthetic>
<Synthetic Name="Ref">
<DisplayString Condition="parsed_.ref.len==-1">undefined</DisplayString>
<DisplayString>spec_._Myres[parsed_.ref.begin][</DisplayString>
</Synthetic>
</Expand>
</Type>
<Type Name="base::Value">
<DisplayString>{type_}</DisplayString>
<Expand>
<Item Name="Type">type_</Item>
</Expand>
</Type> </Type>
<Type Name="base::Value"> <Type Name="base::ManualConstructor&lt;*&gt;">
<DisplayString>Fundamental</DisplayString> <!-- $T1 expands to the first "*" in the name which is the template
<Expand> type. Use that to cast to the correct value. -->
<ExpandedItem>(base::Value*)this,nd</ExpandedItem> <DisplayString>{*($T1*)space_.data_}</DisplayString>
<Item Name="Int">integer_value_</Item>
<Item Name="Bool">boolean_value_</Item>
<Item Name="Double">double_value_</Item>
</Expand>
</Type>
<Type Name="base::Value">
<DisplayString>String ({value_})</DisplayString>
<Expand> <Expand>
<ExpandedItem>(base::Value*)this,nd</ExpandedItem> <ExpandedItem>*($T1*)space_.data_</ExpandedItem>
<Item Name="Value">value_</Item>
</Expand> </Expand>
</Type> </Type>
<Type Name="base::BinaryValue"> <Type Name="base::internal::flat_tree&lt;*&gt;">
<DisplayString>Binary ({size_} byte(s))</DisplayString> <AlternativeType Name="base::flat_set&lt;*&gt;"/>
<DisplayString>{impl_.body_}</DisplayString>
<Expand> <Expand>
<ExpandedItem>(base::Value*)this,nd</ExpandedItem> <ExpandedItem>impl_.body_</ExpandedItem>
<Item Name="Data">buffer_</Item>
</Expand> </Expand>
</Type> </Type>
<Type Name="base::DictionaryValue"> <Type Name="base::flat_map&lt;*&gt;">
<DisplayString>Dictionary ({dictionary_._Mysize} entries)</DisplayString> <DisplayString>{impl_.body_}</DisplayString>
<Expand> <Expand>
<ExpandedItem>dictionary_</ExpandedItem> <ExpandedItem>impl_.body_</ExpandedItem>
</Expand> </Expand>
</Type> </Type>
<Type Name="base::ListValue"> <Type Name="base::Value">
<DisplayString>List ({list_._Mysize} entries)</DisplayString> <DisplayString Condition="type_ == NONE">NONE</DisplayString>
<Expand> <DisplayString Condition="type_ == BOOLEAN">BOOLEAN {bool_value_}</DisplayString>
<ExpandedItem>list_</ExpandedItem> <DisplayString Condition="type_ == INTEGER">INTEGER {int_value_}</DisplayString>
</Expand> <DisplayString Condition="type_ == DOUBLE">DOUBLE {double_value_}</DisplayString>
</Type> <DisplayString Condition="type_ == STRING">STRING {string_value_}</DisplayString>
</AutoVisualizer> <DisplayString Condition="type_ == BINARY">BINARY {binary_value_}</DisplayString>
\ No newline at end of file <DisplayString Condition="type_ == DICTIONARY">DICTIONARY {dict_}</DisplayString>
<DisplayString Condition="type_ == LIST">LIST {list_}</DisplayString>
<Expand>
<Item Name="[type]">type_</Item>
<Item Condition="type_ == BOOLEAN" Name="[boolean]">bool_value_</Item>
<Item Condition="type_ == INTEGER" Name="[integer]">int_value_</Item>
<Item Condition="type_ == DOUBLE" Name="[double]">double_value_</Item>
<Item Condition="type_ == STRING" Name="[string]">string_value_</Item>
<Item Condition="type_ == BINARY" Name="[binary]">binary_value_</Item>
<!-- Put the members for dictionary and list directly inline without
requiring a separate expansion to view. -->
<ExpandedItem Condition="type_ == DICTIONARY">dict_</ExpandedItem>
<ExpandedItem Condition="type_ == LIST">list_</ExpandedItem>
</Expand>
</Type>
</AutoVisualizer>
...@@ -4,35 +4,15 @@ ...@@ -4,35 +4,15 @@
<Type Name="SkPoint"> <Type Name="SkPoint">
<AlternativeType Name="SkIPoint"/> <AlternativeType Name="SkIPoint"/>
<DisplayString>({fX}, {fY})</DisplayString> <DisplayString>({fX}, {fY})</DisplayString>
<Expand>
<Item Name="X">fX</Item>
<Item Name="Y">fY</Item>
</Expand>
</Type> </Type>
<Type Name="SkSize"> <Type Name="SkSize">
<DisplayString>({fWidth}, {fHeight})</DisplayString> <DisplayString>({fWidth}, {fHeight})</DisplayString>
<Expand>
<Item Name="Width">fWidth</Item>
<Item Name="Height">fHeight</Item>
</Expand>
</Type> </Type>
<Type Name="SkRect"> <Type Name="SkRect">
<AlternativeType Name="SkIRect"/> <AlternativeType Name="SkIRect"/>
<DisplayString>({fLeft}, {fTop}) x ({fRight - fLeft}, {fBottom - fTop})</DisplayString> <DisplayString>({fLeft}, {fTop}), ({fRight}, {fBottom})</DisplayString>
<Expand>
<Item Name="Left">fLeft</Item>
<Item Name="Top">fTop</Item>
<Item Name="Right">fRight</Item>
<Item Name="Bottom">fBottom</Item>
<Synthetic Name="Width">
<DisplayString>{fRight - fLeft}</DisplayString>
</Synthetic>
<Synthetic Name="Height">
<DisplayString>{fBottom - fTop}</DisplayString>
</Synthetic>
</Expand>
</Type> </Type>
<Type Name="LogFontTypeface"> <Type Name="LogFontTypeface">
<DisplayString>{fLogFont.lfFaceName,su}</DisplayString> <DisplayString>{fLogFont.lfFaceName,su}</DisplayString>
</Type> </Type>
</AutoVisualizer> </AutoVisualizer>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment