diff options
author | Yao Qi <yao.qi@linaro.org> | 2017-07-26 14:24:08 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2017-07-26 14:24:08 +0100 |
commit | 25aa13e522c595cbdbb3868f1daa434a17ba2ab2 (patch) | |
tree | 34f287e234ff4b50267473aa05fce5629358c8bc /gdb/features/Makefile | |
parent | 6eb1e6a8c1c83d0fb5b06192d1ec218d3a358f23 (diff) | |
download | binutils-25aa13e522c595cbdbb3868f1daa434a17ba2ab2.zip binutils-25aa13e522c595cbdbb3868f1daa434a17ba2ab2.tar.gz binutils-25aa13e522c595cbdbb3868f1daa434a17ba2ab2.tar.bz2 |
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-".
Diffstat (limited to 'gdb/features/Makefile')
-rw-r--r-- | gdb/features/Makefile | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/gdb/features/Makefile b/gdb/features/Makefile index 7ddb578..670f8f3 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -235,7 +235,7 @@ XMLTOC = \ tic6x-c64xp-linux.xml \ tic6x-c64xp.xml -CFILES = $(patsubst %.xml,%.c,$(XMLTOC)) +TDESC_CFILES = $(patsubst %.xml,%.c,$(XMLTOC)) GDB = false all: $(OUTPUTS) @@ -252,11 +252,40 @@ $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl $(XSLTPROC) gdbserver-regs.xsl - >> $(outdir)/$*.tmp sh ../../move-if-change $(outdir)/$*.tmp $(outdir)/$*.dat -cfiles: $(CFILES) -%.c: %.xml +FEATURE_XMLFILES = i386/32bit-core.xml \ + i386/32bit-sse.xml \ + i386/32bit-linux.xml \ + i386/32bit-avx.xml \ + i386/32bit-mpx.xml \ + i386/32bit-avx512.xml \ + i386/32bit-pkeys.xml + +FEATURE_CFILES = $(patsubst %.xml,%.c,$(FEATURE_XMLFILES)) + +cfiles: $(TDESC_CFILES) $(FEATURE_CFILES) + +$(TDESC_CFILES): %.c: %.xml $(GDB) -nx -q -batch -ex 'maint print c-tdesc $<' > $@.tmp sh ../../move-if-change $@.tmp $@ +$(FEATURE_CFILES): %.c: %.xml.tmp + $(GDB) -nx -q -batch \ + -ex 'maint print c-tdesc $<' > $@.tmp + sh ../../move-if-change $@.tmp $@ + rm $< + +# %.xml is the XML file for each target description feature, and +# %.xml.tmp is the XML file target description which only includes +# one target description feature. + +%.xml.tmp: %.xml + echo "<?xml version=\"1.0\"?>" > $@.tmp + echo "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">" >> $@.tmp + echo "<target>" >> $@.tmp + echo " <xi:include href=\"$(notdir $<)\"/>" >> $@.tmp + echo "</target>" >> $@.tmp + sh ../../move-if-change $@.tmp $@ + # Other dependencies. $(outdir)/arm/arm-with-iwmmxt.dat: arm/arm-core.xml arm/xscale-iwmmxt.xml $(outdir)/i386/i386.dat: i386/32bit-core.xml i386/32bit-sse.xml @@ -327,7 +356,7 @@ $(outdir)/i386/x32-avx-avx512-linux.dat: i386/x32-core.xml i386/64bit-avx.xml \ # 'all' doesn't build the C files, so don't delete them in 'clean' # either. clean-cfiles: - rm -f $(CFILES) + rm -f $(TDESC_CFILES) $(FEATURE_CFILES) clean: rm -f $(OUTPUTS) |