From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9321 invoked by alias); 10 Apr 2014 14:22:16 -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 9310 invoked by uid 89); 10 Apr 2014 14:22:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN autolearn=no version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 10 Apr 2014 14:22:15 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D38E211612D; Thu, 10 Apr 2014 10:22:12 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TOAVVQkpkmU8; Thu, 10 Apr 2014 10:22:12 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A0F34116110; Thu, 10 Apr 2014 10:22:12 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id A7B1EE0E11; Thu, 10 Apr 2014 07:22:15 -0700 (PDT) Date: Thu, 10 Apr 2014 14:22:00 -0000 From: Joel Brobecker To: Sanimir Agovic Cc: gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: [PATCH v6 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence Message-ID: <20140410142215.GB15965@adacore.com> References: <1397133617-26681-1-git-send-email-sanimir.agovic@intel.com> <1397133617-26681-10-git-send-email-sanimir.agovic@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1397133617-26681-10-git-send-email-sanimir.agovic@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-04/txt/msg00179.txt.bz2 > A variable location might be a constant value and therefore no inferior memory > access is needed to read the content. In this case try to resolve the type > bounds. > > 2013-11-26 Sanimir Agovic > Keven Boell > > * findvar.c (default_read_var_value): Resolve dynamic bounds if location > points to a constant blob. Approved, but you forgot one little request of mine... See below: > Signed-off-by: Sanimir Agovic > --- > gdb/findvar.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/gdb/findvar.c b/gdb/findvar.c > index ec6afd6..d54637c 100644 > --- a/gdb/findvar.c > +++ b/gdb/findvar.c > @@ -441,7 +441,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) > switch (SYMBOL_CLASS (var)) > { > case LOC_CONST: > - /* Put the constant back in target format. */ > + if (is_dynamic_type (type)) > + /* Value is a constant byte-sequence and needs no memory access. */ > + type = resolve_dynamic_type (type, /* Unused address. */ 0); > + /* Put the constant back in target format. */ Joel: Although not required by C, we prefer in the GDB project to still Joel: use curly braces around the if block. The reason is that the comment Joel: visually looks like a statement, so it looks like the if block as Joel: more than one statement, hence the use of curly braces... Same below. > v = allocate_value (type); > store_signed_integer (value_contents_raw (v), TYPE_LENGTH (type), > gdbarch_byte_order (get_type_arch (type)), > @@ -468,6 +471,9 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) > return v; > > case LOC_CONST_BYTES: > + if (is_dynamic_type (type)) > + /* Value is a constant byte-sequence and needs no memory access. */ > + type = resolve_dynamic_type (type, /* Unused address. */ 0); > v = allocate_value (type); > memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), > TYPE_LENGTH (type)); > -- > 1.8.4.2 -- Joel