Summary: | [15 Regression] Rust upstream GDB tests regressions with GDB 15 | ||
---|---|---|---|
Product: | gdb | Reporter: | liushuyu <liushuyu011> |
Component: | rust | Assignee: | Tom Tromey <tromey> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | brobecker, doko, tromey |
Priority: | P2 | ||
Version: | HEAD | ||
Target Milestone: | 15.1 | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | Error logs |
Description
liushuyu
2024-03-20 22:33:22 UTC
If you don't want to run all the tests, you may just check this one: https://raw.githubusercontent.com/rust-lang/rust/e3df96cfda905301fc8514e000f942222c1ab6ad/tests/debuginfo/vec-slices.rs checked with trunk 20240312 and 20240320 The gdb change was intentional. See bug #30330. There's also a follow-up patch that will land before gdb 15: https://sourceware.org/pipermail/gdb-patches/2024-March/207190.html This patch slightly changes the output in some cases. In fact... let's use this bug to track that patch, to make sure it really does land for 15. > If it is, how should someone print out the size of a Rust slice in this case? I built vec-slices.rs and ran it under a gdb with the patch applied: (gdb) info local mut_slice = &mut [i64] [1, 2, 3, 4, 5] padded_struct = &[vec_slices::AStruct] [ vec_slices::AStruct {x: 10, y: 11, z: 12}, vec_slices::AStruct {x: 13, y: 14, z: 15}] padded_tuple = &[(i32, i16)] [(6, 7), (8, 9)] slice_of_slice = &[i64] [3, 4] multiple = &[i64] [2, 3, 4, 5] singleton = &[i64] [1] empty = &[i64] [] > I built vec-slices.rs and ran it under a gdb with the patch
> applied:
Thanks for the information!
Although I am curious about how to print the length of a slice like using `print slice.length` before?
I have also built a GDB with the patch applied; the auto-completion in the interactive mode still completes `.length` in this case:
(gdb) p multiple.
data_ptr length
Is this expected?
(In reply to liushuyu from comment #4) > Although I am curious about how to print the length of a slice like using > `print slice.length` before? You can't, not directly anyway. In Rust you use len() but the Rust compiler doesn't emit enough information for gdb to do calls via traits. > I have also built a GDB with the patch applied; the auto-completion in the > interactive mode still completes `.length` in this case: > > (gdb) p multiple. > data_ptr length > > Is this expected? No, this should have a separate report. The completer still sees the underlying C-like type. Hello, From what I could understand, Tom is saying that there is no issue in GDB, and so we should be able to close this PR? The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=251cedaeb57fe1e0fd28798f476fbee75373bbf4 commit 251cedaeb57fe1e0fd28798f476fbee75373bbf4 Author: Tom Tromey <tromey@adacore.com> Date: Thu Mar 7 12:57:07 2024 -0700 Print type name when printing Rust slice The recent change to how unsized Rust values are printed included a small regression from past behavior. Previously, a slice's type would be printed, like: (gdb) print slice $80 = &[i32] [3] The patch changed this to just (gdb) print slice $80 = [3] This patch restores the previous behavior. Reviewed-By: Simon Marchi <simon.marchi@efficios.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30330 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31517 I am going to close this now. |