From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13244 invoked by alias); 22 Nov 2019 17:31:28 -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 13226 invoked by uid 89); 22 Nov 2019 17:31:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Nov 2019 17:31:26 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 48B4120484; Fri, 22 Nov 2019 12:31:22 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 833BE20250; Fri, 22 Nov 2019 12:31:21 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 6EF8C2816F; Fri, 22 Nov 2019 12:31:21 -0500 (EST) X-Gerrit-PatchSet: 5 Date: Fri, 22 Nov 2019 17:31:00 -0000 From: "Andrew Burgess (Code Review)" To: gdb-patches@sourceware.org Cc: Simon Marchi , Tom Tromey Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review v5] gdb/fortran: array stride support X-Gerrit-Change-Id: I9af2bcd1f2d4c56f76f5f3f9f89d8f06bef10d9a X-Gerrit-Change-Number: 627 X-Gerrit-ChangeURL: X-Gerrit-Commit: 874338c54548ddbcf34c8c1827234ace78e04859 In-Reply-To: References: X-Gerrit-Comment-Date: Fri, 22 Nov 2019 12:31:20 -0500 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191122173121.6EF8C2816F@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-11/txt/msg00720.txt.bz2 Andrew Burgess has posted comments on this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/627 ...................................................................... Patch Set 5: (3 comments) All issues addressed. | --- 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: Done. | + 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: Done. | + | +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: I don't think that gdbarch_addressable_memory_unit_size is what I want. From it's comment in gdbarch.h: /* Return the size in 8-bit bytes of an addressable memory unit on this architecture. This corresponds to the number of 8-bit bytes associated to each address in memory. */ While what I want is the number of bits in a byte, which is available as... wait for it.... TARGET_CHAR_BIT. I don't know what I was thinking when I originally used HOST_CHAR_BIT. Thanks for pointing this out. | + 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: 5 Gerrit-Owner: Andrew Burgess Gerrit-Reviewer: Andrew Burgess Gerrit-CC: Simon Marchi Gerrit-CC: Tom Tromey Gerrit-Comment-Date: Fri, 22 Nov 2019 17:31:20 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Simon Marchi Gerrit-MessageType: comment