[PATCH v2 5/8] Generate new gdbarch-components.py from gdbarch.sh

Tom Tromey tom@tromey.com
Fri Dec 17 21:52:28 GMT 2021


>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:

Pedro> This gave me pause, until I saw an entry with more than one
Pedro> argument.  Do you think it would be possible to tweak the
Pedro> generator to avoid putting the comma after the last entry, so
Pedro> that we'd get:
Pedro>      params=(("readable_regcache *", "regcache")),
Pedro> ?

As Simon and John pointed out, this isn't possible due to a quirk of
Python syntax:

    >>> (1,2) == ((1,2))
    True

However we can use a list instead.  This is mildly less idiomatic (it's
more normal, I think, to use tuples for non-extensible sequences) but
avoids the weirdess.  This will look like

     params=[("readable_regcache *", "regcache")]

I'll see if I can do this.

Tom


More information about the Gdb-patches mailing list