From patchwork Fri Apr 3 13:02:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 5997 Received: (qmail 130515 invoked by alias); 3 Apr 2015 13:02:44 -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 130505 invoked by uid 89); 3 Apr 2015 13:02:44 -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, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 03 Apr 2015 13:02:43 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 30BAB2D4E396; Fri, 3 Apr 2015 15:02:40 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qCJ50bbWpX2O; Fri, 3 Apr 2015 15:02:40 +0200 (CEST) Received: from [10.10.1.112] (cacatoes.act-europe.fr [10.10.1.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 1A6E12D4E38F; Fri, 3 Apr 2015 15:02:40 +0200 (CEST) Message-ID: <551E8F70.9070408@adacore.com> Date: Fri, 03 Apr 2015 15:02:40 +0200 From: Pierre-Marie de Rodat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Joel Brobecker CC: GDB Patches Subject: Re: [PATCH] Do not consider reference types as dynamic References: <54FEDC09.3050106@adacore.com> <20150323133627.GG5438@adacore.com> <551BB1C9.10006@adacore.com> <551E5309.7090509@adacore.com> <20150403124724.GC4704@adacore.com> In-Reply-To: <20150403124724.GC4704@adacore.com> X-IsSubscribed: yes On 04/03/2015 02:47 PM, Joel Brobecker wrote: > This is OK, thank you, Pierre-Marie. Cool! Thank you for the review! > Note that the parameter "top_level" is no longer useful after > this patch is applied, which is actually quite a nice side-effect > of this patch. I hum'ed and ah'ed about whether to ask that it be > removed as part of this patch, but in the end, I decided that this patch > was fine without the cleanup, as "top_level" is used a several places, > and I felt that cleaning it up here would dilute a bit the essence of > this patch. So, I think we can clean it up separately. Oh, you are right, I did not notice this. The attached patch does this cleanup. No regression on x86_64-linux. Better to push these two in the same time. ;-) [PATCH] gdbtypes.c: remove the usuned "top_level" parameter This paramater is no longer useful after the previous commit, so remove it as a cleanup. gdb/ChangeLog: * gdbtypes.c (is_dynamic_type_internal): Remove the unused "top_level" parameter. (resolve_dynamic_type_internal): Remove the unused "top_level" parameter. Update call to is_dynamic_type_internal. (is_dynamic_type): Update call to is_dynamic_type_internal. (resolve_dynamic_range): Update call to resolve_dynamic_type_internal. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (resolve_dynamic_type): Likewise. From 3e0a648d8c966e902a3d1c2779b499535d3f443b Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Fri, 3 Apr 2015 14:53:12 +0200 Subject: [PATCH] gdbtypes.c: remove the usuned "top_level" parameter This paramater is no longer useful after the previous commit, so remove it as a cleanup. gdb/ChangeLog: * gdbtypes.c (is_dynamic_type_internal): Remove the unused "top_level" parameter. (resolve_dynamic_type_internal): Remove the unused "top_level" parameter. Update call to is_dynamic_type_internal. (is_dynamic_type): Update call to is_dynamic_type_internal. (resolve_dynamic_range): Update call to resolve_dynamic_type_internal. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (resolve_dynamic_type): Likewise. --- gdb/gdbtypes.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 6fb2e9a..4aec5ec 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1748,7 +1748,7 @@ stub_noname_complaint (void) /* Worker for is_dynamic_type. */ static int -is_dynamic_type_internal (struct type *type, int top_level) +is_dynamic_type_internal (struct type *type) { type = check_typedef (type); @@ -1773,7 +1773,7 @@ is_dynamic_type_internal (struct type *type, int top_level) of the range type are static. It allows us to assume that the subtype of a static range type is also static. */ return (!has_static_range (TYPE_RANGE_DATA (type)) - || is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0)); + || is_dynamic_type_internal (TYPE_TARGET_TYPE (type))); } case TYPE_CODE_ARRAY: @@ -1782,9 +1782,9 @@ is_dynamic_type_internal (struct type *type, int top_level) /* The array is dynamic if either the bounds are dynamic, or the elements it contains have a dynamic contents. */ - if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type), 0)) + if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type))) return 1; - return is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0); + return is_dynamic_type_internal (TYPE_TARGET_TYPE (type)); } case TYPE_CODE_STRUCT: @@ -1794,7 +1794,7 @@ is_dynamic_type_internal (struct type *type, int top_level) for (i = 0; i < TYPE_NFIELDS (type); ++i) if (!field_is_static (&TYPE_FIELD (type, i)) - && is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0)) + && is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i))) return 1; } break; @@ -1808,11 +1808,11 @@ is_dynamic_type_internal (struct type *type, int top_level) int is_dynamic_type (struct type *type) { - return is_dynamic_type_internal (type, 1); + return is_dynamic_type_internal (type); } static struct type *resolve_dynamic_type_internal - (struct type *type, struct property_addr_info *addr_stack, int top_level); + (struct type *type, struct property_addr_info *addr_stack); /* Given a dynamic range type (dyn_range_type) and a stack of struct property_addr_info elements, return a static version @@ -1860,7 +1860,7 @@ resolve_dynamic_range (struct type *dyn_range_type, static_target_type = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (dyn_range_type), - addr_stack, 0); + addr_stack); static_range_type = create_range_type (copy_type (dyn_range_type), static_target_type, &low_bound, &high_bound); @@ -1928,7 +1928,7 @@ resolve_dynamic_union (struct type *type, continue; t = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i), - addr_stack, 0); + addr_stack); TYPE_FIELD_TYPE (resolved_type, i) = t; if (TYPE_LENGTH (t) > max_len) max_len = TYPE_LENGTH (t); @@ -1985,7 +1985,7 @@ resolve_dynamic_struct (struct type *type, TYPE_FIELD_TYPE (resolved_type, i) = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i), - &pinfo, 0); + &pinfo); gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i) == FIELD_LOC_KIND_BITPOS); @@ -2016,23 +2016,21 @@ resolve_dynamic_struct (struct type *type, static struct type * resolve_dynamic_type_internal (struct type *type, - struct property_addr_info *addr_stack, - int top_level) + struct property_addr_info *addr_stack) { struct type *real_type = check_typedef (type); struct type *resolved_type = type; struct dynamic_prop *prop; CORE_ADDR value; - if (!is_dynamic_type_internal (real_type, top_level)) + if (!is_dynamic_type_internal (real_type)) return type; if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) { resolved_type = copy_type (type); TYPE_TARGET_TYPE (resolved_type) - = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr_stack, - top_level); + = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr_stack); } else { @@ -2077,7 +2075,7 @@ resolve_dynamic_type (struct type *type, CORE_ADDR addr) { struct property_addr_info pinfo = {check_typedef (type), addr, NULL}; - return resolve_dynamic_type_internal (type, &pinfo, 1); + return resolve_dynamic_type_internal (type, &pinfo); } /* See gdbtypes.h */ -- 2.3.4