Generate c for feature instead of tdesc
authorYao Qi <yao.qi@linaro.org>
Wed, 26 Jul 2017 13:24:08 +0000 (14:24 +0100)
committerYao Qi <yao.qi@linaro.org>
Wed, 26 Jul 2017 13:24:08 +0000 (14:24 +0100)
commit25aa13e522c595cbdbb3868f1daa434a17ba2ab2
tree34f287e234ff4b50267473aa05fce5629358c8bc
parent6eb1e6a8c1c83d0fb5b06192d1ec218d3a358f23
Generate c for feature instead of tdesc

This patch changes Makefile and command "maint print c-files" so
that GDB can print c files for features instead target description.
Previously, we feed GDB a target description xml file, which generate
c files including multiple features.

With this patch, in Makefile, we wrap each feature xml file, and
create a temp target description which include only one feature.
Then, adjust the target description printer for them, and print
a c function for each given feature, so that we can use these
c functions later to create target description in a flexible way.

gdb:

2017-07-26  Yao Qi  <yao.qi@linaro.org>

* features/Makefile (CFILES): Rename with TDESC_CFILES.
(FEATURE_XMLFILES): New.
(FEATURE_CFILES): New.
New rules.
(clean-cfiles): Remove generated c files.
* features/i386/32bit-avx.c: Generated.
  * features/i386/32bit-avx512.c: Generated.
  * features/i386/32bit-core.c: Generated.
  * features/i386/32bit-linux.c: Generated.
  * features/i386/32bit-mpx.c: Generated.
  * features/i386/32bit-pkeys.c: Generated.
  * features/i386/32bit-sse.c: Generated.
  * target-descriptions.c: Include algorithm.
(tdesc_element_visitor): Add method visit_end.
(print_c_tdesc): Implement visit_end.
(print_c_tdesc:: m_filename_after_features): Move it to
protected.
(print_c_feature): New class.
(maint_print_c_tdesc_cmd): Use print_c_feature if XML file
name starts with "i386/32bit-".
gdb/ChangeLog
gdb/features/Makefile
gdb/features/i386/32bit-avx.c [new file with mode: 0644]
gdb/features/i386/32bit-avx512.c [new file with mode: 0644]
gdb/features/i386/32bit-core.c [new file with mode: 0644]
gdb/features/i386/32bit-linux.c [new file with mode: 0644]
gdb/features/i386/32bit-mpx.c [new file with mode: 0644]
gdb/features/i386/32bit-pkeys.c [new file with mode: 0644]
gdb/features/i386/32bit-sse.c [new file with mode: 0644]
gdb/target-descriptions.c