diff options
author | Tom Tromey <tromey@adacore.com> | 2024-09-09 10:57:56 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-03-06 14:17:17 -0700 |
commit | 29faeceaa8a7833c1234f9980266c84c7c6b9d02 (patch) | |
tree | 10c7578e77741c3c9b905aeb1dba365179c74b9d /gdb/ada-lang.c | |
parent | a584cfc980fab6e64b627726df001159732d3bc5 (diff) | |
download | binutils-29faeceaa8a7833c1234f9980266c84c7c6b9d02.zip binutils-29faeceaa8a7833c1234f9980266c84c7c6b9d02.tar.gz binutils-29faeceaa8a7833c1234f9980266c84c7c6b9d02.tar.bz2 |
Allow for anonymous Ada enumeration types
With some forthcoming changes to GNAT, gdb might see a nameless enum
in ada_resolve_enum, causing a crash. This patch allows an anonymous
enum type to be considered identical to a named type when the contents
are identical.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index b7e24ef..95ceb10 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3796,7 +3796,10 @@ ada_resolve_enum (std::vector<struct block_symbol> &syms, for (int i = 0; i < syms.size (); ++i) { struct type *type2 = ada_check_typedef (syms[i].symbol->type ()); - if (strcmp (type1->name (), type2->name ()) != 0) + /* We let an anonymous enum type match a non-anonymous one. */ + if (type1->name () != nullptr + && type2->name () != nullptr + && strcmp (type1->name (), type2->name ()) != 0) continue; if (ada_identical_enum_types_p (type1, type2)) return i; |