Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [4/4] RFC: dynamic arrays and DW_FORM_exprloc
@ 2011-07-15 18:25 Tom Tromey
  2011-07-15 18:28 ` Jan Kratochvil
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-07-15 18:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Kratochvil

A -gdwarf-4 regression:

-PASS: gdb.fortran/multi-dim.exp: print valid variable bound array element
+FAIL: gdb.fortran/multi-dim.exp: print valid variable bound array element

The bug here is that with DWARF 4, GCC uses DW_FORM_exprloc when
emitting the bounds of a variably-sized array.  GDB, however, only
checks for DW_FORM_block1.

Jan, any comments?

Built and regtested by the buildbot.

Tom

b/gdb/ChangeLog:
2011-07-15  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (read_subrange_type): Check for DW_FORM_exprloc for
	variable-sized array.

From fcf10915409297cb512e12e3b8ef285aa125dfc6 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Fri, 15 Jul 2011 11:35:35 -0600
Subject: [PATCH 4/4] also recognize DW_FORM_exprloc as dynamic range

---
 gdb/ChangeLog    |    5 +++++
 gdb/dwarf2read.c |    7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8a6b142..fe6f189 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8623,7 +8623,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
   if (attr)
     {
-      if (attr->form == DW_FORM_block1 || is_ref_attr (attr))
+      if (attr->form == DW_FORM_block1
+	  || attr->form == DW_FORM_exprloc
+	  || is_ref_attr (attr))
         {
           /* GCC encodes arrays with unspecified or dynamic length
              with a DW_FORM_block1 attribute or a reference attribute.
@@ -8706,7 +8708,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   /* 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)
+  if (attr && (attr->form == DW_FORM_block1
+	       || attr->form == DW_FORM_exprloc))
     TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
 
   /* Ada expects an empty array on no boundary attributes.  */
-- 
1.7.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [4/4] RFC: dynamic arrays and DW_FORM_exprloc
  2011-07-15 18:25 [4/4] RFC: dynamic arrays and DW_FORM_exprloc Tom Tromey
@ 2011-07-15 18:28 ` Jan Kratochvil
  2011-07-15 20:58   ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2011-07-15 18:28 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Fri, 15 Jul 2011 20:08:51 +0200, Tom Tromey wrote:
> A -gdwarf-4 regression:
> 
> -PASS: gdb.fortran/multi-dim.exp: print valid variable bound array element
> +FAIL: gdb.fortran/multi-dim.exp: print valid variable bound array element
> 
> The bug here is that with DWARF 4, GCC uses DW_FORM_exprloc when
> emitting the bounds of a variably-sized array.  GDB, however, only
> checks for DW_FORM_block1.
> 
> Jan, any comments?
[...]
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -8623,7 +8623,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
>    attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
>    if (attr)
>      {
> -      if (attr->form == DW_FORM_block1 || is_ref_attr (attr))
> +      if (attr->form == DW_FORM_block1
> +	  || attr->form == DW_FORM_exprloc
> +	  || is_ref_attr (attr))
and
> -  if (attr && attr->form == DW_FORM_block1)
> +  if (attr && (attr->form == DW_FORM_block1
> +	       || attr->form == DW_FORM_exprloc))

archer-jankratochvil-vla handles DW_FORM_exprloc by using attr_form_is_block
here.  But that may be outside of the scope of this patch, this change is OK.


Thanks,
Jan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [4/4] RFC: dynamic arrays and DW_FORM_exprloc
  2011-07-15 18:28 ` Jan Kratochvil
@ 2011-07-15 20:58   ` Tom Tromey
  2011-07-18 15:46     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-07-15 20:58 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> archer-jankratochvil-vla handles DW_FORM_exprloc by using
Jan> attr_form_is_block here.  But that may be outside of the scope of
Jan> this patch, this change is OK.

I will change it to use attr_form_is_block; that seems totally
reasonable to me.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [4/4] RFC: dynamic arrays and DW_FORM_exprloc
  2011-07-15 20:58   ` Tom Tromey
@ 2011-07-18 15:46     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2011-07-18 15:46 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

Jan> archer-jankratochvil-vla handles DW_FORM_exprloc by using
Jan> attr_form_is_block here.  But that may be outside of the scope of
Jan> this patch, this change is OK.

Tom> I will change it to use attr_form_is_block; that seems totally
Tom> reasonable to me.

Here is what I am checking in.

Tom

2011-07-15  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (read_subrange_type): Use attr_form_is_block when
	checking for variable-sized array.

From 6ccb8e249bfe359df263dd9d179ad6b88f3490ef Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Fri, 15 Jul 2011 11:35:35 -0600
Subject: [PATCH 4/4] also recognize DW_FORM_exprloc as dynamic range

---
 gdb/ChangeLog    |    5 +++++
 gdb/dwarf2read.c |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8a6b142..b397af9 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8623,7 +8623,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
   if (attr)
     {
-      if (attr->form == DW_FORM_block1 || is_ref_attr (attr))
+      if (attr_form_is_block (attr) || is_ref_attr (attr))
         {
           /* GCC encodes arrays with unspecified or dynamic length
              with a DW_FORM_block1 attribute or a reference attribute.
@@ -8706,7 +8706,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   /* 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)
+  if (attr && attr_form_is_block (attr))
     TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
 
   /* Ada expects an empty array on no boundary attributes.  */
-- 
1.7.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-18 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-15 18:25 [4/4] RFC: dynamic arrays and DW_FORM_exprloc Tom Tromey
2011-07-15 18:28 ` Jan Kratochvil
2011-07-15 20:58   ` Tom Tromey
2011-07-18 15:46     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox