public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Simon Marchi (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Andrew Burgess <andrew.burgess@embecosm.com>,	gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@sourceware.org>
Subject: [review v4] gdb/fortran: array stride support
Date: Fri, 22 Nov 2019 13:06:00 -0000	[thread overview]
Message-ID: <20191122130650.4B6B32816F@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1573743387000.I9af2bcd1f2d4c56f76f5f3f9f89d8f06bef10d9a@gnutoolchain-gerrit.osci.io>

Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/627
......................................................................


Patch Set 4:

(3 comments)

I can't assess the correctness of the patch, as I don't really know the domain, but I noted a few points.

| --- gdb/dwarf2read.c
| +++ gdb/dwarf2read.c
| @@ -18053,8 +18053,18 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|    if (low.kind == PROP_CONST
|        && !TYPE_UNSIGNED (base_type) && (low.data.const_val & negative_mask))
|      low.data.const_val |= negative_mask;
|    if (high.kind == PROP_CONST
|        && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
|      high.data.const_val |= negative_mask;
|  
| -  range_type = create_range_type (NULL, orig_base_type, &low, &high, bias);
| +  /* Check for bit and byte strides.  */
| +  struct attribute *attr_bit_stride, *attr_byte_stride;

PS4, Line 18061:

You might as well declare them on the line where you assign them.

| +  struct dynamic_prop bit_stride_prop, byte_stride_prop;
| +  attr_byte_stride = dwarf2_attr (die, DW_AT_byte_stride, cu);
| +  if (attr_byte_stride != nullptr)
| +    {
| +      struct type *prop_type
| +	= dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false);
| +      attr_to_dynamic_prop (attr_byte_stride, die, cu, &byte_stride_prop,
| +			    prop_type);
| +    }
| --- gdb/gdbtypes.c
| +++ gdb/gdbtypes.c
| @@ -942,9 +946,21 @@ create_range_type (struct type *result_type, struct type *index_type,
|       less than the lower bound, so checking the lower bound is not
|       enough.  Make sure we do not mark a range type whose upper bound
|       is negative as unsigned.  */
|    if (high_bound->kind == PROP_CONST && high_bound->data.const_val < 0)
|      TYPE_UNSIGNED (result_type) = 0;
|  
|    return result_type;
|  }
|  
| +/* Like CREATE_RANGE_TYPE but also sets up a stride.  When BYTE_STRIDE_P
| +   is true the value in STRIDE is a byte stride, otherwise STRIDE is a bit
| +   stride.  */

PS4, Line 957:

This comment should be

 /* See gdbtypes.h.  */

I know that other functions around don't adhere to this rule, but I
think for a new function, or when modifying an existing function
comment, we should do it right.

| +
| +struct type *
| +create_range_type_with_stride (struct type *result_type,
| +			       struct type *index_type,
| +			       const struct dynamic_prop *low_bound,
| +			       const struct dynamic_prop *high_bound,
| +			       LONGEST bias,
| +			       const struct dynamic_prop *stride,
| +			       bool byte_stride_p)

 ...

| @@ -2017,0 +2061,19 @@ resolve_dynamic_range (struct type *dyn_range_type,
| +    {
| +      stride.kind = PROP_CONST;
| +      stride.data.const_val = value;
| +
| +      /* If we have a bit stride that is not a multiple of the byte stride
| +	 then I really don't think this is going to work with current GDB.
| +	 The array indexing code in GDB seems to be pretty heavily tied to
| +	 byte offsets right now.  If this comes up then we warn the user
| +	 and set up a known incorrect stride.  */
| +      if (!byte_stride_p && (value % HOST_CHAR_BIT) != 0)

PS4, Line 2070:

Using HOST_CHAR_BIT (a few occurences in the patch) when manipulating
target data is probably not right.  You probably want to use
gdbarch_addressable_memory_unit_size, using the gdbarch from the type.

| +	error (_("bit strides that are not a multiple of the byte size "
| +		 "are currently not supported"));
| +    }
| +  else
| +    {
| +      stride.kind = PROP_UNDEFINED;
| +      stride.data.const_val = 0;
| +      byte_stride_p = true;
| +    }

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I9af2bcd1f2d4c56f76f5f3f9f89d8f06bef10d9a
Gerrit-Change-Number: 627
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-CC: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Fri, 22 Nov 2019 13:06:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

  parent reply	other threads:[~2019-11-22 13:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 14:56 [review] " Andrew Burgess (Code Review)
2019-11-15 22:36 ` Tom Tromey (Code Review)
2019-11-15 23:54 ` Andrew Burgess (Code Review)
2019-11-18 18:58 ` Tom Tromey (Code Review)
2019-11-18 21:47 ` [review v2] " Andrew Burgess (Code Review)
2019-11-18 21:50 ` Andrew Burgess (Code Review)
2019-11-18 21:55 ` [review v3] " Andrew Burgess (Code Review)
2019-11-22 10:10 ` [review v4] " Andrew Burgess (Code Review)
2019-11-22 10:12 ` Andrew Burgess (Code Review)
2019-11-22 13:06 ` Simon Marchi (Code Review) [this message]
2019-11-22 17:30 ` [review v5] " Andrew Burgess (Code Review)
2019-11-22 17:31 ` Andrew Burgess (Code Review)
2019-11-22 17:46 ` Simon Marchi (Code Review)
2019-11-28  0:45 ` [review v6] " Andrew Burgess (Code Review)
2019-11-29 23:32 ` [review v7] " Andrew Burgess (Code Review)
2019-11-29 23:35 ` Andrew Burgess (Code Review)
2019-11-30 21:47 ` [review v8] " Andrew Burgess (Code Review)
2019-11-30 22:10 ` [review v9] " Andrew Burgess (Code Review)
2019-11-30 22:11 ` Andrew Burgess (Code Review)
2019-12-01  0:09 ` Simon Marchi (Code Review)
2019-12-01  0:09 ` Simon Marchi (Code Review)
2019-12-01 22:33 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-01 22:33 ` Sourceware to Gerrit sync (Code Review)
2020-01-14  4:11 ` [PATCH] Add gdb.fortran/vla-stride.exp and report a bug (was: Re: [review] gdb/fortran: array stride support) Sergio Durigan Junior
2020-01-19  1:59   ` Andrew Burgess
2020-02-05 16:38     ` [PATCH] Add gdb.fortran/vla-stride.exp and report a bug Sergio Durigan Junior
2020-02-25 16:35       ` [PUSHED] gdb/fortran: Support negative array stride in one limited case Andrew Burgess
2020-08-06 10:41         ` Copyright status gdb.fortran/vla-stride.exp test-case Tom de Vries
2020-08-06 13:35           ` Andrew Burgess
2020-08-18  9:50             ` Tom de Vries
2020-08-18 10:12               ` Andrew Burgess
2020-12-12  6:33         ` [PUSHED] gdb/fortran: Support negative array stride in one limited case Simon Marchi
2020-12-12 22:18           ` Andrew Burgess
2020-12-13  0:51             ` Simon Marchi

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=20191122130650.4B6B32816F@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gnutoolchain-gerrit@osci.io \
    --cc=tromey@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).