Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bernhard Heckel <bernhard.heckel@intel.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: "Weinmann, Christoph T" <christoph.t.weinmann@intel.com>,
	gdb-patches@sourceware.org
Subject: Re: [V4 00/21] Fortran dynamic array support
Date: Fri, 19 Aug 2016 09:58:00 -0000	[thread overview]
Message-ID: <57B6D831.4080605@intel.com> (raw)
In-Reply-To: <20160816135920.GA26624@host1.jankratochvil.net>

On 16/08/2016 15:59, Jan Kratochvil wrote:
> Hi Bernhard,
>
> On Tue, 09 Aug 2016 09:55:05 +0200, Heckel, Bernhard wrote:
>> I took a look at "p varw" issue.
>>
>> >From my point of view, the debug information for  the location of varw is wrong.
>>
>> Set a breakpoint at line 68 and run.
>> "P &varw" in GDB gives me same location as the print of "loc(z(2,4,6))" out of the fortran testcase.
>> Nevertheless, "loc(varw)" shows me a different location. Investigating on the dwarf debug info, GDB address calculation
>> of "varw" is correct. From my point of view, the location expression of "varw" is wrong.
>>
>> If you manual examine the content at "loc(varw)" you see the right content.
>>
>> FYI: I added a variable "dummy" in subroutine "foo" in order to get the content of fbreg and do manual address calculation.
>>
>> I attached the testcase + dwarf
> primarily Fedora 24 GDB (and many Fedora releases back) - with the older Intel
> VLA patch series - does PASS the testcase fine with gfortran DWARF so
> completely wrong the DWARF is not.
>
> Also you talk here only about starting address of 'varw'.  But that is not
> a problem, the starting address in inferior + in GDB do match:
>    varw(1, 1, 1) = 6
> vs.
> $23 = (( ( 6, 5, 1, 5, 5) ( 3, 3, 3, 5, 5) ( 5, 5, 5, 3, 3) ( 3, 5, 5, 5, 5) ) ( ( 5, 3, 3, 3, 5) ( 5, 5, 5, 5, 3) ( 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3) ) ( ( 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3) ) )
> (gdb) FAIL: gdb.fortran/dynamic.exp: p varw filled
>   - the value 6 is really the first (1,1,1) value printed.
> The starting address is nothing special for GDB as starting address is
> adjusted/offseted by the inferior caller, GDB just reads the inferior-computed
> address.
>
> What is wrong is accessing 'varw' elements not in the first row of the array
> by GDB - because GDB needs to know the stride for it.
> Stride is described there in DWARF:
>      <231>   DW_AT_upper_bound : 11 byte block: 31 97 23 28 6 97 23 20 6 1c 22   (DW_OP_lit1; DW_OP_push_object_address; DW_OP_plus_uconst: 40; DW_OP_deref; DW_OP_push_object_address; DW_OP_plus_uconst: 32; DW_OP_deref; DW_OP_minus; DW_OP_plus)
>      <23d>   DW_AT_byte_stride : 6 byte block: 97 23 18 6 34 1e  (DW_OP_push_object_address; DW_OP_plus_uconst: 24; DW_OP_deref; DW_OP_lit4; DW_OP_mul)
> and that just fetches the values from gfortran array descriptor - otherwise the
> inferior Fortran function 'foo' would not work.
>
> Why do you think gfortran has the DWARF wrong?  Do your GDB patches PASS with
> ifort?  I no longer have ifort - I got a license from Markus Metzger many
> years ago, it was somehow complicated in Intel to get it for me and the
> license laster only one year.  You would have to send me the ifort-built
> binary (or .s file).
>
>
> I have tried now to re-apply a part of the old working Intel VLA patch of
> value_subscripted_rvalue():
>     unsigned int elt_size = TYPE_LENGTH (elt_type);
> -  unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
> +  unsigned int elt_offs = longest_to_int (index - lowerbound);
> +  LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type));
>     struct value *v;
>
> +  if (elt_stride > 0)
> +    elt_offs *= elt_stride;
> +  else if (elt_stride < 0)
> +    {
> +      int offs = (elt_offs + 1) * elt_stride;
> +
> +      elt_offs = TYPE_LENGTH (array_type) + offs;
> +    }
> +  else
> +    elt_offs *= elt_size;
> +
>
> But it does not work (attached).  Maybe because the stride of an array now
> appears to be stored into TYPE_FIELD_BITSIZE of the array itself (not its type)
> while with old Intel VLA patchset there was a special field TYPE_BYTE_STRIDE
> for that.
>
>
> Thanks,
> Jan
Hi Jan,

here is the missing patch in your environment.
https://sourceware.org/ml/gdb-patches/2015-01/msg00385.html
This patch handles strides in DWARF and your fortran program.

Christoph's patch series was about strides in user input, for example 
"print my_vla(1:10:2)"

I will create a branch about all stride patches in the next weeks.



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


  reply	other threads:[~2016-08-19  9:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <88072818E0A3D742B2B1AF16BBEC65A7263D8247@IRSMSX107.ger.corp.intel.com>
     [not found] ` <20160707095439.GA6792@host1.jankratochvil.net>
     [not found]   ` <88072818E0A3D742B2B1AF16BBEC65A7263D990E@IRSMSX107.ger.corp.intel.com>
     [not found]     ` <20160714182743.GA10672@host1.jankratochvil.net>
     [not found]       ` <88072818E0A3D742B2B1AF16BBEC65A7263E6F2E@IRSMSX107.ger.corp.intel.com>
     [not found]         ` <20160715091352.GA8059@host1.jankratochvil.net>
     [not found]           ` <88072818E0A3D742B2B1AF16BBEC65A7263E8FD9@IRSMSX107.ger.corp.intel.com>
     [not found]             ` <20160716151310.GA14331@host1.jankratochvil.net>
     [not found]               ` <20160716151837.GA797@host1.jankratochvil.net>
     [not found]                 ` <88072818E0A3D742B2B1AF16BBEC65A7263F0988@IRSMSX107.ger.corp.intel.com>
2016-08-16 13:59                   ` Jan Kratochvil
2016-08-19  9:58                     ` Bernhard Heckel [this message]
2016-08-21 17:04                       ` Jan Kratochvil
2016-08-23 13:34                         ` Bernhard Heckel
2016-08-25 17:06                           ` Jan Kratochvil
2016-08-25 17:22                             ` Jan Kratochvil
2016-08-26  7:17                               ` Jan Kratochvil
2016-09-01 10:11                                 ` Bernhard Heckel
2016-09-02 13:44                             ` Bernhard Heckel
2016-09-04 17:15                               ` Jan Kratochvil
2016-09-07 10:29                                 ` Bernhard Heckel
2016-09-07 20:05                                   ` Jan Kratochvil
2016-09-12 21:05                                   ` Jan Kratochvil
2016-09-14  7:24                                     ` Bernhard Heckel
2016-09-14 12:53                                       ` Jan Kratochvil
2016-09-07 20:24                                 ` Jan Kratochvil
2016-09-01  9:48                           ` Jan Kratochvil
2015-01-14 13:49 Keven Boell
2015-05-28 20:36 ` Jan Kratochvil
2015-05-28 20:52   ` Joel Brobecker
2015-06-14  8:15 ` Jan Kratochvil
2015-06-17 11:42   ` Boell, Keven
2015-07-01 12:43     ` Keven Boell
2016-07-07  8:30 ` Jan Kratochvil
2016-07-07  9:16   ` Bernhard Heckel
2016-07-07  9:23     ` Jan Kratochvil

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=57B6D831.4080605@intel.com \
    --to=bernhard.heckel@intel.com \
    --cc=christoph.t.weinmann@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /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