Re: [PATCH 3/3] Build gdb "nat" files in subdirectory

Simon Marchi
2018-12-27T04:29:34Z

On 2018-12-24 4:09 p.m., Tom Tromey wrote:
> This moves the various "nat" object files into the nat/ subdirectory.
> This allows for the removal of a pattern rule from the gdb Makefile,
> which is a small cleanup.
>
> I made the configure.nat change in a (semi-) automated way, hopefully
> meaning that it is more likely to be correct than had I done it by
> hand.
>
> Eventually I would like for the various configure scripts to only
> mention source files, and let the Makefile compute the object file
> names.

I wrote a small script scraping all .o file names from configure.nat, to
see if there is a corresponding .c file (see below if you need it). The
only bad one it found is "nat/aarch64-sve-nat/linux-ptrace.o", which should
just be nat/linux-ptrace.o, I think.

Other than that, it did fine the _U/_S files for Hurd (e.g. notify_S.o). There
is no corresponding .c file for that, I don't know if they are generated or what,
but I don't think your patch changes anything about that.

If you run the script, you'll see it also reports gnu.c... it's a false positive
because it matches "gnu.o" in http://www.gnu.org/licenses :).

Overall this series LGTM, thanks!

Simon

import os
import re

with open('configure.nat') as f:
text = f.read()

m = re.findall(r'[a-zA-Z0-9/_-]+\.o', text)

for o in m:
c = o[:-1] + 'c'
if not os.path.isfile(c):
print('Missing ' + c)