@@ -1,3 +1,13 @@
+2016-06-26 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.
+
2016-06-25 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_get_disr_info, rust_print_type): Fix
@@ -6695,6 +6695,9 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
{
add_partial_symbol (pdi, cu);
}
+ if (cu->language == language_rust && pdi->has_children)
+ scan_partial_symbols (pdi->die_child, lowpc, highpc,
+ set_addrmap, cu);
break;
case DW_TAG_enumeration_type:
if (!pdi->is_declaration)
@@ -8733,6 +8736,12 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
if (mangled == NULL)
mangled = dwarf2_string_attr (die, DW_AT_MIPS_linkage_name, cu);
+ /* rustc emits invalid values for DW_AT_linkage_name. Ignore these.
+ See https://github.com/rust-lang/rust/issues/32925. */
+ if (cu->language == language_rust && mangled != NULL
+ && strchr (mangled, '{') != NULL)
+ mangled = NULL;
+
/* DW_AT_linkage_name is missing in some cases - depend on what GDB
has computed. */
if (mangled != NULL)
@@ -13315,8 +13324,16 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
}
else if (child_die->tag == DW_TAG_subprogram)
{
- /* C++ member function. */
- dwarf2_add_member_fn (&fi, child_die, type, cu);
+ /* Rust doesn't have member functions in the C++ sense.
+ However, it does emit ordinary functions as children
+ of a struct DIE. */
+ if (cu->language == language_rust)
+ read_func_scope (child_die, cu);
+ else
+ {
+ /* C++ member function. */
+ dwarf2_add_member_fn (&fi, child_die, type, cu);
+ }
}
else if (child_die->tag == DW_TAG_inheritance)
{