Getting rust pretty-printer to work in a process core that used both C and rust programming language

This question is related to Casting C memory to rust data structure in a core using rust-gdb

I can force gdb to decode memory in a process (which uses mix of rust and C) core as rust objects. But pretty printing does not work on them. Most likely it might be related to the gdb warning "Warning: the current language does not match this frame." I tried both GDB 9.1 and GDB 13.1.


(gdb) set language rust
(gdb) p *(0x7f7004d34758 as *mut std::collections::hash::map::HashMap<u64, suricata::filetracker::FileChunk, std::collections::hash::map::RandomState>)
$9 = std::collections::hash::map::HashMap<u64, suricata::filetracker::FileChunk, std::collections::hash::map::RandomState> {base: hashbrown::map::HashMap<u64, suricata::filetracker::FileChunk, std::collections::hash::map::RandomState, alloc::alloc::Global> {hash_builder: std::collections::hash::map::RandomState {k0: 1191687827486739999, k1: 4663702052227775624}, table: hashbrown::raw::RawTable<(u64, suricata::filetracker::FileChunk), alloc::alloc::Global> {table: hashbrown::raw::RawTableInner<alloc::alloc::Global> {bucket_mask: 31, ctrl: core::ptr::non_null::NonNull<u8> {pointer: 0x7f700c35f1e0 "!X\\\377\377\377\037\034\\\377\377p{o\377\377\377+\377\377O\023\377\377Q\377\377\377\020n\377_!X\\\377\377\377\037\034\\\377\377p{o\377\377\000"}, growth_left: 12, items: 16, alloc: alloc::alloc::Global}, marker: core::marker::PhantomData<(u64, suricata::filetracker::FileChunk)>}}}
(gdb)

Thanks,
Sri

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.