public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jacob Bachmeyer <jcb62281@gmail.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb@sourceware.org, "dejagnu@gnu.org" <dejagnu@gnu.org>
Subject: Re: GDB testsuite overrides default_target_compile and breaks
Date: Fri, 19 Jun 2020 19:00:30 -0500	[thread overview]
Message-ID: <5EED519E.6050209@gmail.com> (raw)
In-Reply-To: <875zbnz00s.fsf@tromey.com>

Tom Tromey wrote:
> Jacob> What is needed in brief:
> Jacob> (1) Merge the features of default_target_compile that the GDB
> Jacob> testsuite depends on upstream for 1.6.3.
> Jacob> (2) Find the actual extensibility that GDB needs here and add that
> Jacob> support to the default_target_compile rewrite slated for 1.6.4.
>
> Sounds reasonable to me.
>
> Jacob> The changes were to an internal component and broke an out-of-tree
> Jacob> copy of same.  I have to draw a line somewhere, and "monkeypatching
> Jacob> the core is not supported and can break" is necessary for DejaGnu to
> Jacob> develop at all.
>
> FWIW this makes sense to me.  I think it's never been a great idea to
> have this override in gdb.  Dejagnu wasn't very actively maintained for
> a long time, and had low engagement from gdb developers, so it was more
> like a convenient way to move forward.
>   

 From how it was explained to me, that may have been the only way 
forward at the time.

> Jacob> Monkeypatching the DejaGnu core is not supported and cannot be
> Jacob> supported long-term.
>
> gdb does it other spots as well.  For example, check-test-names.exp
> overrides log_summary and reset_vars that gdb can show duplicated test
> names, and gdb.exp renames "cd" to avoid problems with relative log file
> names.
>   

I will look into these and see what we can do to move generally useful 
functionality upstream.  (There are many features in the GDB testsuite 
that I eventually want in DejaGnu, like parallel testing, although the 
core implementation of that might be somewhat different as I want it to 
be as close to transparent as possible.)

Quick checks on those examples suggest that they will not cause problems 
(until the overridden procedures disappear into an internal namespace) 
because check-test-names.exp wraps log_summary and reset_vars instead of 
replacing them with out-of-tree copies.  Wrapping "cd" avoids problems 
for similar reasons (technically that one is monkeypatching Tcl itself 
rather than DejaGnu) but DejaGnu's own initialization procedures should 
probably ensure that the log file is active with an absolute file name.

I might have to add a "monkeypatch the monkeypatches" module, loaded 
after the init files, to maintain backwards compatibility with the 
recent GDB releases, but that is a last resort.

> Jacob> GDB seems to have also extended default_target_compile, so a
> Jacob> discussion on this is needed because there seems to be a need for some
> Jacob> kind of language extensibility feature to allow new
> Jacob> language-default-selector options to be defined without overriding the
> Jacob> entire default_target_compile procedure
>
> Yes, that would be good to have.  I think this has been patched when a
> new language is added to gdb; changing this function to work in some
> extensible way would be a nice improvement... while there are no
> concrete plans I know of to add new languages to gdb, one never knows
> when someone may show up with patches.
>   

The rewritten default_target_compile will be less of an "if forest" and 
more table-driven.  Language defaults then become entries in an internal 
table, so all we need is an API call for init files to add entries to 
that table.

> Jacob> If I understand correctly, merging the features currently carried in
> Jacob> gdb/testsuite/lib/future.exp upstream will cause all existing GDB 
> Jacob> releases to correctly use the upstream version of
> Jacob> default_target_compile, making the partial reversion patch
> Jacob> unnecessary.
>
> Yes, assuming that gdb's detection code continues to work.  It does
> this:
>
>     if {[info procs find_gnatmake] == ""} {
>         rename gdb_find_gnatmake find_gnatmake
>         set use_gdb_compile 1
>     }
>     # ... sequence of such checks ...
>     if {$use_gdb_compile} {
>         catch {rename default_target_compile {}}
>         rename gdb_default_target_compile default_target_compile
>     }
>   

That code is testing the existence of API procedures to decide if it 
wants to override an internal procedure.  There are no plans to remove 
find_* prior to 2.0; even if a better API ("testsuite tool"?) is 
introduced, compatibility shims will remain.  (Now that I think about 
it, even 2.0 may still carry a "compatibility mode" for the 1.x API.)

> Anyway, I compared gdb_default_target_compile with
> default_target_compile.  I think there are two kinds of changes.
>
> [...]
>
> I can write some patches to merge this stuff in.
>   

Many thanks for the patch set.  I will merge them and add documentation 
and tests over the weekend or so.


-- Jacob

      parent reply	other threads:[~2020-06-20  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87zhac871g.fsf@euler.schwinge.homeip.net>
     [not found] ` <yddsgg31yek.fsf@CeBiTec.Uni-Bielefeld.DE>
     [not found]   ` <alpine.LFD.2.21.2005140026530.6492@redsun52.ssa.fujisawa.hgst.com>
     [not found]     ` <yddtv0izk0d.fsf@CeBiTec.Uni-Bielefeld.DE>
     [not found]       ` <274e2a71-ddb0-18cc-70c1-4ca9ccf8bd29@welcomehome.org>
     [not found]         ` <alpine.LFD.2.21.2005150018250.6492@redsun52.ssa.fujisawa.hgst.com>
     [not found]           ` <9a017568-911d-9352-859a-8721b2f47c53@welcomehome.org>
     [not found]             ` <alpine.LFD.2.21.2005170030180.21168@redsun52.ssa.fujisawa.hgst.com>
     [not found]               ` <29b3fe32-b3c9-653e-2ef3-6e89083188f6@welcomehome.org>
     [not found]                 ` <alpine.LFD.2.21.2005170507350.21168@redsun52.ssa.fujisawa.hgst.com>
     [not found]                   ` <a2e631fb-b0b1-f014-2ddd-5689f9957c73@welcomehome.org>
     [not found]                     ` <3e294014-8205-c99c-ecc7-3e9d383e5587@welcomehome.org>
     [not found]                       ` <alpine.LFD.2.21.2005270215160.21168@redsun52.ssa.fujisawa.hgst.com>
     [not found]                         ` <a1663bde-47b1-c86a-fb01-d8527365f55b@welcomehome.org>
     [not found]                           ` <alpine.LFD.2.21.2006031253380.9519@redsun52.ssa.fujisawa.hgst.com>
     [not found]                             ` <5EE04696.8090209@gmail.com>
     [not found]                               ` <5EE05F15.4070408@gmail.com>
2020-06-10 16:37                                 ` dejagnu version update? [CORRECTION: not a regression in DejaGnu; GDB testsuite bug] Maciej W. Rozycki
2020-06-11  2:43                                   ` GDB testsuite overrides default_target_compile and breaks Jacob Bachmeyer
2020-06-19 12:57                                     ` Tom Tromey
2020-06-19 15:11                                       ` Rob Savoye
2020-06-20  0:00                                       ` Jacob Bachmeyer [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=5EED519E.6050209@gmail.com \
    --to=jcb62281@gmail.com \
    --cc=dejagnu@gnu.org \
    --cc=gdb@sourceware.org \
    --cc=tromey@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).