diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-10-11 19:26:59 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-11-12 09:44:00 +0000 |
commit | ab33b15255460ac45a001c8ebf69ef73f6f1fba4 (patch) | |
tree | dba8d576f56297fe9a2c35ccedf7bf77c390bc35 /gdb/doc | |
parent | b8b0c108c75bd957660b9cada31378d95de4ec5a (diff) | |
download | gdb-ab33b15255460ac45a001c8ebf69ef73f6f1fba4.zip gdb-ab33b15255460ac45a001c8ebf69ef73f6f1fba4.tar.gz gdb-ab33b15255460ac45a001c8ebf69ef73f6f1fba4.tar.bz2 |
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'.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index a57a36a..e7cec1a 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2020-11-12 Andrew Burgess <andrew.burgess@embecosm.com> + + * gdb.texinfo (Maintenance Commands): Update description of 'maint + print c-tdesc'. + 2020-11-02 Andrew Burgess <andrew.burgess@embecosm.com> * gdb.texinfo (Mode Options): Descriptions of initialization files diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 5270156..7092331 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -38716,8 +38716,8 @@ checksum. Print the entire architecture configuration. The optional argument @var{file} names the file where the output goes. -@kindex maint print c-tdesc @r{[}@var{file}@r{]} -@item maint print c-tdesc +@kindex maint print c-tdesc +@item maint print c-tdesc @r{[}-single-feature@r{]} @r{[}@var{file}@r{]} Print the target description (@pxref{Target Descriptions}) as a C source file. By default, the target description is for the current target, but if the optional argument @var{file} is provided, that file @@ -38727,6 +38727,11 @@ The created source file is built into @value{GDBN} when @value{GDBN} is built again. This command is used by developers after they add or modify XML target descriptions. +When the optional flag @samp{-single-feature} is provided then the +target description being processed (either the default, or from +@var{file}) must only contain a single feature. The source file +produced is different in this case. + @kindex maint print xml-tdesc @item maint print xml-tdesc @r{[}@var{file}@r{]} Print the target description (@pxref{Target Descriptions}) as an XML |