From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113564 invoked by alias); 12 Apr 2019 11:47:47 -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 113553 invoked by uid 89); 12 Apr 2019 11:47:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mail-wr1-f67.google.com Received: from mail-wr1-f67.google.com (HELO mail-wr1-f67.google.com) (209.85.221.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Apr 2019 11:47:45 +0000 Received: by mail-wr1-f67.google.com with SMTP id w10so11567277wrm.4 for ; Fri, 12 Apr 2019 04:47:45 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id y17sm48669797wrh.60.2019.04.12.04.47.43 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 04:47:43 -0700 (PDT) Subject: Re: [PATCH] gdb: Remove LANG_MAGIC To: Andrew Burgess Cc: gdb-patches@sourceware.org References: <20190411232350.27832-1-andrew.burgess@embecosm.com> <17891e32-a9e8-a472-bfb1-37bb78bbeaa5@redhat.com> <20190412110812.GE2737@embecosm.com> From: Pedro Alves Message-ID: <2b2f2a1c-1a57-6148-92e1-3a7e12a3d962@redhat.com> Date: Fri, 12 Apr 2019 11:47:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190412110812.GE2737@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-04/txt/msg00221.txt.bz2 On 4/12/19 12:08 PM, Andrew Burgess wrote: > * Pedro Alves [2019-04-12 10:50:00 +0100]: > >> On 4/12/19 12:23 AM, Andrew Burgess wrote: >>> The language_defn structure has an la_magic field, this used to be >>> used as a basic check that the language_defn structure had the >>> expected layout - at least the end of the structure was where we >>> expected it to be. >>> >>> This feature only really makes sense if we imagine GDB dynamically >>> loading language support from dynamic libraries, where a version >>> mismatch might cause problems. >> >> We used to have more magic fields like these in other structures, >> like target_ops, for example. IIRC, their intended purpose was to >> catch miscompilation, before we had Makefile auto-dependencies. Before >> that, it was common to change the structure's definition, rebuild, and >> then find out that gdb hit a "failed internal consistency check" assertion, >> because some of the .o files hadn't been rebuilt to reflect the new layout. >> >> For example, the target_ops magic said: >> >> /* Magic number for checking ops size. If a struct doesn't end with this >> number, somebody changed the declaration but didn't change all the >> places that initialize one. */ >> >> #define OPS_MAGIC 3840 >> >> With auto-dependencies, the problem this "solved" is largely a >> thing of the past. > > Thanks for the explanation, that makes sense. > > I assume you're happy that these days we should "assume a working > build system", and that if any errors like the above cropped up we > should fix those in the build dependencies, not by adding magic fields > to gdb. Yes, of course. I was the one who removed OPS_MAGIC (in f6ac5f3d63e0) :-) Thanks, Pedro Alves