-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
GDB pretty printers incorrectly print Path slices #43334
Comments
For me with rustc 1.20, I don't see the strings at all:
|
So perhaps that difference is the problem. |
@tromey Good find! |
For Unix, |
No, that's wrong. |
I don't really understand what is going on in this code, I think. I don't know how the runtime finds the length of the One guess is that
However, the type of
And
So maybe these are more debuginfo bugs. If this is all accurate then |
So the problem is that
The simple solution here is to make However, forbidding struct CustomDST {
a: u8,
b: bool,
c: str
}
let x: &CustomDST = make_thing();
let y = x.a; // autoderefs x, but is ok
let z = (*x).b; // explicitly derefs x into an rvalue, also ok
let w = &x.c; // autoderefs x, attempts to access dynamically sized field, but re-references it so we get an `&str` We'd need to introduce a similar mechanism where we don't allow printing DSTs directly but allow taking references to them. Alternatively; given that gdb runs at runtime and all the sizes are known, we can allow |
I think this has swapped "lvalue" (aka place) and "rvalue" (aka value). |
I meant to reply to this ages ago, but was reminded only today by a StackOverflow issue.
Normally gdb wants to know what things look like under the hood. It's fine for the Rust compiler to emit a description of this underlying reality, even if it doesn't line up with some user-facing object; one can sprinkle |
Things have changed a bit, probably due to #92718:
And,
There's still some weirdness in here though, like:
|
Given this source file:
When compiled and run through
rust-gdb
it yields:The variable
b
was printed asa/b
instead ofa
, although string slices appear to work!The text was updated successfully, but these errors were encountered: