[3/3] Build gdb "nat" files in subdirectory
Commit Message
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.
gdb/ChangeLog
2018-12-24 Tom Tromey <tom@tromey.com>
* configure.nat (NATDEPFILES): Use nat/ prefix.
* Makefile.in (CONFIG_SRC_SUBDIR): Add nat.
(%.o: ${srcdir}/nat/%.c): Remove rule.
(INIT_FILES): Do not filter out NATDEPFILES.
---
gdb/ChangeLog | 7 +++++
gdb/Makefile.in | 9 ++----
gdb/configure.nat | 73 ++++++++++++++++++++++++++---------------------
3 files changed, 50 insertions(+), 39 deletions(-)
Comments
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)
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> I wrote a small script scraping all .o file names from configure.nat, to
Simon> see if there is a corresponding .c file (see below if you need it). The
Simon> only bad one it found is "nat/aarch64-sve-nat/linux-ptrace.o", which should
Simon> just be nat/linux-ptrace.o, I think.
Thanks for doing that. I think the one bad one should be
nat/aarch64-sve-linux-ptrace.o, so I've made that change.
Simon> Other than that, it did fine the _U/_S files for Hurd (e.g. notify_S.o). There
Simon> is no corresponding .c file for that, I don't know if they are generated or what,
Simon> but I don't think your patch changes anything about that.
I believe they are generated in the build tree.
Simon> Overall this series LGTM, thanks!
I'm going to push the updated series. Thanks for the review.
Tom
@@ -525,7 +525,8 @@ CONFIG_INSTALL = @CONFIG_INSTALL@
CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
-CONFIG_SRC_SUBDIR = arch cli mi common compile tui unittests guile python target
+CONFIG_SRC_SUBDIR = arch cli mi common compile tui unittests guile python \
+ target nat
CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
# -I. for config files.
@@ -1636,10 +1637,6 @@ python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS)
$(COMPILE) $(all_gdbtk_cflags) $<
$(POSTCOMPILE)
-%.o: ${srcdir}/nat/%.c
- $(COMPILE) $<
- $(POSTCOMPILE)
-
installcheck:
# The check target can not use subdir_do, because subdir_do does not
@@ -1838,7 +1835,7 @@ test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY)
INIT_FILES = \
$(patsubst %.o,%.c, \
$(patsubst %-exp.o,%-exp.y, \
- $(filter-out $(NATDEPFILES) init.o version.o %_S.o %_U.o,\
+ $(filter-out init.o version.o %_S.o %_U.o,\
$(COMMON_OBS))))
init.c: stamp-init; @true
@@ -54,40 +54,41 @@
case ${gdb_host} in
*linux*)
NAT_FILE='config/nm-linux.h'
- NATDEPFILES='inf-ptrace.o fork-child.o fork-inferior.o proc-service.o \
- linux-thread-db.o linux-nat.o linux-osdata.o linux-fork.o \
- linux-procfs.o linux-ptrace.o linux-waitpid.o \
- linux-personality.o linux-namespaces.o'
+ NATDEPFILES='inf-ptrace.o fork-child.o nat/fork-inferior.o \
+ proc-service.o \
+ linux-thread-db.o linux-nat.o nat/linux-osdata.o linux-fork.o \
+ nat/linux-procfs.o nat/linux-ptrace.o nat/linux-waitpid.o \
+ nat/linux-personality.o nat/linux-namespaces.o'
NAT_CDEPS='$(srcdir)/proc-service.list'
LOADLIBES='-ldl $(RDYNAMIC)'
;;
fbsd*)
- NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o fbsd-nat.o'
+ NATDEPFILES='fork-child.o nat/fork-inferior.o inf-ptrace.o fbsd-nat.o'
HAVE_NATIVE_GCORE_HOST=1
LOADLIBES='-lkvm'
;;
nbsd*)
- NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o'
+ NATDEPFILES='fork-child.o nat/fork-inferior.o inf-ptrace.o'
HAVE_NATIVE_GCORE_HOST=1
;;
obsd*)
- NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o'
+ NATDEPFILES='fork-child.o nat/fork-inferior.o inf-ptrace.o'
;;
cygwin*)
- NATDEPFILES='x86-nat.o x86-dregs.o windows-nat.o'
+ NATDEPFILES='x86-nat.o nat/x86-dregs.o windows-nat.o'
;;
mingw*)
- NATDEPFILES='x86-nat.o x86-dregs.o windows-nat.o'
+ NATDEPFILES='x86-nat.o nat/x86-dregs.o windows-nat.o'
;;
aix)
- NATDEPFILES='fork-inferior.o fork-child.o inf-ptrace.o'
+ NATDEPFILES='nat/fork-inferior.o fork-child.o inf-ptrace.o'
;;
darwin)
- NATDEPFILES='fork-child.o fork-inferior.o darwin-nat.o \
+ NATDEPFILES='fork-child.o nat/fork-inferior.o darwin-nat.o \
darwin-nat-info.o'
;;
sol2)
- NATDEPFILES='fork-child.o fork-inferior.o \
+ NATDEPFILES='fork-child.o nat/fork-inferior.o \
procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o \
sol-thread.o'
HAVE_NATIVE_GCORE_HOST=1
@@ -145,7 +146,7 @@ case ${gdb_host} in
i386)
# Host: IA86 running Darwin
NATDEPFILES="${NATDEPFILES} i386-darwin-nat.o x86-nat.o \
- x86-dregs.o amd64-nat.o"
+ nat/x86-dregs.o amd64-nat.o"
;;
esac
;;
@@ -163,7 +164,7 @@ case ${gdb_host} in
;;
i386)
# Host: FreeBSD/i386
- NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \
+ NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \
x86-bsd-nat.o i386-bsd-nat.o i386-fbsd-nat.o bsd-kvm.o"
NAT_FILE='nm-fbsd.h'
;;
@@ -193,7 +194,8 @@ case ${gdb_host} in
i386)
# Host: FreeBSD/amd64
NATDEPFILES="${NATDEPFILES} amd64-nat.o amd64-bsd-nat.o \
- amd64-fbsd-nat.o bsd-kvm.o x86-nat.o x86-dregs.o x86-bsd-nat.o"
+ amd64-fbsd-nat.o bsd-kvm.o x86-nat.o nat/x86-dregs.o \
+ x86-bsd-nat.o"
;;
esac
;;
@@ -203,7 +205,7 @@ case ${gdb_host} in
# Host: Intel x86 running DJGPP
# We include several header files from config/djgpp
MH_CFLAGS='-I$(srcdir)/config/djgpp'
- NATDEPFILES='go32-nat.o x86-nat.o x86-dregs.o'
+ NATDEPFILES='go32-nat.o x86-nat.o nat/x86-dregs.o'
XM_CLIBS='-ldbg'
;;
esac
@@ -213,7 +215,7 @@ case ${gdb_host} in
i386)
# Host: Intel 386 running the GNU Hurd
NATDEPFILES='i386-gnu-nat.o gnu-nat.o \
- x86-nat.o x86-dregs.o fork-child.o \
+ x86-nat.o nat/x86-dregs.o fork-child.o \
notify_S.o process_reply_S.o msg_reply_S.o \
msg_U.o exc_request_U.o exc_request_S.o'
HAVE_NATIVE_GCORE_HOST=1
@@ -232,8 +234,9 @@ case ${gdb_host} in
aarch64)
# Host: AArch64 based machine running GNU/Linux
NATDEPFILES="${NATDEPFILES} aarch64-linux-nat.o \
- aarch32-linux-nat.o aarch64-linux-hw-point.o aarch64-linux.o \
- aarch64-sve-linux-ptrace.o"
+ aarch32-linux-nat.o nat/aarch64-linux-hw-point.o \
+ nat/aarch64-linux.o \
+ nat/aarch64-sve-nat/linux-ptrace.o"
;;
arm)
# Host: ARM based machine running GNU/Linux
@@ -242,9 +245,9 @@ case ${gdb_host} in
;;
i386)
# Host: Intel 386 running GNU/Linux.
- NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \
- i386-linux-nat.o x86-linux-nat.o linux-btrace.o \
- x86-linux.o x86-linux-dregs.o"
+ NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \
+ i386-linux-nat.o x86-linux-nat.o nat/linux-btrace.o \
+ nat/x86-linux.o nat/x86-linux-dregs.o"
;;
ia64)
# Host: Intel IA-64 running GNU/Linux
@@ -261,7 +264,7 @@ case ${gdb_host} in
mips)
# Host: Linux/MIPS
NATDEPFILES="${NATDEPFILES} linux-nat-trad.o \
- mips-linux-nat.o mips-linux-watch.o"
+ mips-linux-nat.o nat/mips-linux-watch.o"
;;
pa)
# Host: Hewlett-Packard PA-RISC machine, running Linux
@@ -269,7 +272,7 @@ case ${gdb_host} in
;;
powerpc)
# Host: PowerPC, running Linux
- NATDEPFILES="${NATDEPFILES} ppc-linux-nat.o ppc-linux.o"
+ NATDEPFILES="${NATDEPFILES} ppc-linux-nat.o nat/ppc-linux.o"
;;
riscv*)
# Host: RISC-V, running Linux
@@ -298,9 +301,11 @@ case ${gdb_host} in
case ${gdb_host_cpu} in
i386)
# Host: GNU/Linux x86-64
- NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \
- amd64-nat.o amd64-linux-nat.o x86-linux-nat.o linux-btrace.o \
- x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o"
+ NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \
+ amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \
+ nat/linux-btrace.o \
+ nat/x86-linux.o nat/x86-linux-dregs.o \
+ nat/amd64-linux-siginfo.o"
;;
sparc)
# Host: GNU/Linux UltraSPARC
@@ -355,7 +360,7 @@ case ${gdb_host} in
i386)
# Host: NetBSD/amd64
NATDEPFILES="${NATDEPFILES} nbsd-nat.o amd64-nat.o x86-nat.o \
- x86-dregs.o x86-bsd-nat.o amd64-bsd-nat.o amd64-nbsd-nat.o"
+ nat/x86-dregs.o x86-bsd-nat.o amd64-bsd-nat.o amd64-nbsd-nat.o"
;;
sparc)
# Host: NetBSD/sparc64
@@ -374,7 +379,8 @@ case ${gdb_host} in
;;
i386)
# Host: NetBSD/i386 ELF
- NATDEPFILES="${NATDEPFILES} nbsd-nat.o x86-nat.o x86-dregs.o \
+ NATDEPFILES="${NATDEPFILES} nbsd-nat.o x86-nat.o \
+ nat/x86-dregs.o \
x86-bsd-nat.o i386-bsd-nat.o i386-nbsd-nat.o bsd-kvm.o"
LOADLIBES='-lkvm'
;;
@@ -460,7 +466,7 @@ case ${gdb_host} in
powerpc)
# Host: PowerPC64, running Linux
XM_CLIBS=
- NATDEPFILES="${NATDEPFILES} ppc-linux-nat.o ppc-linux.o"
+ NATDEPFILES="${NATDEPFILES} ppc-linux-nat.o nat/ppc-linux.o"
;;
esac
;;
@@ -488,9 +494,10 @@ case ${gdb_host} in
NAT_CDEPS=
LOADLIBES=
NATDEPFILES='spu-linux-nat.o \
- inf-ptrace.o fork-child.o fork-inferior.o \
- linux-procfs.o linux-ptrace.o linux-waitpid.o \
- linux-personality.o linux-namespaces.o'
+ inf-ptrace.o fork-child.o nat/fork-inferior.o \
+ nat/linux-procfs.o nat/linux-ptrace.o \
+ nat/linux-waitpid.o \
+ nat/linux-personality.o nat/linux-namespaces.o'
;;
esac
;;