aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-04-24 15:35:01 -0600
committerTom Tromey <tromey@adacore.com>2020-04-24 15:35:02 -0600
commit787de330ee1471389cad1975eae65e566ad00448 (patch)
treecaac890fb1b06ec9faf8e15013c76bbbb2abc421
parentff985671077a60f82e3cd8bcceda3efa0f3fabe6 (diff)
downloadgdb-787de330ee1471389cad1975eae65e566ad00448.zip
gdb-787de330ee1471389cad1975eae65e566ad00448.tar.gz
gdb-787de330ee1471389cad1975eae65e566ad00448.tar.bz2
Move the rust "{" hack
The DWARF reader has a special case to work around a bug in some versions of the Rust compiler -- it ignores mangled names that contain a "{" character. I noticed that this check should probably be in dw2_linkage_name rather than only in dwarf2_physname. The former is called in some cases that the latter is not. Also, I noticed that this work is not done for the partial DIE reader, so this patch adds the check there as well. gdb/ChangeLog 2020-04-24 Tom Tromey <tom@tromey.com> * dwarf2/read.c (dw2_linkage_name): Move Rust "{" hack here... (dwarf2_physname): ... from here. (partial_die_info::read): Add Rust "{" hack.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2/read.c17
2 files changed, 17 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e231277..6122e31 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2020-04-24 Tom Tromey <tom@tromey.com>
+ * dwarf2/read.c (dw2_linkage_name): Move Rust "{" hack here...
+ (dwarf2_physname): ... from here.
+ (partial_die_info::read): Add Rust "{" hack.
+
+2020-04-24 Tom Tromey <tom@tromey.com>
+
* symtab.h (struct general_symbol_info) <set_demangled_name>: New
method.
(symbol_set_demangled_name): Don't declare.
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 86d3a7b..a221394 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -10032,6 +10032,12 @@ dw2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
if (linkage_name == NULL)
linkage_name = 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 && linkage_name != NULL
+ && strchr (linkage_name, '{') != NULL)
+ linkage_name = NULL;
+
return linkage_name;
}
@@ -10308,12 +10314,6 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
mangled = dw2_linkage_name (die, 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. */
gdb::unique_xmalloc_ptr<char> demangled;
@@ -18301,6 +18301,11 @@ partial_die_info::read (const struct die_reader_specs *reader,
assume they will be the same, and we only store the last
one we see. */
linkage_name = DW_STRING (&attr);
+ /* 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 && linkage_name != NULL
+ && strchr (linkage_name, '{') != NULL)
+ linkage_name = NULL;
break;
case DW_AT_low_pc:
has_low_pc_attr = 1;