Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>,
	       Phil Muldoon <pmuldoon@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] compile: Use libcc1.so->libcc1.so.0
Date: Thu, 23 Apr 2015 11:59:00 -0000	[thread overview]
Message-ID: <5538DEAB.1090507@redhat.com> (raw)
In-Reply-To: <20150423114745.GA5268@host1.jankratochvil.net>

On 04/23/2015 12:47 PM, Jan Kratochvil wrote:
> On Thu, 23 Apr 2015 12:52:56 +0200, Phil Muldoon wrote:
>> On 23/04/15 06:29, Jan Kratochvil wrote:
>>>
>>> So you request forward/backward compatibilities, specifically:
>>>
>>> (1) Do you request future gdb-7.10 is compatible with existing gcc-5.x?
>>>
>>> (2) Do you request future gcc-6.0  is compatible with existing gdb-7.9?
>>>
>>> With an answer for (1) and (2) we can decide on how to implement it.
>>
>> Both! ;)
> 
> While (1) could be possibly useful personally I do not find
> the compatibility (2) useful.
> 
> 
>> I don't think a version change merits that. And the change is tiny:
>> just one more parameter for a function. You could avoid it by having
>> two public methods exported in the vtable: foo (old params), foo (old
>> params, new params) and then re-factoring out the old function to
>> foo_worker_1 and have the two "foo" functions call foo_worker_1 with
>> the new parameter or NULL in its place.
> 
> I do not see so clear how to implement it.
> 
> If GDB changes:
> gdb/compile/compile-c-support.c:110: context = (*func) (GCC_FE_VERSION_0, GCC_C_FE_VERSION_0);
> ->
> gdb/compile/compile-c-support.c:110: context = (*func) (GCC_FE_VERSION_1, GCC_C_FE_VERSION_0);
> then compatibiity (1) is violated.  Besides that you said no new API version
> should be introduced.

Here's what I suggest.  I'm not sure whether it should be GCC_FE_VERSION_0 or
GCC_C_FE_VERSION_0 that should be bumped in this case, but, assuming the former,
you'd solve this by first making (and documenting) the vtable of v1 compatible
with v0.  Then have gdb do:

   context = (*func) (GCC_FE_VERSION_1, GCC_C_FE_VERSION_0);
   if (context == NULL)
      context = (*func) (GCC_FE_VERSION_0, GCC_C_FE_VERSION_0);

For as long as gdb supports both v1 and v0, places that call the
v1-only functions must check that they're talking to a v1 context
before calling through the function pointer, of course.

On the plugin side do something like:

   if (version == 0 || version == 1)
    {
      // v1 is compatible with v0, and we're
         supporting v0 for a while.
      context->version = version;
      return context;
    }
   else
    {
       // error.
    }

Thanks,
Pedro Alves


  reply	other threads:[~2015-04-23 11:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21 21:36 Jan Kratochvil
2015-04-21 21:38 ` mail dup cancel: " Jan Kratochvil
2015-04-22 21:13 ` Phil Muldoon
2015-04-23  5:29   ` Jan Kratochvil
2015-04-23 10:53     ` Phil Muldoon
2015-04-23 11:24       ` Pedro Alves
2015-04-23 11:47       ` Jan Kratochvil
2015-04-23 11:59         ` Pedro Alves [this message]
2015-04-23 11:42 ` Pedro Alves
2015-04-23 11:51   ` Jan Kratochvil
2015-04-23 11:52   ` Jan Kratochvil
2015-04-23 12:07     ` Pedro Alves
2015-04-23 12:24       ` Jan Kratochvil

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=5538DEAB.1090507@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=pmuldoon@redhat.com \
    /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