[PATCH 6/8] Add new gdbarch generator

Simon Marchi simon.marchi@polymtl.ca
Thu Dec 16 02:01:39 GMT 2021


On 2021-12-15 17:45, Tom Tromey wrote:
> From: Simon Marchi <simon.marchi@efficios.com>
> 
> The new gdbarch generator is a Python program.  It reads the
> "components.py" that was created in the previous patch, and generates
> gdbarch.c and gdbarch-gen.h.
> 
> This was initially written by Simon, so I've put him as the author.
> Thank you, Simon.
> 
> This is a relatively straightforward translation of the existing .sh
> code.  It doesn't try very hard to be idiomatic Python or to be
> especially smart.
> 
> It is, however, incredibly faster:
> 
>     $ time ./gdbarch.sh
> 
>     real	0m8.197s
>     user	0m5.779s
>     sys	0m3.384s
> 
>     $ time ./gdbarch.py
> 
>     real	0m0.065s
>     user	0m0.053s
>     sys	0m0.011s

Yeah, this prototype grew out of the frustation of editing gdbarch.sh
(both the time it takes to run and the cryptic format).

I think it would be nice to do a pass of adding comments in gdbarch.py,
for those who will come after us (or future us).  I can do it if you'd
like.

flake8 pointed these out, it's mostly just style, but would be nice to
fix:

	gdbarch.py:286:22: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
	gdbarch.py:394:26: E712 comparison to False should be 'if cond is False:' or 'if not cond:'

I don't have much else to say, I feel like nitpicking on this script
would be a high level of bike-shedding.  Thank you very much for picking
this up and completing it!

> +class Method(Function):
> +    def param_list(self):
> +        return self.set_list()
> +
> +    def actuals(self, initial_comma=True):

initial_comma is unused

Simon


More information about the Gdb-patches mailing list