about summary refs log tree commit diff
path: root/src/test/debuginfo
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2022-01-13 18:13:54 +0100
committerMichael Woerister <michaelwoerister@posteo>2022-01-24 13:41:32 +0100
commitd253e6e473c7614eb16f6144ab6a0f95e89db604 (patch)
tree3ad4f50188a4c91b38d937cfc54f421dcc0f9144 /src/test/debuginfo
parentef119d704d87a05435ea97ef4161529142313a9b (diff)
downloadrust-d253e6e473c7614eb16f6144ab6a0f95e89db604.tar.gz
rust-d253e6e473c7614eb16f6144ab6a0f95e89db604.zip
[debuginfo] Fix and unify handling of fat pointers in debuginfo.
Diffstat (limited to 'src/test/debuginfo')
-rw-r--r--src/test/debuginfo/unsized.rs40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/test/debuginfo/unsized.rs b/src/test/debuginfo/unsized.rs
index c27fe61dc8b..1d1f3c0c76e 100644
--- a/src/test/debuginfo/unsized.rs
+++ b/src/test/debuginfo/unsized.rs
@@ -4,13 +4,36 @@
 
 // gdb-command:run
 
-// gdb-command:print *a
-// gdbg-check:$1 = {value = [...] "abc"}
-// gdbr-check:$1 = unsized::Foo<[u8]> {value: [...]}
+// gdb-command:print a
+// gdbg-check:$1 = {data_ptr: [...], length: 4}
+// gdbr-check:$1 = &unsized::Foo<[u8]> {data_ptr: [...], length: 4}
 
-// gdb-command:print *b
-// gdbg-check:$2 = {value = {value = [...] "abc"}}
-// gdbr-check:$2 = unsized::Foo<unsized::Foo<[u8]>> {value: unsized::Foo<[u8]> {value: [...]}}
+// gdb-command:print b
+// gdbg-check:$2 = {data_ptr: [...], length: 4}
+// gdbr-check:$2 = &unsized::Foo<unsized::Foo<[u8]>> {data_ptr: [...], length: 4}
+
+// gdb-command:print c
+// gdbg-check:$3 = {pointer: [...], vtable: [...]}
+// gdbr-check:$3 = &unsized::Foo<dyn core::fmt::Debug> {pointer: [...], vtable: [...]}
+
+
+// === CDB TESTS ===================================================================================
+
+// cdb-command: g
+// cdb-command:dx a
+// cdb-check:a                [Type: ref$<unsized::Foo<slice$<u8> > >]
+// cdb-check:    [+0x000] data_ptr         : 0x[...] [Type: unsized::Foo<slice$<u8> > *]
+// cdb-check:    [+0x008] length           : 0x4 [Type: unsigned __int64]
+
+// cdb-command:dx b
+// cdb-check:b                [Type: ref$<unsized::Foo<unsized::Foo<slice$<u8> > > >]
+// cdb-check:    [+0x000] data_ptr         : 0x[...] [Type: unsized::Foo<unsized::Foo<slice$<u8> > > *]
+// cdb-check:    [+0x008] length           : 0x4 [Type: unsigned __int64]
+
+// cdb-command:dx c
+// cdb-check:c                [Type: ref$<unsized::Foo<dyn$<core::fmt::Debug> > >]
+// cdb-check:    [+0x000] pointer          : 0x[...] [Type: unsized::Foo<dyn$<core::fmt::Debug> > *]
+// cdb-check:    [+0x008] vtable           : 0x[...] [Type: unsigned __int64 (*)[3]]
 
 
 #![feature(omit_gdb_pretty_printer_section)]
@@ -26,8 +49,13 @@ fn main() {
             value: *b"abc\0"
         }
     };
+
+    // We expect `a`, `b`, and `c` to all be fat pointers.
+    // `a` and `b` should be slice-like and thus have a `data_ptr` and `length` field.
+    // `c` should be trait-object-like and thus have a `pointer` and `vtable` field.
     let a: &Foo<[u8]> = &foo.value;
     let b: &Foo<Foo<[u8]>> = &foo;
+    let c: &Foo<dyn std::fmt::Debug> = &Foo { value: 7i32 };
 
     zzz(); // #break
 }