Re: [PATCH 0/7] Make gdbarch.sh shellcheck-clean

Simon Marchi
2020-05-10T21:36:40Z

On 2020-05-10 2:57 p.m., Pedro Alves wrote:
> On 4/29/20 10:08 PM, Tom Tromey wrote:
>>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> Simon> I ran shellcheck on gdbarch.sh and addressed all the warnings. It
>> Simon> didn't catch anything serious, but I think it's good to have it clean
>> Simon> anyway, so we can catch potential problems in future changes we do to
>> Simon> this file.
>>
>> These all seemed fine to me.
>>
>> I'd like to see gdbarch.sh eventually go away entirely.
>> Most of it could be ordinary C++ code. I don't have a concrete plan for
>> this though. Mostly I've been reluctant to do it due to the amount of
>> reindentation that will probably be involved, though I guess maybe I
>> could write an emacs lisp script to handle this.
>
> My main gripe with gdbarch.sh is that the function/variable/method definitions
> and the generator code is all in the same file.
>
> If those were split to separate files, like, the definitions inside function_list()
> were moved to a separate gdbarch.def file, which would be read by gdbarch.sh,
> that'd already be a large win, IMHO.

If I was to do it from scratch, I'd do the definitions in a yaml file with a python
script as the generator. If you would be fine with that, I'd be happy to try it as
a weekend project. I just never proposed it because I thought people were happy with
what we currently have and wouldn't welcome changing something for the sake of
changing it :).

> Also, I would like it to be able to generate the gdbarch.h/c files in place,
> instead of generating new "new-gdbarch.h/c" files.

Same here. I never thought about that before, but it probably comes from the
pre-git era, where it would have been more difficult to compare the before and after
if the file was written in place?

Simon