binutils-gdb/gdb/features
Andrew Burgess ab33b15255 gdb: add an option flag to 'maint print c-tdesc'
GDB has two approaches to generating the target descriptions found in
gdb/features/, the whole description approach, where the XML file
contains a complete target description which is then used to generate
a single C file that builds that target description.  Or, the split
feature approach, where the XML files contain a single target feature,
each feature results in a single C file to create that one feature,
and then a manually written C file is used to build a complete target
description from individual features.

There's a Makefile, gdb/features/Makefile, which is responsible for
managing the regeneration of the C files from the XML files.

However, some of the logic that selects between the whole description
approach, or the split feature approach, is actually hard-coded into
GDB, inside target-descriptions.c:maint_print_c_tdesc_cmd we check the
path to the incoming XML file and use this to choose which type of C
file we should generate.

This commit removes this hard coding from GDB, and makes the Makefile
entirely responsible for choosing the approach.  This makes sense as
the Makefile already has the XML files partitioned based on which
approach they should use.

In order to allow this change the 'maint print c-tdesc' command is
given a new command option '-single-feature', which tells GDB which
type of C file should be created.  The makefile now supplies this flag
to GDB.

This did reveal a bug in features/Makefile, the rx.xml file was in the
wrong list, this didn't matter previously as the actual choice of
which approach to use was done in GDB.  Now the Makefile decides, so
placing each XML file in the correct list is critical.

Tested this by doing 'make GDB=/path/to/gdb clean-cfiles cfiles' to
regenerate all the C files from their XML source.  There are no
changes after this commit.

gdb/ChangeLog:

	* features/Makefile (XMLTOC): Add rx.xml.
	(FEATURE_XMLFILES): Remove rx.xml.
	(FEATURE_CFILES rule): Pass '-single-feature' flag.
	* features/rx.c: Regenerate.
	* features/rx.xml: Wrap in `target` tags, and reindent.
	* target-descriptions.c (struct maint_print_c_tdesc_options): New
	structure.
	(maint_print_c_tdesc_opt_def): New typedef.
	(maint_print_c_tdesc_opt_defs): New static global.
	(make_maint_print_c_tdesc_options_def_group): New function.
	(maint_print_c_tdesc_cmd): Make use of command line flags, only
	print single feature C file for target descriptions containing a
	single feature.
	(maint_print_c_tdesc_cmd_completer): New function.
	(_initialize_target_descriptions): Update call to register command
	completer, and include command line flag in help text.

gdb/doc/ChangeLog:

	* gdb.texinfo (Maintenance Commands): Update description of 'maint
	print c-tdesc'.
2020-11-12 09:44:00 +00:00
..
arc
arm
i386
riscv
rs6000 gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
sparc
aarch64-core.c
aarch64-core.xml
aarch64-fpu.c
aarch64-fpu.xml
aarch64-pauth.c
aarch64-pauth.xml
aarch64-sve.c
btrace-conf.dtd
btrace.dtd
feature_to_c.sh
gdb-target.dtd
gdbserver-regs.xsl
library-list-aix.dtd
library-list-svr4.dtd
library-list.dtd
m68k-core.xml
Makefile gdb: add an option flag to 'maint print c-tdesc' 2020-11-12 09:44:00 +00:00
microblaze-core.xml
microblaze-stack-protect.xml
microblaze-with-stack-protect.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
microblaze-with-stack-protect.xml
microblaze.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
microblaze.xml
mips64-cp0.xml
mips64-cpu.xml
mips64-dsp-linux.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
mips64-dsp-linux.xml
mips64-dsp.xml
mips64-fpu.xml
mips64-linux.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
mips64-linux.xml
mips-cp0.xml
mips-cpu.xml
mips-dsp-linux.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
mips-dsp-linux.xml
mips-dsp.xml
mips-fpu.xml
mips-linux.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
mips-linux.xml
nds32-core.xml
nds32-fpu.xml
nds32-system.xml
nds32.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
nds32.xml
nios2-cpu.xml
nios2-linux.xml
nios2.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
nios2.xml
number-regs.xsl
or1k-core.xml
or1k.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
or1k.xml
osdata.dtd
rx.c gdb: add an option flag to 'maint print c-tdesc' 2020-11-12 09:44:00 +00:00
rx.xml gdb: add an option flag to 'maint print c-tdesc' 2020-11-12 09:44:00 +00:00
s390-acr.xml
s390-core32.xml
s390-core64.xml
s390-fpr.xml
s390-gs-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-gs-linux64.xml
s390-gs.xml
s390-gsbc.xml
s390-linux32.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-linux32.xml
s390-linux32v1.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-linux32v1.xml
s390-linux32v2.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-linux32v2.xml
s390-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-linux64.xml
s390-linux64v1.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-linux64v1.xml
s390-linux64v2.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-linux64v2.xml
s390-tdb.xml
s390-te-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-te-linux64.xml
s390-tevx-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-tevx-linux64.xml
s390-vx-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390-vx-linux64.xml
s390-vx.xml
s390x-core64.xml
s390x-gs-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390x-gs-linux64.xml
s390x-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390x-linux64.xml
s390x-linux64v1.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390x-linux64v1.xml
s390x-linux64v2.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390x-linux64v2.xml
s390x-te-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390x-te-linux64.xml
s390x-tevx-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390x-tevx-linux64.xml
s390x-vx-linux64.c gdb: Have allocate_target_description return a unique_ptr 2020-10-08 10:14:14 +01:00
s390x-vx-linux64.xml
sort-regs.xsl
threads.dtd
tic6x-c6xp.c
tic6x-c6xp.xml
tic6x-c62x-linux.xml
tic6x-c64x-linux.xml
tic6x-c64xp-linux.xml
tic6x-core.c
tic6x-core.xml
tic6x-gp.c
tic6x-gp.xml
traceframe-info.dtd
xinclude.dtd