Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
billti opened this issue Jul 29, 2023 · 3 comments
Open

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

billti opened this issue Jul 29, 2023 · 3 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. WG-debugging Working group: Bad Rust debugging experiences

Comments

@billti
Copy link

billti commented Jul 29, 2023

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))

@billti billti added the C-bug Category: This is a bug. label Jul 29, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 29, 2023
@crlf0710 crlf0710 added the WG-debugging Working group: Bad Rust debugging experiences label Jul 29, 2023
@Noratrieb Noratrieb added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 29, 2023
@jendrikw
Copy link
Contributor

Still an issue btw

@felipemarkson
Copy link

It still an issue.

@billti
Copy link
Author

billti commented Mar 6, 2025

I had a fix for this working locally for over a year now. I can try and open a PR if other folks are interested in seeing it resolved. I just need to get familiar with any test/validation requirements and hopefully can open a PR next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. WG-debugging Working group: Bad Rust debugging experiences
Projects
None yet
Development

No branches or pull requests

6 participants