From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60432 invoked by alias); 12 Apr 2019 09:50:05 -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 60415 invoked by uid 89); 12 Apr 2019 09:50:04 -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-f68.google.com Received: from mail-wr1-f68.google.com (HELO mail-wr1-f68.google.com) (209.85.221.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Apr 2019 09:50:03 +0000 Received: by mail-wr1-f68.google.com with SMTP id g3so11079245wrx.9 for ; Fri, 12 Apr 2019 02:50:03 -0700 (PDT) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id c20sm74886378wre.28.2019.04.12.02.50.00 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 12 Apr 2019 02:50:00 -0700 (PDT) Subject: Re: [PATCH] gdb: Remove LANG_MAGIC To: Andrew Burgess , gdb-patches@sourceware.org References: <20190411232350.27832-1-andrew.burgess@embecosm.com> From: Pedro Alves Message-ID: <17891e32-a9e8-a472-bfb1-37bb78bbeaa5@redhat.com> Date: Fri, 12 Apr 2019 09:50: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: <20190411232350.27832-1-andrew.burgess@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-04/txt/msg00217.txt.bz2 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, Pedro Alves