From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4351 invoked by alias); 14 Nov 2018 23:51:59 -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 4340 invoked by uid 89); 14 Nov 2018 23:51:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=firm, management 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 ESMTP; Wed, 14 Nov 2018 23:51:57 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 48C68560D6; Wed, 14 Nov 2018 18:51:56 -0500 (EST) 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 jLQQhwd6fYB1; Wed, 14 Nov 2018 18:51:56 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id F246756051; Wed, 14 Nov 2018 18:51:55 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 98B49849EA; Wed, 14 Nov 2018 15:51:53 -0800 (PST) Date: Wed, 14 Nov 2018 23:51:00 -0000 From: Joel Brobecker To: Wei-min Pan Cc: gdb-patches@sourceware.org Subject: Re: [PATCH PR gdb/20057] Internal error on trying to set {char[]}$pc="string" Message-ID: <20181114235153.GB4336@adacore.com> References: <1516844738-79996-1-git-send-email-weimin.pan@oracle.com> <20180125041431.tghhxefsgxnxh3l3@adacore.com> <1dfc87b0-353d-3388-a427-fee247dc79a5@oracle.com> <20180131074526.rqbsjxyxp3p26js5@adacore.com> <1d28e9c6-6377-0c46-6bce-1dc25a7fa2d5@oracle.com> <20180201075955.mnqxzmw4ktuy3f5d@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2018-11/txt/msg00235.txt.bz2 > > > > Unfortunately, I only have vague answers for you. I know it's not > > > > as satisfactory as a firm one, but I haven't had time to investigate > > > > further. > > > > > > > > My feeling is that it's (intuitively) a bad idea to start mixing > > > > and matching the ownership type for a give type chain. It just > > > > muddies the waters, and makes memory management more complex. > > > Given there are functions such as arch_integer_type(), > > > arch_character_type(), > > > and arch_float_type() that can be used to add types to an arch, it doesn't > > > seem terribly wrong to add a type which is not associated with any objfile > > > to gdbarch? Also a type can actually exist in both an arch and an objfile. > > I am not sure we understand each other. For me, what seems wrong > > is the fact that we have an array type where part of the type is > > objfile-owned, and part of it arch-owned. > > > > Creating arch-owned type is fine, as long as the entire type is > > arch-owned. > > Sorry, I just don't see how it's possible to have an array type where > part of the type is objfile-owned and part of it arch-owned. When an > array type is copied, the space allocation depends on whether or not > the element type is defined in the program. If it is defined, space > for the index type, range type, and array type itself are all > allocated from that object file. Otherwise, they are all allocated > from the arch. I am not sure I understand what you are saying. On my end, I am precisely saying that we should not create a type where we have a mix and match. And if I read this last message correctly, you are saying you don't see how it's possible to be doing that. So, on the surface, your last message seems to be in agreement with the property I am saying we should preserve. But aren't you reporting a situation where we are actually trying to create a type with inconsistent ownership? Otherwise, I don't see why we would have triggered the assertion failure you reported. -- Joel