From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 524783858D20; Thu, 7 Sep 2023 10:27:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 524783858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694082447; bh=GmJxXj976w1U9FRPTt9cBQsBL7pql2olbj3mtFQjAiI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lCG6FhVgSsVL38g8gdRv+MU8hSIHKjl/2hc4CW/4eWagkOCVZYTJAFEq6oNXMRx9p CtrIJSlyBw7WimtNSqPk5yus/z9mIGIr3duOh9HaKC5HQOrgpxlb+bJKh+aub7gKaG yF9QD0Vpo9Mm0cxyXH6i8ZckE6KKsseBQShnEDTA= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug ada/29335] [gdb/ada, debug-types] FAIL: gdb.ada/local-enum.exp: print v1 element Date: Thu, 07 Sep 2023 10:27:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: ada X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29335 --- Comment #5 from Tom de Vries --- Tentative patch: ... diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2e1b9664fdc..2496c099f19 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -204,6 +204,8 @@ static symbol_name_matcher_ftype *ada_get_symbol_name_matcher static int symbols_are_identical_enums (const std::vector &syms); + +static int ada_identical_enum_types_p (struct type *type1, struct type *type2); /* The character set used for source files. */ @@ -3801,11 +3803,24 @@ ada_resolve_enum (std::vector &syms, gdb_assert (context_type->code () =3D=3D TYPE_CODE_ENUM); context_type =3D ada_check_typedef (context_type); + /* We already know the name matches, so we're just looking for + an element of the correct enum type. */ + struct type *type1 =3D context_type; + for (int i =3D 0; i < syms.size (); ++i) + { + struct type *type2 =3D ada_check_typedef (syms[i].symbol->type ()); + if (type1 =3D=3D type2) + return i; + } + for (int i =3D 0; i < syms.size (); ++i) { - /* We already know the name matches, so we're just looking for - an element of the correct enum type. */ - if (ada_check_typedef (syms[i].symbol->type ()) =3D=3D context_type) + struct type *type2 =3D ada_check_typedef (syms[i].symbol->type ()); + if (type1->num_fields () !=3D type2->num_fields ()) + continue; + if (strcmp (type1->name (), type2->name ()) !=3D 0) + continue; + if (ada_identical_enum_types_p (type1, type2)) return i; } ... --=20 You are receiving this mail because: You are on the CC list for the bug.=