Discussion:
[Bug rust/23625] New: rust ptype is incorrect for pointer types
tromey at sourceware dot org
2018-09-10 11:50:04 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23625

Bug ID: 23625
Summary: rust ptype is incorrect for pointer types
Product: gdb
Version: 8.2
Status: NEW
Severity: normal
Priority: P2
Component: rust
Assignee: unassigned at sourceware dot org
Reporter: tromey at sourceware dot org
Target Milestone: ---

If you run the test case from gdb.rust/traits.exp and ptype, you
will see:

(gdb) ptype td
type = struct traits::&T {
pointer: u8 *,
vtable: usize (*,
}


The type of "vtable" seems plainly wrong.

In the DWARF this type is:

<1><a62>: Abbrev Number: 12 (DW_TAG_pointer_type)
<a63> DW_AT_type : <0xa6b>
<a67> DW_AT_name : (indirect string, offset: 0x35b): &[usize; 3]


But the TYPE_NAME is NULL.

Maybe dwarf2read should preserve the names of pointer types in Rust.
However, rust-lang should also handle TYPE_CODE_PTR in ptype, rather than
delegating it to C.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-11-16 17:02:57 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23625

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
cvs-commit at gcc dot gnu.org
2018-11-19 18:27:46 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23625

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <***@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=73fc52c4ccecf005aac264e3faa08e815d25118a

commit 73fc52c4ccecf005aac264e3faa08e815d25118a
Author: Tom Tromey <***@tromey.com>
Date: Fri Nov 16 15:30:35 2018 -0700

Handle TYPE_CODE_PTR when printing Rust types

This changes the Rust type printers to handle TYPE_CODE_PTR. The
current approach is not ideal, because currently the code can't
distinguish between mut and const, or between pointers and references.
(These are debuginfo deficiencies, for which there are rustc bugs on
file.)

Meanwhile, this at least clears up the case seen in PR rust/23625.

Tested on x86-64 Fedora 28. The nightly compiler gives the best
results, but I regression-tested with stable and beta as well.

gdb/ChangeLog
2018-11-16 Tom Tromey <***@tromey.com>

PR rust/23625:
* rust-lang.c (rust_internal_print_type): Handle TYPE_CODE_PTR.

gdb/testsuite/ChangeLog
2018-11-19 Tom Tromey <***@tromey.com>

PR rust/23625:
* gdb.rust/simple.exp: Add ptype test. Update expected output.
* gdb.rust/expr.exp: Update expected output. Change one test.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-11-19 18:28:20 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23625

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |8.3

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...