public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] (Ada) Fix printing of access to unconstrained arrays
Date: Wed, 12 Sep 2018 12:06:00 -0000	[thread overview]
Message-ID: <cc330e39bc938cefd4cfc581639177ef4c6bcbe3@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT cc330e39bc938cefd4cfc581639177ef4c6bcbe3 ***

Author: Xavier Roirand <roirand@adacore.com>
Branch: master
Commit: cc330e39bc938cefd4cfc581639177ef4c6bcbe3

(Ada) Fix printing of access to unconstrained arrays

Using this Ada code:

    type String_Access is access String;
    type Array_Of_String is array (1 .. 2) of String_Access;
    Aos : Array_Of_String := (new String'("ab"), new String'("cd"));

When debugging with GDB, printing each Aos element displays:

    (gdb) print Aos(1)
    $2 = "ab"
    (gdb) print Aos(2)
    $3 = "cd"

Whereas it should display:

    (gdb) print Aos(1)
    $2 = (foo_r118_024.string_access) 0x635018
    (gdb) print Aos(2)
    $3 = (foo_r118_024.string_access) 0x635038

Notice that printing the entire array works:

(gdb) print Aos
$1 = (0x635018, 0x635038)

The problem was located in ada_value_print function and due to the fact
that the value_type used in this function was based on
value_enclosing_type rather than value_type itself.
In our example, the difference between the value_type and the
value_enclosing_type of the value is that the value_type contains an
additional typedef layer which is not present in the value_enclosing_type.
This typedef layer is GNAT's way to specify that the element is, at the
source level, an access to the unconstrained array, rather than the
unconstrained array.
Moreover, the value_enclosing_type is not really needed in that case and
the value_type can be used instead in this function, and this patch fixes
this.

gdb/ChangeLog:

    * ada-valprint.c (ada_value_print): Use type instead of
    enclosing type.

testsuite/ChangeLog:

    * gdb.ada/access_to_unbounded_array.exp: New testcase.
    * gdb.ada/access_to_unbounded_array/foo.adb: New file.
    * gdb.ada/access_to_unbounded_array/pack.adb: New file.
    * gdb.ada/access_to_unbounded_array/pack.ads: New file.

Tested: x86_64-linux


             reply	other threads:[~2018-09-10 15:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 12:06 sergiodj+buildbot [this message]
2018-09-12 12:10 ` *** COMPILATION FAILED *** Failures on RHEL-s390x-m64, branch master *** BREAKAGE *** sergiodj+buildbot
2018-09-12 17:01 ` *** COMPILATION FAILED *** Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-09-12 17:08 ` *** COMPILATION FAILED *** Failures on Debian-s390x-native-gdbserver-m64, " sergiodj+buildbot
2018-09-12 17:08 ` *** COMPILATION FAILED *** Failures on Debian-s390x-m64, " sergiodj+buildbot
2018-09-13  0:33 ` Failures on Fedora-s390x-m64, branch master sergiodj+buildbot
2018-09-13  1:41 ` Failures on Fedora-i686, " sergiodj+buildbot
2018-09-13  1:47 ` Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2018-09-13  1:57 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-09-13  2:06 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot
2018-09-13  3:13 ` Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot
2018-09-13  9:27 ` Failures on Fedora-x86_64-native-gdbserver-m32, " sergiodj+buildbot

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=cc330e39bc938cefd4cfc581639177ef4c6bcbe3@gdb-build \
    --to=sergiodj+buildbot@sergiodj.net \
    --cc=gdb-testers@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).