]> git.lizzy.rs Git - rust.git/commitdiff
Modify type names on MSVC to make tuples .natvis compatible.
authorMaulingMonkey <git@maulingmonkey.com>
Thu, 25 Jun 2020 02:28:12 +0000 (19:28 -0700)
committerMaulingMonkey <git@maulingmonkey.com>
Thu, 25 Jun 2020 02:28:12 +0000 (19:28 -0700)
- Mangles (T0, T1) as tuple<T0, T1>, possibly unblocking rust-lang/rust#70052 "Update hashbrown to 0.8.0"
- Prettifies Rust tuples similar to VS2017's std::tuple
- Improves debuginfo test coverage

src/etc/natvis/intrinsic.natvis
src/librustc_codegen_ssa/debuginfo/type_names.rs
src/test/debuginfo/simple-tuple.rs
src/test/debuginfo/tuple-in-tuple.rs

index 1611d8660ef654699b9762b5841b6d49e0dd163a..874550da8b0c97b196d1371af91879ca54c39b74 100644 (file)
       </ArrayItems>
     </Expand>
   </Type>
+  <Type Name="tuple&lt;&gt;">
+    <DisplayString>()</DisplayString>
+  </Type>
+  <Type Name="tuple&lt;*&gt;">
+    <DisplayString>({__0})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*&gt;">
+    <DisplayString>({__0}, {__1})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+      <Item Name="[4]">__4</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+      <Item Name="[4]">__4</Item>
+      <Item Name="[5]">__5</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+      <Item Name="[4]">__4</Item>
+      <Item Name="[5]">__5</Item>
+      <Item Name="[6]">__6</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*,*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+      <Item Name="[4]">__4</Item>
+      <Item Name="[5]">__5</Item>
+      <Item Name="[6]">__6</Item>
+      <Item Name="[7]">__7</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*,*,*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+      <Item Name="[4]">__4</Item>
+      <Item Name="[5]">__5</Item>
+      <Item Name="[6]">__6</Item>
+      <Item Name="[7]">__7</Item>
+      <Item Name="[8]">__8</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*,*,*,*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8}, {__9})</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+      <Item Name="[4]">__4</Item>
+      <Item Name="[5]">__5</Item>
+      <Item Name="[6]">__6</Item>
+      <Item Name="[7]">__7</Item>
+      <Item Name="[8]">__8</Item>
+      <Item Name="[9]">__9</Item>
+    </Expand>
+  </Type>
+  <Type Name="tuple&lt;*,*,*,*,*,*,*,*,*,*,*&gt;">
+    <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8}, {__9}, ...)</DisplayString>
+    <Expand>
+      <Item Name="[0]">__0</Item>
+      <Item Name="[1]">__1</Item>
+      <Item Name="[2]">__2</Item>
+      <Item Name="[3]">__3</Item>
+      <Item Name="[4]">__4</Item>
+      <Item Name="[5]">__5</Item>
+      <Item Name="[6]">__6</Item>
+      <Item Name="[7]">__7</Item>
+      <Item Name="[8]">__8</Item>
+      <Item Name="[9]">__9</Item>
+      <Synthetic Name="[...]"><DisplayString>...</DisplayString></Synthetic>
+    </Expand>
+  </Type>
 </AutoVisualizer>
index a64489c04c81dc4e07df0656f11415f4c42b2060..20d440433cbb0bc4f5b27bc3f4490aabadecd39f 100644 (file)
@@ -47,7 +47,12 @@ pub fn push_debuginfo_type_name<'tcx>(
             push_type_params(tcx, substs, output, visited);
         }
         ty::Tuple(component_types) => {
-            output.push('(');
+            if cpp_like_names {
+                output.push_str("tuple<");
+            } else {
+                output.push('(');
+            }
+
             for component_type in component_types {
                 push_debuginfo_type_name(tcx, component_type.expect_ty(), true, output, visited);
                 output.push_str(", ");
@@ -56,7 +61,12 @@ pub fn push_debuginfo_type_name<'tcx>(
                 output.pop();
                 output.pop();
             }
-            output.push(')');
+
+            if cpp_like_names {
+                output.push('>');
+            } else {
+                output.push(')');
+            }
         }
         ty::RawPtr(ty::TypeAndMut { ty: inner_type, mutbl }) => {
             if !cpp_like_names {
index c2db5218e68422bf5f015deea7fe8e581ab69dd7..b7fcfeef090aa590dc4e41c63a68ba840323a14c 100644 (file)
 // lldbg-check:[...]$6 = { 0 = 15 1 = 16 }
 // lldbr-check:((i32, i16)) paddingAtEnd = { 0 = 15 1 = 16 }
 
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command:dx noPadding8,d
+// cdb-check:noPadding8,d [...]: (-100, 100) [Type: tuple<i8, u8>]
+// cdb-check:[...][0]              : -100 [Type: [...]]
+// cdb-check:[...][1]              : 100 [Type: [...]]
+// cdb-command:dx noPadding16,d
+// cdb-check:noPadding16,d [...]: (0, 1, 2) [Type: tuple<i16, i16, u16>]
+// cdb-check:[...][0]              : 0 [Type: [...]]
+// cdb-check:[...][1]              : 1 [Type: [...]]
+// cdb-check:[...][2]              : 2 [Type: [...]]
+// cdb-command:dx noPadding32,d
+// cdb-check:noPadding32,d [...]: (3, 4.5[...], 5) [Type: tuple<i32, f32, u32>]
+// cdb-check:[...][0]              : 3 [Type: [...]]
+// cdb-check:[...][1]              : 4.5[...] [Type: [...]]
+// cdb-check:[...][2]              : 5 [Type: [...]]
+// cdb-command:dx noPadding64,d
+// cdb-check:noPadding64,d [...]: (6, 7.5[...], 8) [Type: tuple<i64, f64, u64>]
+// cdb-check:[...][0]              : 6 [Type: [...]]
+// cdb-check:[...][1]              : 7.500000 [Type: [...]]
+// cdb-check:[...][2]              : 8 [Type: [...]]
+
+// cdb-command:dx internalPadding1,d
+// cdb-check:internalPadding1,d [...]: (9, 10) [Type: tuple<i16, i32>]
+// cdb-check:[...][0]              : 9 [Type: short]
+// cdb-check:[...][1]              : 10 [Type: int]
+// cdb-command:dx internalPadding2,d
+// cdb-check:internalPadding2,d [...]: (11, 12, 13, 14) [Type: tuple<i16, i32, u32, u64>]
+// cdb-check:[...][0]              : 11 [Type: [...]]
+// cdb-check:[...][1]              : 12 [Type: [...]]
+// cdb-check:[...][2]              : 13 [Type: [...]]
+// cdb-check:[...][3]              : 14 [Type: [...]]
+
+// cdb-command:dx paddingAtEnd,d
+// cdb-check:paddingAtEnd,d [...]: (15, 16) [Type: tuple<i32, i16>]
+// cdb-check:[...][0]              : 15 [Type: [...]]
+// cdb-check:[...][1]              : 16 [Type: [...]]
+
+
 #![allow(unused_variables)]
 #![allow(dead_code)]
 #![feature(omit_gdb_pretty_printer_section)]
index e0f940ca7a1c1c0bbb16f5bb6ce8ba7dd632c902..0447d8e9ddeb0d8d1caf255cf497b54d5de39cea 100644 (file)
 // lldbg-check:[...]$6 = { 0 = { 0 = 21 1 = 22 } 1 = 23 }
 // lldbr-check:(((i32, i16), i32)) padding_at_end2 = { 0 = { 0 = 21 1 = 22 } 1 = 23 }
 
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command:dx no_padding1,d
+// cdb-check:no_padding1,d [...]: ((0, 1), 2, 3) [Type: tuple<tuple<u32, u32>, u32, u32>]
+// cdb-check:[...][0]              : (0, 1) [Type: tuple<u32, u32>]
+// cdb-check:[...][1]              : 2 [Type: [...]]
+// cdb-check:[...][2]              : 3 [Type: [...]]
+// cdb-command:dx no_padding1.__0,d
+// cdb-check:no_padding1.__0,d [...]: (0, 1) [Type: tuple<u32, u32>]
+// cdb-check:[...][0]              : 0 [Type: [...]]
+// cdb-check:[...][1]              : 1 [Type: [...]]
+// cdb-command:dx no_padding2,d
+// cdb-check:no_padding2,d [...]: (4, (5, 6), 7) [Type: tuple<u32, tuple<u32, u32>, u32>]
+// cdb-check:[...][0]              : 4 [Type: [...]]
+// cdb-check:[...][1]              : (5, 6) [Type: tuple<u32, u32>]
+// cdb-check:[...][2]              : 7 [Type: [...]]
+// cdb-command:dx no_padding2.__1,d
+// cdb-check:no_padding2.__1,d [...]: (5, 6) [Type: tuple<u32, u32>]
+// cdb-check:[...][0]              : 5 [Type: [...]]
+// cdb-check:[...][1]              : 6 [Type: [...]]
+// cdb-command:dx no_padding3,d
+// cdb-check:no_padding3,d [...]: (8, 9, (10, 11)) [Type: tuple<u32, u32, tuple<u32, u32>>]
+// cdb-check:[...][0]              : 8 [Type: [...]]
+// cdb-check:[...][1]              : 9 [Type: [...]]
+// cdb-check:[...][2]              : (10, 11) [Type: tuple<u32, u32>]
+// cdb-command:dx no_padding3.__2,d
+// cdb-check:no_padding3.__2,d [...]: (10, 11) [Type: tuple<u32, u32>]
+// cdb-check:[...][0]              : 10 [Type: [...]]
+// cdb-check:[...][1]              : 11 [Type: [...]]
+
+// cdb-command:dx internal_padding1,d
+// cdb-check:internal_padding1,d [...]: (12, (13, 14)) [Type: tuple<i16, tuple<i32, i32>>]
+// cdb-check:[...][0]              : 12 [Type: [...]]
+// cdb-check:[...][1]              : (13, 14) [Type: tuple<i32, i32>]
+// cdb-command:dx internal_padding1.__1,d
+// cdb-check:internal_padding1.__1,d [...]: (13, 14) [Type: tuple<i32, i32>]
+// cdb-check:[...][0]              : 13 [Type: [...]]
+// cdb-check:[...][1]              : 14 [Type: [...]]
+// cdb-command:dx internal_padding2,d
+// cdb-check:internal_padding2,d [...]: (15, (16, 17)) [Type: tuple<i16, tuple<i16, i32>>]
+// cdb-check:[...][0]              : 15 [Type: [...]]
+// cdb-check:[...][1]              : (16, 17) [Type: tuple<i16, i32>]
+// cdb-command:dx internal_padding2.__1,d
+// cdb-check:internal_padding2.__1,d [...]: (16, 17) [Type: tuple<i16, i32>]
+// cdb-check:[...][0]              : 16 [Type: [...]]
+// cdb-check:[...][1]              : 17 [Type: [...]]
+
+// cdb-command:dx padding_at_end1,d
+// cdb-check:padding_at_end1,d [...]: (18, (19, 20)) [Type: tuple<i32, tuple<i32, i16>>]
+// cdb-check:[...][0]              : 18 [Type: [...]]
+// cdb-check:[...][1]              : (19, 20) [Type: tuple<i32, i16>]
+// cdb-command:dx padding_at_end1.__1,d
+// cdb-check:padding_at_end1.__1,d [...][Type: tuple<i32, i16>]
+// cdb-check:[...][0]              : 19 [Type: [...]]
+// cdb-check:[...][1]              : 20 [Type: [...]]
+// cdb-command:dx padding_at_end2,d
+// cdb-check:padding_at_end2,d [...]: ((21, 22), 23) [Type: tuple<tuple<i32, i16>, i32>]
+// cdb-check:[...][0]              : (21, 22) [Type: tuple<i32, i16>]
+// cdb-check:[...][1]              : 23 [Type: [...]]
+// cdb-command:dx padding_at_end2.__0,d
+// cdb-check:padding_at_end2.__0,d [...]: (21, 22) [Type: tuple<i32, i16>]
+// cdb-check:[...][0]              : 21 [Type: [...]]
+// cdb-check:[...][1]              : 22 [Type: [...]]
+
 #![allow(unused_variables)]
 #![feature(omit_gdb_pretty_printer_section)]
 #![omit_gdb_pretty_printer_section]