From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58521 invoked by alias); 4 Apr 2016 09:22:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 58479 invoked by uid 89); 4 Apr 2016 09:22:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=H*RU:HELO, Hx-spam-relays-external:HELO, five, commercial X-HELO: mga04.intel.com Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Apr 2016 09:22:30 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 04 Apr 2016 02:22:29 -0700 X-ExtLoop1: 1 Received: from heckel-mobl3.ger.corp.intel.com (HELO [172.28.205.63]) ([172.28.205.63]) by FMSMGA003.fm.intel.com with ESMTP; 04 Apr 2016 02:22:28 -0700 Subject: Re: [PATCH 2/3][PING] fort_dyn_array: Support evaluation of dynamic elements inside arrays. To: gdb-patches@sourceware.org References: <1458204189-13267-1-git-send-email-bernhard.heckel@intel.com> <1458204189-13267-3-git-send-email-bernhard.heckel@intel.com> From: "Heckel, Bernhard" Message-ID: <57023253.8090600@intel.com> Date: Mon, 04 Apr 2016 09:22:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1458204189-13267-3-git-send-email-bernhard.heckel@intel.com> Content-Type: text/plain; charset="windows-1252"; format="flowed" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00029.txt.bz2 On 17/03/2016 09:43, Bernhard Heckel wrote: > Resolve type of an array's element to be printed in case it is dynamic. > Otherwise we don't use the correct boundaries nor the right location. > > Before: > ptype fivearr(1) > type =3D Type five > Type one > integer(kind=3D4) :: ivla(34196784:34196832,34197072:34197120,= 34197360:34197408) > End Type one :: tone > End Type five > > After: > ptype fivearr(1) > type =3D Type five > Type one > integer(kind=3D4) :: ivla(2,4,6) > End Type one :: tone > End Type five > > 2016-02-24 Bernhard Heckel > > gdb/Changelog: > * valarith.c (value_address): Resolve dynamic types. > > gdb/testsuite/Changelog: > * gdb.fortran/vla-type.f90: Add test for static and dynamic arrays > of dynamic types. > * gdb.fortran/vla-type.exp: Add test for static and dynamic arrays > of dynamic types. > > --- > gdb/testsuite/gdb.fortran/vla-type.exp | 52 +++++++++++++++++++++++++++= +++++++ > gdb/testsuite/gdb.fortran/vla-type.f90 | 20 +++++++++++-- > gdb/valarith.c | 9 ++++++ > 3 files changed, 79 insertions(+), 2 deletions(-) > > diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.f= ortran/vla-type.exp > index 1d09451..f9c0b61 100755 > --- a/gdb/testsuite/gdb.fortran/vla-type.exp > +++ b/gdb/testsuite/gdb.fortran/vla-type.exp > @@ -96,3 +96,55 @@ gdb_test "ptype fivev" \ > "\\s+integer\\\(kind=3D4\\\) :: ivla\\\(10,10,10\\= \)" \ > "\\s+End Type one :: tone" \ > "End Type five" ] > + > +# Check array of types containing a VLA > +gdb_breakpoint [gdb_get_line_number "fivearr-filled"] > +gdb_continue_to_breakpoint "fivearr-filled" > +gdb_test "print fivearr(1)%tone%ivla(1, 2, 3)" " =3D 1" > +gdb_test "print fivearr(1)%tone%ivla(2, 2, 10)" "no such vector element" > +gdb_test "print fivearr(1)%tone%ivla(2, 2, 3)" " =3D 223" > +gdb_test "print fivearr(2)%tone%ivla(12, 14, 16)" " =3D 2" > +gdb_test "print fivearr(2)%tone%ivla(6, 7, 8)" " =3D 678" > +gdb_test "ptype fivearr(1)" \ > + [multi_line "type =3D Type five" \ > + "\\s+Type one" \ > + "\\s+integer\\\(kind=3D4\\\) :: ivla\\\(2,4,6\\\)" \ > + "\\s+End Type one :: tone" \ > + "End Type five" ] > +gdb_test "ptype fivearr(2)" \ > + [multi_line "type =3D Type five" \ > + "\\s+Type one" \ > + "\\s+integer\\\(kind=3D4\\\) :: ivla\\\(12,14,16\\\= )" \ > + "\\s+End Type one :: tone" \ > + "End Type five" ] > + > +# Check allocation status of dynamic array and it's dynamic members > +gdb_test "ptype fivedynarr" "type =3D " > +gdb_test "next" "" > +gdb_test "ptype fivedynarr(2)" \ > + [multi_line "type =3D Type five" \ > + "\\s+Type one" \ > + "\\s+integer\\\(kind=3D4\\\) :: ivla\\\(\\\)" \ > + "\\s+End Type one :: tone" \ > + "End Type five" ] > + > +# Check dynamic array of types containing a VLA > +gdb_breakpoint [gdb_get_line_number "fivedynarr-filled"] > +gdb_continue_to_breakpoint "fivedynarr-filled" > +gdb_test "print fivedynarr(1)%tone%ivla(1, 2, 3)" " =3D 1" > +gdb_test "print fivedynarr(1)%tone%ivla(2, 2, 10)" "no such vector eleme= nt" > +gdb_test "print fivedynarr(1)%tone%ivla(2, 2, 3)" " =3D 223" > +gdb_test "print fivedynarr(2)%tone%ivla(12, 14, 16)" " =3D 2" > +gdb_test "print fivedynarr(2)%tone%ivla(6, 7, 8)" " =3D 678" > +gdb_test "ptype fivedynarr(1)" \ > + [multi_line "type =3D Type five" \ > + "\\s+Type one" \ > + "\\s+integer\\\(kind=3D4\\\) :: ivla\\\(2,4,6\\\)" \ > + "\\s+End Type one :: tone" \ > + "End Type five" ] > +gdb_test "ptype fivedynarr(2)" \ > + [multi_line "type =3D Type five" \ > + "\\s+Type one" \ > + "\\s+integer\\\(kind=3D4\\\) :: ivla\\\(12,14,16\\\= )" \ > + "\\s+End Type one :: tone" \ > + "End Type five" ] > diff --git a/gdb/testsuite/gdb.fortran/vla-type.f90 b/gdb/testsuite/gdb.f= ortran/vla-type.f90 > index a106617..5473124 100755 > --- a/gdb/testsuite/gdb.fortran/vla-type.f90 > +++ b/gdb/testsuite/gdb.fortran/vla-type.f90 > @@ -38,6 +38,8 @@ program vla_struct > type(three) :: threev > type(four) :: fourv > type(five) :: fivev > + type(five) :: fivearr (2) > + type(five), allocatable :: fivedynarr (:) > logical :: l > integer :: i, j >=20=20=20 > @@ -83,6 +85,20 @@ program vla_struct > fivev%tone%ivla(1, 2, 3) =3D 123 > fivev%tone%ivla(3, 2, 1) =3D 321 >=20=20=20 > - ! dummy statement for bp > - l =3D allocated(fivev%tone%ivla) ! fivev-filled > + allocate (fivearr(1)%tone%ivla (2, 4, 6)) ! fivev-filled > + allocate (fivearr(2)%tone%ivla (12, 14, 16)) > + fivearr(1)%tone%ivla(:, :, :) =3D 1 > + fivearr(1)%tone%ivla(2, 2, 3) =3D 223 > + fivearr(2)%tone%ivla(:, :, :) =3D 2 > + fivearr(2)%tone%ivla(6, 7, 8) =3D 678 > + > + allocate (fivedynarr(2)) ! fivearr-filled > + allocate (fivedynarr(1)%tone%ivla (2, 4, 6)) > + allocate (fivedynarr(2)%tone%ivla (12, 14, 16)) > + fivedynarr(1)%tone%ivla(:, :, :) =3D 1 > + fivedynarr(1)%tone%ivla(2, 2, 3) =3D 223 > + fivedynarr(2)%tone%ivla(:, :, :) =3D 2 > + fivedynarr(2)%tone%ivla(6, 7, 8) =3D 678 > + > + l =3D allocated(fivedynarr) ! fivedynarr-filled > end program vla_struct > diff --git a/gdb/valarith.c b/gdb/valarith.c > index 7959f3b..62d0e30 100644 > --- a/gdb/valarith.c > +++ b/gdb/valarith.c > @@ -207,6 +207,15 @@ value_subscripted_rvalue (struct value *array, LONGE= ST index, int lowerbound) > error (_("no such vector element")); > } >=20=20=20 > + if (is_dynamic_type (elt_type)) > + { > + gdb_byte *valaddr =3D NULL; > + CORE_ADDR address; > + > + address =3D value_address (array) + elt_offs; > + elt_type =3D resolve_dynamic_type (elt_type, valaddr, address); > + } > + > if (VALUE_LVAL (array) =3D=3D lval_memory && value_lazy (array)) > v =3D allocate_value_lazy (elt_type); > else --=20 Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928