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/features | |
parent | b8b0c108c75bd957660b9cada31378d95de4ec5a (diff) | |
download | binutils-gdb-ab33b15255460ac45a001c8ebf69ef73f6f1fba4.tar.gz |
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/features')
-rw-r--r-- | gdb/features/Makefile | 4 | ||||
-rw-r--r-- | gdb/features/rx.c | 2 | ||||
-rw-r--r-- | gdb/features/rx.xml | 130 |
3 files changed, 69 insertions, 67 deletions
diff --git a/gdb/features/Makefile b/gdb/features/Makefile index 689603847a0..d5b3236242d 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -153,6 +153,7 @@ XMLTOC = \ rs6000/powerpc-vsx64.xml \ rs6000/powerpc-vsx64l.xml \ rs6000/rs6000.xml \ + rx.xml \ s390-linux32.xml \ s390-linux32v1.xml \ s390-linux32v2.xml \ @@ -232,7 +233,6 @@ FEATURE_XMLFILES = aarch64-core.xml \ riscv/32bit-fpu.xml \ riscv/64bit-cpu.xml \ riscv/64bit-fpu.xml \ - rx.xml \ tic6x-c6xp.xml \ tic6x-core.xml \ tic6x-gp.xml @@ -247,7 +247,7 @@ $(TDESC_CFILES): %.c: %.xml $(FEATURE_CFILES): %.c: %.xml.tmp $(GDB) -nx -q -batch \ - -ex 'maint print c-tdesc $<' > $@.tmp + -ex 'maint print c-tdesc -single-feature $<' > $@.tmp sh ../../move-if-change $@.tmp $@ rm $< diff --git a/gdb/features/rx.c b/gdb/features/rx.c index ebbc504ec35..dd765c2c63a 100644 --- a/gdb/features/rx.c +++ b/gdb/features/rx.c @@ -1,5 +1,5 @@ /* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: - Original: rx.xml.tmp */ + Original: rx.xml */ #include "defs.h" #include "osabi.h" diff --git a/gdb/features/rx.xml b/gdb/features/rx.xml index d19b53676a3..35348e8b3e5 100644 --- a/gdb/features/rx.xml +++ b/gdb/features/rx.xml @@ -5,70 +5,72 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. --> -<!DOCTYPE feature SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.rx.core"> - <reg name="r0" bitsize="32" type="data_ptr"/> - <reg name="r1" bitsize="32" type="uint32"/> - <reg name="r2" bitsize="32" type="uint32"/> - <reg name="r3" bitsize="32" type="uint32"/> - <reg name="r4" bitsize="32" type="uint32"/> - <reg name="r5" bitsize="32" type="uint32"/> - <reg name="r6" bitsize="32" type="uint32"/> - <reg name="r7" bitsize="32" type="uint32"/> - <reg name="r8" bitsize="32" type="uint32"/> - <reg name="r9" bitsize="32" type="uint32"/> - <reg name="r10" bitsize="32" type="uint32"/> - <reg name="r11" bitsize="32" type="uint32"/> - <reg name="r12" bitsize="32" type="uint32"/> - <reg name="r13" bitsize="32" type="uint32"/> - <reg name="r14" bitsize="32" type="uint32"/> - <reg name="r15" bitsize="32" type="uint32"/> +<!DOCTYPE target SYSTEM "gdb-target.dtd"> +<target> + <feature name="org.gnu.gdb.rx.core"> + <reg name="r0" bitsize="32" type="data_ptr"/> + <reg name="r1" bitsize="32" type="uint32"/> + <reg name="r2" bitsize="32" type="uint32"/> + <reg name="r3" bitsize="32" type="uint32"/> + <reg name="r4" bitsize="32" type="uint32"/> + <reg name="r5" bitsize="32" type="uint32"/> + <reg name="r6" bitsize="32" type="uint32"/> + <reg name="r7" bitsize="32" type="uint32"/> + <reg name="r8" bitsize="32" type="uint32"/> + <reg name="r9" bitsize="32" type="uint32"/> + <reg name="r10" bitsize="32" type="uint32"/> + <reg name="r11" bitsize="32" type="uint32"/> + <reg name="r12" bitsize="32" type="uint32"/> + <reg name="r13" bitsize="32" type="uint32"/> + <reg name="r14" bitsize="32" type="uint32"/> + <reg name="r15" bitsize="32" type="uint32"/> - <flags id="psw_flags" size="4"> - <field name="C" start="0" end="0"/> - <field name="Z" start="1" end="1"/> - <field name="S" start="2" end="2"/> - <field name="O" start="3" end="3"/> - <field name="I" start="16" end="16"/> - <field name="U" start="17" end="17"/> - <field name="PM" start="20" end="20"/> - <field name="IPL0" start="24" end="24"/> - <field name="IPL1" start="25" end="25"/> - <field name="IPL2" start="26" end="26"/> - <field name="IPL3" start="27" end="27"/> - </flags> + <flags id="psw_flags" size="4"> + <field name="C" start="0" end="0"/> + <field name="Z" start="1" end="1"/> + <field name="S" start="2" end="2"/> + <field name="O" start="3" end="3"/> + <field name="I" start="16" end="16"/> + <field name="U" start="17" end="17"/> + <field name="PM" start="20" end="20"/> + <field name="IPL0" start="24" end="24"/> + <field name="IPL1" start="25" end="25"/> + <field name="IPL2" start="26" end="26"/> + <field name="IPL3" start="27" end="27"/> + </flags> - <flags id="fpsw_flags" size="4"> - <field name="RM0" start="0" end="0"/> - <field name="RM1" start="1" end="1"/> - <field name="CV" start="2" end="2"/> - <field name="CO" start="3" end="3"/> - <field name="CZ" start="4" end="4"/> - <field name="CU" start="5" end="5"/> - <field name="CX" start="6" end="6"/> - <field name="CE" start="7" end="7"/> - <field name="DN" start="8" end="8"/> - <field name="EV" start="10" end="10"/> - <field name="EO" start="11" end="11"/> - <field name="EZ" start="12" end="12"/> - <field name="EU" start="13" end="13"/> - <field name="EX" start="14" end="14"/> - <field name="FV" start="26" end="26"/> - <field name="FO" start="27" end="27"/> - <field name="FZ" start="28" end="28"/> - <field name="FU" start="29" end="29"/> - <field name="FX" start="30" end="30"/> - <field name="FS" start="31" end="31"/> - </flags> + <flags id="fpsw_flags" size="4"> + <field name="RM0" start="0" end="0"/> + <field name="RM1" start="1" end="1"/> + <field name="CV" start="2" end="2"/> + <field name="CO" start="3" end="3"/> + <field name="CZ" start="4" end="4"/> + <field name="CU" start="5" end="5"/> + <field name="CX" start="6" end="6"/> + <field name="CE" start="7" end="7"/> + <field name="DN" start="8" end="8"/> + <field name="EV" start="10" end="10"/> + <field name="EO" start="11" end="11"/> + <field name="EZ" start="12" end="12"/> + <field name="EU" start="13" end="13"/> + <field name="EX" start="14" end="14"/> + <field name="FV" start="26" end="26"/> + <field name="FO" start="27" end="27"/> + <field name="FZ" start="28" end="28"/> + <field name="FU" start="29" end="29"/> + <field name="FX" start="30" end="30"/> + <field name="FS" start="31" end="31"/> + </flags> - <reg name="usp" bitsize="32" type="data_ptr"/> - <reg name="isp" bitsize="32" type="data_ptr"/> - <reg name="psw" bitsize="32" type="psw_flags"/> - <reg name="pc" bitsize="32" type="code_ptr"/> - <reg name="intb" bitsize="32" type="data_ptr"/> - <reg name="bpsw" bitsize="32" type="psw_flags"/> - <reg name="bpc" bitsize="32" type="code_ptr"/> - <reg name="fintv" bitsize="32" type="code_ptr"/> - <reg name="fpsw" bitsize="32" type="fpsw_flags"/> - <reg name="acc" bitsize="64" type="uint64"/> -</feature> + <reg name="usp" bitsize="32" type="data_ptr"/> + <reg name="isp" bitsize="32" type="data_ptr"/> + <reg name="psw" bitsize="32" type="psw_flags"/> + <reg name="pc" bitsize="32" type="code_ptr"/> + <reg name="intb" bitsize="32" type="data_ptr"/> + <reg name="bpsw" bitsize="32" type="psw_flags"/> + <reg name="bpc" bitsize="32" type="code_ptr"/> + <reg name="fintv" bitsize="32" type="code_ptr"/> + <reg name="fpsw" bitsize="32" type="fpsw_flags"/> + <reg name="acc" bitsize="64" type="uint64"/> + </feature> +</target> |