From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22218 invoked by alias); 16 Dec 2013 15:21:00 -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 22198 invoked by uid 89); 16 Dec 2013 15:20:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Dec 2013 15:20:58 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 16 Dec 2013 07:20:52 -0800 X-ExtLoop1: 1 Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga001.fm.intel.com with ESMTP; 16 Dec 2013 07:20:29 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.215]) by IRSMSX102.ger.corp.intel.com ([169.254.2.114]) with mapi id 14.03.0123.003; Mon, 16 Dec 2013 15:20:24 +0000 From: "Agovic, Sanimir" To: 'Doug Evans' CC: "tromey@redhat.com" , "palves@redhat.com" , "gdb-patches@sourceware.org" , "Boell, Keven" Subject: RE: [PATCH v3 05/13] vla: update type from newly created value Date: Mon, 16 Dec 2013 15:21:00 -0000 Message-ID: <0377C58828D86C4588AEEC42FC3B85A7176C9FF5@IRSMSX105.ger.corp.intel.com> References: <1386166785-28037-1-git-send-email-sanimir.agovic@intel.com> <1386166785-28037-6-git-send-email-sanimir.agovic@intel.com> In-Reply-To: Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00574.txt.bz2 > -----Original Message----- > From: Doug Evans [mailto:xdje42@gmail.com] > Sent: Friday, December 06, 2013 08:36 AM > To: Agovic, Sanimir > Cc: tromey@redhat.com; palves@redhat.com; xdje42@gmail.com; gdb-patches@s= ourceware.org; > Boell, Keven > Subject: Re: [PATCH v3 05/13] vla: update type from newly created value >=20 > > * ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from valu= e. >=20 > Hi. Can you add a comment to each of the functions that > require this, saying something like "You must do after calling me." > value_at, value_from_contents_and_address, others? >=20 Thanks Doug, below is the diff being part of v4. Please let me know it is O= K. diff --git a/gdb/valops.c b/gdb/valops.c index ec2f1f6..1bccacc 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -904,7 +904,9 @@ value_one (struct type *type) return val; } -/* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. = */ +/* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. + The type of the created value may differ from the passed type TYPE. + Make sure to retrieve values new type after this call. */ static struct value * get_value_at (struct type *type, CORE_ADDR addr, int lazy) @@ -929,7 +931,9 @@ get_value_at (struct type *type, CORE_ADDR addr, int la= zy) value_at_lazy instead. value_at_lazy simply records the address of the data and sets the lazy-evaluation-required flag. The lazy flag is tested in the value_contents macro, which is used if and when - the contents are actually required. + the contents are actually required. The type of the created value + may differ from the passed type TYPE. Make sure to retrieve values + new type after this call. Note: value_at does *NOT* handle embedded offsets; perform such adjustments before or after calling it. */ diff --git a/gdb/value.c b/gdb/value.c index f1cf4dd..3f445f8 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3193,7 +3193,8 @@ value_from_pointer (struct type *type, CORE_ADDR addr) /* Create a value of type TYPE whose contents come from VALADDR, if it is non-null, and whose memory address (in the inferior) is - ADDRESS. */ + ADDRESS. The type of the created value may differ from the passed + type TYPE. Make sure to retrieve values new type after this call. */ struct value * value_from_contents_and_address (struct type *type, Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052