From patchwork Fri Jul 18 15:19:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 2106 Received: (qmail 6414 invoked by alias); 18 Jul 2014 15:19:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 6405 invoked by uid 89); 18 Jul 2014 15:19:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Jul 2014 15:19:52 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6IFJn7V027172 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Jul 2014 11:19:49 -0400 Received: from host2.jankratochvil.net (ovpn-116-54.ams2.redhat.com [10.36.116.54]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6IFJjlL013611 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 18 Jul 2014 11:19:48 -0400 Date: Fri, 18 Jul 2014 17:19:45 +0200 From: Jan Kratochvil To: Keven Boell Cc: gdb-patches@sourceware.org, sanimir.agovic@intel.com Subject: Re: [V2 09/23] vla: changed string length semantic. Message-ID: <20140718151945.GA11512@host2.jankratochvil.net> References: <1405070495-6948-1-git-send-email-keven.boell@intel.com> <1405070495-6948-10-git-send-email-keven.boell@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1405070495-6948-10-git-send-email-keven.boell@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi Keven, the regression discussed in Re: [V2 00/23] Fortran dynamic array support https://sourceware.org/ml/gdb-patches/2014-07/msg00278.html is IMO here: On Fri, 11 Jul 2014 11:21:21 +0200, Keven Boell wrote: > @@ -14590,8 +14680,26 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, > baton = obstack_alloc (obstack, sizeof (*baton)); > baton->referenced_type = die_type (target_die, target_cu); > baton->locexpr.per_cu = cu->per_cu; > - baton->locexpr.size = DW_BLOCK (target_attr)->size; > - baton->locexpr.data = DW_BLOCK (target_attr)->data; > + > + if (additional_data != NULL && additional_data_size > 0) > + { > + gdb_byte *data; > + > + data = obstack_alloc (&cu->objfile->objfile_obstack, > + DW_BLOCK (attr)->size + additional_data_size); > + memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size); > + memcpy (data + DW_BLOCK (attr)->size, > + additional_data, additional_data_size); > + > + baton->locexpr.data = data; > + baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size; > + } > + else > + { > + baton->locexpr.data = DW_BLOCK (attr)->data; > + baton->locexpr.size = DW_BLOCK (attr)->size; > + } > + > prop->data.baton = baton; > prop->kind = PROP_LOCEXPR; > gdb_assert (prop->data.baton != NULL); it was correctly using 'target_attr' but now it uses 'attr' instead. The gdb.ada/ regression gets fixed for me by the attached patch. Jan diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e4f5240..f3e3f56 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -14684,18 +14684,20 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, gdb_byte *data; data = obstack_alloc (&cu->objfile->objfile_obstack, - DW_BLOCK (attr)->size + additional_data_size); - memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size); - memcpy (data + DW_BLOCK (attr)->size, + DW_BLOCK (target_attr)->size + additional_data_size); + memcpy (data, DW_BLOCK (target_attr)->data, + DW_BLOCK (target_attr)->size); + memcpy (data + DW_BLOCK (target_attr)->size, additional_data, additional_data_size); baton->locexpr.data = data; - baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size; + baton->locexpr.size = (DW_BLOCK (target_attr)->size + + additional_data_size); } else { - baton->locexpr.data = DW_BLOCK (attr)->data; - baton->locexpr.size = DW_BLOCK (attr)->size; + baton->locexpr.data = DW_BLOCK (target_attr)->data; + baton->locexpr.size = DW_BLOCK (target_attr)->size; } prop->data.baton = baton;