This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] PR rust/20162 - fix gdb regressions caused by rust 1.10


*** TEST RESULTS FOR COMMIT e98c9e7ce1c9fd2a5ad99ae2de637b4c16d999b3 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: e98c9e7ce1c9fd2a5ad99ae2de637b4c16d999b3

PR rust/20162 - fix gdb regressions caused by rust 1.10

PR rust/20162 started life as a reminder to test gdb with versions of
rust after 1.8; but now concerns some gdb regressions seen with rust
1.10 ("beta") and 1.11 ("nightly").

The failures turn out to be a discrepancy between how rustc emits
DWARF and how gdb interprets it.  In particular, rustc will emit DWARF
like:

 <2><bc>: Abbrev Number: 9 (DW_TAG_structure_type)
    <bd>   DW_AT_name        : (indirect string, offset: 0x46a): HasMethods
    <c1>   DW_AT_byte_size   : 4
...
 <3><cc>: Abbrev Number: 11 (DW_TAG_subprogram)
...
    <df>   DW_AT_name        : (indirect string, offset: 0x514f): new

gdb wants to see a separate top-level DW_TAG_subprogram that refers to
this one via DW_AT_specification; but rustc doesn't emit one.  By my
reading of DWARF 4 5.5.7, this is ok, and gdb is incorrect here.

Fixing this involved a new case in scan_partial_symbols, and then a
further change in process_structure_scope to account for the fact
that, in Rust, such functions are not methods and should not be
attached to the structure type.

Next, it turns out that rust is emitting bad values for
DW_AT_linkage_name, e.g.:

    <db>   DW_AT_linkage_name: (indirect string, offset: 0x422): _ZN7methods8{{impl}}3newE

The the "{{impl}}" stuff is apparently some side effect of a change to
the compiler's internal representation.  Oops!

This also had a simple fix -- disregard these mangled names.

With these changes, there are no regressions in the gdb Rust tests
with either 1.10 or 1.11.  1.9, the stable release, is still pretty
broken, but I think there's nothing much to do about that.

These changes are a bit hackish, but no worse, I think, than other
kinds of quirk handling already done in the DWARF parser.  I have
reported all the rustc bugs upstream.  I plan to remove these hacks
from gdb some suitable time after they have been fixed in released
versions of Rust.

2016-07-22  Tom Tromey  <tom@tromey.com>

	PR rust/20162:
	* dwarf2read.c (scan_partial_symbols) <DW_TAG_structure_type>:
	Call scan_partial_symbols for children when reading a Rust CU.
	(dwarf2_physname): Ignore invalid DW_AT_linkage_name generated by
	rustc.
	(process_structure_scope) <DW_TAG_subprogram>: Call
	read_func_scope for Rust.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]