diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-19 09:13:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-03-20 07:47:15 -0600 |
commit | 6e7eef72164c00d6a5a7b0bce9fa01f5481f33cb (patch) | |
tree | e07c0c6a3e13a4d367fec7b44f025195a6368ff7 /gdb/defs.h | |
parent | 0fea10f327466dbe949aef39cef5a6bdea91163f (diff) | |
download | binutils-6e7eef72164c00d6a5a7b0bce9fa01f5481f33cb.zip binutils-6e7eef72164c00d6a5a7b0bce9fa01f5481f33cb.tar.gz binutils-6e7eef72164c00d6a5a7b0bce9fa01f5481f33cb.tar.bz2 |
Use rust_demangle to fix a crash
PR rust/30211 points out a crash caused by a particular completion.
This turns out to happen because a Rust minsym winds up in a
C++-specific path in strncmp_iw_with_mode, which ultimately causes the
completer to pass invalid arguments to string::append.
This patch fixes the bug by reordering the language constants so that
Rust comes before C++, and then using rust_demangle. This ensures
that minsyms are correctly marked as "Rust", avoiding this code and
thus the crash.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20367
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30211
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/defs.h')
-rw-r--r-- | gdb/defs.h | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -204,9 +204,8 @@ extern void quit_serial_event_clear (void); these languages, so some symbols could be successfully demangled by several languages. For that reason, the constants here are sorted in the order we'll attempt demangling them. For example: Rust uses - C++ mangling, so must come after C++; Ada must come last (see - ada_sniff_from_mangled_name). (Keep this order in sync with the - 'languages' array in language.c.) */ + a C++-compatible mangling, so must come before C++; Ada must come + last (see ada_sniff_from_mangled_name). */ enum language { @@ -214,6 +213,7 @@ enum language language_auto, /* Placeholder for automatic setting */ language_c, /* C */ language_objc, /* Objective-C */ + language_rust, /* Rust */ language_cplus, /* C++ */ language_d, /* D */ language_go, /* Go */ @@ -222,7 +222,6 @@ enum language language_asm, /* Assembly language */ language_pascal, /* Pascal */ language_opencl, /* OpenCL */ - language_rust, /* Rust */ language_minimal, /* All other languages, minimal support only */ language_ada, /* Ada */ nr_languages |