How can I print Rust structures in GDB?

How can I print structures (in particular Vecs) in rust-gdbor plain gdb? Whenever I call p some_vector, I get this result:

collections::vec::Vec<usize> = {buf = alloc::raw_vec::RawVec<usize> = {ptr = core::ptr::Unique<usize> = {pointer = core::nonzero::NonZero<*const usize> = {
    0x7ffff640d000}, _marker = core::marker::PhantomData<usize>}, cap = 16}, len = 10}

It is simply unreadable. Is there a way to get a result showing the contents Vec? I am using Rust 1.12 and GDB 7.12.

+4
source share

Source: https://habr.com/ru/post/1658245/


All Articles