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

debuginfo: Add GDB pretty printers for slices, Vec<>, and String. #23310

Merged
merged 1 commit into from
Mar 13, 2015

Conversation

michaelwoerister
Copy link
Member

Rust:  let slice: &[i32] = &[0, 1, 2, 3];
GDB:   $1 = &[i32](len: 4) = {0, 1, 2, 3}

Rust:  let vec = vec![4, 5, 6, 7];
GDB:   $2 = Vec<u64>(len: 4, cap: 4) = {4, 5, 6, 7}

Rust:  let str_slice = "IAMA string slice!";
GDB:   $3 = "IAMA string slice!"

Rust:  let string = "IAMA string!".to_string();
GDB:   $4 = "IAMA string!"

Neat!

@rust-highfive
Copy link
Collaborator

r? @pcwalton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

@bors: r+ 90fc28d

Nice!

@Manishearth
Copy link
Member

👯

@eddyb
Copy link
Member

eddyb commented Mar 13, 2015

I wonder if it would be possible for &[i32](len: 4) to be printed as &[i32; 4] instead, as if unsizing was being reversed.

@michaelwoerister
Copy link
Member Author

@eddyb We could do that but it would be kind of lying about the type, wouldn't it?

@eddyb
Copy link
Member

eddyb commented Mar 13, 2015

I guess... I prefer {len: 4, cap: 4} for what it's worth, but that's really unimportant.

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 13, 2015
…crichton

 ```rust
Rust:  let slice: &[i32] = &[0, 1, 2, 3];
GDB:   $1 = &[i32](len: 4) = {0, 1, 2, 3}

Rust:  let vec = vec![4, 5, 6, 7];
GDB:   $2 = Vec<u64>(len: 4, cap: 4) = {4, 5, 6, 7}

Rust:  let str_slice = \"IAMA string slice!\";
GDB:   $3 = \"IAMA string slice!\"

Rust:  let string = \"IAMA string!\".to_string();
GDB:   $4 = \"IAMA string!\"
```
Neat!
@michaelwoerister
Copy link
Member Author

I guess... I prefer {len: 4, cap: 4} for what it's worth, but that's really unimportant.

Yes, I think I'll do some kind of informal poll in the forum about what the actual rendering should look like.

@bors bors merged commit 90fc28d into rust-lang:master Mar 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants