public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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 19:53:24 +0000	[thread overview]
Message-ID: <bug-29335-4717-qzsGP4lqVA@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29335-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29335

--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=74c36641b0e997ce81294e5bd4fe2d2ce017ea57

commit 74c36641b0e997ce81294e5bd4fe2d2ce017ea57
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Sep 7 21:53:17 2023 +0200

    [gdb/ada] Extend type equivalence test in ada_resolve_enum

    When running test-case gdb.ada/local-enum.exp with target board
debug-types, I
    run into:
    ...
    (gdb) print v1(three)^M
    No name 'three' in enumeration type 'local__e1'^M
    (gdb) FAIL: gdb.ada/local-enum.exp: print v1 element
    ...

    The array V1 is of type A1 which is an array with index type E1, containing
    "three" as enumerator:
    ...
      type E1 is (one, two, three);
      type A1 is array (E1) of Integer;
      V1 : A1 := (0, 1, 2);
    ...

    There's also a type E2 that contains three as enumerator:
    ...
      type E2 is (three, four, five);
    ...

    When doing "print v1(three)", it's the job of ada_resolve_enum to resolve
    "three" to type E1 rather than type E2.

    When using target board debug-types, the enums E1 and E2 are replicated in
the
    .debug_types section, and consequently in ada_resolve_enum the type
    equivalence check using a pointer comparison fails:
    ...
      for (int i = 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 ()) == context_type)
            return i;
        }
    ...

    Fix this by also trying a structural comparison using
    ada_identical_enum_types_p.

    Tested on x86_64-linux.

    Approved-By: Tom Tromey <tom@tromey.com>

    PR ada/29335
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29335

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-09-07 19:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08  8:00 [Bug ada/29335] New: " vries at gcc dot gnu.org
2023-04-19 18:24 ` [Bug ada/29335] " tromey at sourceware dot org
2023-04-20  8:03 ` vries at gcc dot gnu.org
2023-04-20  8:57 ` vries at gcc dot gnu.org
2023-04-27 16:30 ` tromey at sourceware dot org
2023-09-07 10:27 ` vries at gcc dot gnu.org
2023-09-07 15:10 ` vries at gcc dot gnu.org
2023-09-07 19:53 ` cvs-commit at gcc dot gnu.org [this message]
2023-09-07 19:54 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29335-4717-qzsGP4lqVA@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).