From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Tom Tromey <tromey@redhat.com>, Chandru <chandru@in.ibm.com>,
gdb-patches@sourceware.org
Subject: Re: gdb can't print array element for fortran
Date: Tue, 16 Mar 2010 21:04:00 -0000 [thread overview]
Message-ID: <20100316210407.GA31417@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20100316151621.GB3830@adacore.com>
On Tue, 16 Mar 2010 16:16:21 +0100, Joel Brobecker wrote:
> This seems like a reasonable workaround, especially since we already
> have some special handling of attr->form == DW_FORM_block1 for range
> types. So I guess we never have block2/block4 or even block attributes
> for the upper bound in practice?
* I cannot imagine a case something else than DW_FORM_block1 would be used but
sure GDB should handled all the DW_FORM_block* cases to be correct.
* The maintained offtrunk patch archer-jankratochvil-vla is using
attr_form_is_block() for the full DW_FORM_block* support.
* As the existing FSF GDB code was already limited to DW_FORM_block1.
* The new patch code fragment application scope should match the scope of the
existing FSF GDB code.
* This patch will need to be reverted/merged-out on future import of some form
of the archer-jankratochvil-vla branch therefore I wanted to minimize any
effort for its import as it should have been spent rather on preparing
archer-jankratochvil-vla for the merge instead.
=> Chose the minimal patchset satisfying Chandru's requirements.
> > range_type = create_range_type (NULL, base_type, low, high);
> >
> > + if (attr && attr->form == DW_FORM_block1)
> > + TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
>
> Can you add a quick comment, with a FIXME to show that this is temporary?
> There's already some useful comments just slightly earlier in the code,
> perhaps we just ought to refer to that, somehow.
Done (forgot the FIXME keyword I see now, sorry).
> Pre-approved with the addition of the comment.
Checked-in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2010-03/msg00158.html
--- src/gdb/ChangeLog 2010/03/16 18:47:14 1.11491
+++ src/gdb/ChangeLog 2010/03/16 20:51:23 1.11492
@@ -1,3 +1,10 @@
+2010-03-16 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Chandru <chandru@in.ibm.com>
+
+ * dwarf2read.c (read_subrange_type): Set TYPE_HIGH_BOUND_UNDEFINED.
+ * valarith.c (value_subscripted_rvalue): Suppress error if
+ TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
+
2010-03-16 Holger Hans Peter Freyther <zecke@selfish.org>
* linux-record.c (record_linux_msghdr): Remove unintended semicolons.
--- src/gdb/dwarf2read.c 2010/03/15 20:49:53 1.368
+++ src/gdb/dwarf2read.c 2010/03/16 20:51:23 1.369
@@ -6074,6 +6074,12 @@
range_type = create_range_type (NULL, base_type, low, high);
+ /* Mark arrays with dynamic length at least as an array of unspecified
+ length. GDB could check the boundary but before it gets implemented at
+ least allow accessing the array elements. */
+ if (attr && attr->form == DW_FORM_block1)
+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
+
name = dwarf2_name (die, cu);
if (name)
TYPE_NAME (range_type) = name;
--- src/gdb/valarith.c 2010/02/11 21:45:25 1.81
+++ src/gdb/valarith.c 2010/03/16 20:51:23 1.82
@@ -198,7 +198,8 @@
unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound);
struct value *v;
- if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type))
+ if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type)
+ && elt_offs >= TYPE_LENGTH (array_type)))
error (_("no such vector element"));
v = allocate_value (elt_type);
next prev parent reply other threads:[~2010-03-16 21:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-12 13:06 Chandru
2010-03-15 17:13 ` Joel Brobecker
2010-03-15 20:52 ` Tom Tromey
2010-03-15 23:46 ` Jan Kratochvil
2010-03-16 15:16 ` Joel Brobecker
2010-03-16 21:04 ` Jan Kratochvil [this message]
2010-03-18 11:24 Nick Roberts
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=20100316210407.GA31417@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=brobecker@adacore.com \
--cc=chandru@in.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@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