Skip to content

RFE: debug pretty printers for Rc/Arc #51355

Open
@cuviper

Description

@cuviper

It would be nice if rust-gdb/etc. could pretty-print the inner value of Rc and Arc. Right now you only get the raw details, like:

(gdb) p foo
$1 = Rc<i32> = {ptr = NonNull<alloc::rc::RcBox<i32>> = {
    pointer = NonZero<*const alloc::rc::RcBox<i32>> = {0x555555783a40}},
  phantom = PhantomData<i32>}

Getting the actual value requires manual field access, foo.ptr.pointer.0.value, which could also change if Rc internals change.

Maybe this could be approached as more general Deref support, so you could p *foo here, but right now that just says "Attempt to take contents of a non-pointer value."

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions