From: Pedro Alves <palves@redhat.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Remove LANG_MAGIC
Date: Fri, 12 Apr 2019 11:47:00 -0000 [thread overview]
Message-ID: <2b2f2a1c-1a57-6148-92e1-3a7e12a3d962@redhat.com> (raw)
In-Reply-To: <20190412110812.GE2737@embecosm.com>
On 4/12/19 12:08 PM, Andrew Burgess wrote:
> * Pedro Alves <palves@redhat.com> [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
prev parent reply other threads:[~2019-04-12 11:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-11 23:24 Andrew Burgess
2019-04-12 4:37 ` Simon Marchi
2019-04-12 9:50 ` Pedro Alves
[not found] ` <20190412110812.GE2737@embecosm.com>
2019-04-12 11:47 ` Pedro Alves [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b2f2a1c-1a57-6148-92e1-3a7e12a3d962@redhat.com \
--to=palves@redhat.com \
--cc=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox