Skip to content

rust-lldb pretty-printing not working for Rc<str> #114195

Open
@billti

Description

@billti

I tried this code:

pub struct Testing {
    pub name: std::rc::Rc<str>,
    pub other_name: String,
}

fn main() {
    let my_name = "Bill";
    let foo = Testing { name: my_name.into(), other_name: my_name.into() };
    let disp = format!("{}", foo.name);
}

I expected to see this happen: Pretty printing of the Testing::name Rc<str> value in rust-lldb.

Instead, this happened: Just the first char of the Rc<str> was printed.

(lldb) b src/main.rs:81
Breakpoint 1: 2 locations.
(lldb) run
Process 30797 launched: '/Users/billti/src/rsenum/target/debug/rsenum' (arm64)
Process 30797 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00000001000033d0 rsenum`rsenum::main::h7d2f7ff2357a65c7 at main.rs:81:16
   78  	fn main() {
   79  	    let my_name = "Bill";
   80  	    let foo = Testing { name: my_name.into(), other_name: my_name.into() };
-> 81  	    let disp = format!("{}", foo.name);
   82  	    
   83  	    
   84  	    
Target 0: (rsenum) stopped.
(lldb) var
(&str) my_name = "Bill" {
  data_ptr = 0x000000010003932c "Bill"
  length = 4
}
(rsenum::Testing) foo = {
  name = strong=1, weak=0 {
    value = 'B'
  }
  other_name = "Bill" {
    vec = size=4 {
      [0] = 'B'
      [1] = 'i'
      [2] = 'l'
      [3] = 'l'
    }
  }
}
(lldb) version
lldb-1403.0.17.67
Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)

I tested with stable and nightly with the same results (rustc 1.73.0-nightly (04abc37 2023-07-28))

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.WG-debuggingWorking group: Bad Rust debugging experiences

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions