public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "michaelwoerister at posteo dot net" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug rust/30330] GDB 13.1 no longer prints length of Rust slice wrappers Date: Mon, 11 Dec 2023 10:32:45 +0000 [thread overview] Message-ID: <bug-30330-4717-lpPYEQwrpR@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-30330-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=30330 --- Comment #15 from Michael Woerister <michaelwoerister at posteo dot net> --- Here is an example program containing all the cases: (https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=11cf2917347fd3cdab77351222b045a7) // A generic struct that is unsized if T is unsized. pub struct MaybeUnsizedStruct<T: ?Sized> { pub regular_field1: u32, pub regular_field2: u32, pub unsized_field: T, } fn main() { // This struct is still sized because T is a fixed-length array let sized_struct = &MaybeUnsizedStruct { regular_field1: 1, regular_field2: 2, unsized_field: [1, 2, 3, 4, 5, 6, 7], }; // This struct is still sized because T is sized let nested_sized_struct = &MaybeUnsizedStruct { regular_field1: 1, regular_field2: 2, unsized_field: MaybeUnsizedStruct { regular_field1: 1, regular_field2: 2, unsized_field: [1, 2, 3, 4, 5, 6, 7], }, }; // This is a regular slice let slice: &[u32] = &[1, 2, 3]; // unsized_struct will be a fat pointer, // containing the length of the final: let unsized_struct: &MaybeUnsizedStruct<[u32]> = sized_struct; // nested_unsized_struct will also be a fat pointer, // containing the length of the final field: let nested_unsized_struct: &MaybeUnsizedStruct<MaybeUnsizedStruct<[u32]>> = nested_sized_struct; // Print some addresses: coercing from sized to unsized does // not change the address the pointer points to. let data_ptr_addr_sized = sized_struct as *const _ as usize; let data_ptr_addr_unsized = unsized_struct as *const _ as *const () as usize; let data_ptr_addr_slice = slice.as_ptr() as usize; let data_ptr_addr_nested_sized = nested_sized_struct as *const _ as usize; let data_ptr_addr_nested_unsized = nested_unsized_struct as *const _ as *const () as usize; dbg!(data_ptr_addr_sized); dbg!(data_ptr_addr_unsized); dbg!(data_ptr_addr_nested_sized); dbg!(data_ptr_addr_nested_unsized); dbg!(data_ptr_addr_slice); } -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2023-12-11 10:32 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-10 20:45 [Bug rust/30330] New: " jistone at redhat dot com 2023-04-10 21:33 ` [Bug rust/30330] " tromey at sourceware dot org 2023-04-11 11:47 ` tromey at sourceware dot org 2023-04-11 18:52 ` jistone at redhat dot com 2023-04-14 3:19 ` tromey at sourceware dot org 2023-04-14 4:25 ` tromey at sourceware dot org 2023-04-14 15:47 ` jistone at redhat dot com 2023-04-14 22:03 ` tromey at sourceware dot org 2023-07-24 13:48 ` tromey at sourceware dot org 2023-07-28 21:31 ` tromey at sourceware dot org 2023-12-08 16:34 ` michaelwoerister at posteo dot net 2023-12-08 21:34 ` tromey at sourceware dot org 2023-12-08 21:36 ` tromey at sourceware dot org 2023-12-08 21:43 ` tromey at sourceware dot org 2023-12-08 21:49 ` tromey at sourceware dot org 2023-12-11 10:27 ` michaelwoerister at posteo dot net 2023-12-11 10:32 ` michaelwoerister at posteo dot net [this message] 2024-01-30 18:24 ` tromey at sourceware dot org 2024-01-30 20:33 ` jistone at redhat dot com 2024-01-31 20:57 ` tromey at sourceware dot org 2024-02-01 19:42 ` tromey at sourceware dot org 2024-02-02 18:20 ` tromey at sourceware dot org 2024-02-02 18:21 ` tromey at sourceware dot org 2024-02-20 20:57 ` cvs-commit at gcc dot gnu.org 2024-02-20 20:58 ` tromey at sourceware dot org 2024-04-02 17:44 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-30330-4717-lpPYEQwrpR@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).