Check arguments for all probes before using them
[external/binutils.git] / gdb / features / Makefile
1 # Copyright (C) 2007-2019 Free Software Foundation, Inc.
2
3 # This file is part of GDB.
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
19 # This file requires GNU make!
20
21 # This Makefile updates files in ../regformats from their XML master
22 # copies.  Because this relies on xsltproc, it is not normally run
23 # during the build process; it should be run by hand when one of the
24 # affected XML files is changed, and the results should be kept in the
25 # GDB repository.
26
27 # It can also update the C files in the features directory from their
28 # XML master copies.  This relies on a GDB linked with expat and that
29 # is configured to include support for the architecture, so the files
30 # are kept in the GDB repository.
31 #
32 # By default we'll generate all C files, and you must point make at a
33 # GDB that has been configured with --enable-targets=all:
34 #
35 #   make GDB=/path/to/gdb cfiles
36 #
37 # To regenerate all C files from scratch:
38 #
39 #   make GDB=/path/to/gdb clean-cfiles cfiles
40 #
41 # To generate specific C files, you can override the XMLTOC and
42 # FEATURE_XMLFILES make variables:
43 #
44 #   make GDB=/path/to/gdb XMLTOC="xml files" FEATURE_XMLFILES="xml files" cfiles
45
46 # List of .dat files to create in ../regformats/
47 WHICH = arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \
48         arm/arm-with-neon \
49         mips-linux mips-dsp-linux \
50         microblaze-with-stack-protect \
51         mips64-linux mips64-dsp-linux \
52         nios2-linux \
53         rs6000/powerpc-32 \
54         rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \
55         rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \
56         rs6000/powerpc-vsx64l rs6000/powerpc-cell32l rs6000/powerpc-cell64l \
57         rs6000/powerpc-isa205-32l rs6000/powerpc-isa205-64l \
58         rs6000/powerpc-isa205-altivec32l rs6000/powerpc-isa205-altivec64l \
59         rs6000/powerpc-isa205-vsx32l rs6000/powerpc-isa205-vsx64l \
60         rs6000/powerpc-isa205-ppr-dscr-vsx32l \
61         rs6000/powerpc-isa205-ppr-dscr-vsx64l \
62         rs6000/powerpc-isa207-vsx32l rs6000/powerpc-isa207-vsx64l \
63         rs6000/powerpc-isa207-htm-vsx32l \
64         rs6000/powerpc-isa207-htm-vsx64l \
65         s390-linux32 s390-linux64 s390x-linux64 \
66         s390-linux32v1 s390-linux64v1 s390x-linux64v1 \
67         s390-linux32v2 s390-linux64v2 s390x-linux64v2 \
68         s390-te-linux64 s390x-te-linux64 s390-vx-linux64 s390x-vx-linux64 \
69         s390-tevx-linux64 s390x-tevx-linux64 \
70         s390-gs-linux64 s390x-gs-linux64 \
71         tic6x-c64xp-linux tic6x-c64x-linux tic6x-c62x-linux
72
73 # Record which registers should be sent to GDB by default after stop.
74 aarch64-expedite = x29,sp,pc
75 arm-expedite = r11,sp,pc
76 i386-expedite = ebp,esp,eip
77 amd64-expedite = rbp,rsp,rip
78 x32-expedite = rbp,rsp,rip
79 mips-expedite = r29,pc
80 mips-dsp-expedite = r29,pc
81 mips64-expedite = r29,pc
82 mips64-dsp-expedite = r29,pc
83 microblaze-expedite = r1,rpc
84 nios2-linux-expedite = sp,pc
85 or1k-expedite = r1,npc
86 powerpc-expedite = r1,pc
87 rs6000/powerpc-cell32l-expedite = r1,pc,r0,orig_r3,r4
88 rs6000/powerpc-cell64l-expedite = r1,pc,r0,orig_r3,r4
89 s390-linux32-expedite = r14,r15,pswa
90 s390-linux32v1-expedite = r14,r15,pswa
91 s390-linux32v2-expedite = r14,r15,pswa
92 s390-linux64-expedite = r14l,r15l,pswa
93 s390-linux64v1-expedite = r14l,r15l,pswa
94 s390-linux64v2-expedite = r14l,r15l,pswa
95 s390-te-linux64-expedite = r14l,r15l,pswa
96 s390-vx-linux64-expedite = r14l,r15l,pswa
97 s390-tevx-linux64-expedite = r14l,r15l,pswa
98 s390-gs-linux64-expedite = r14,r15,pswa
99 s390x-expedite = r14,r15,pswa
100 tic6x-expedite = A15,PC
101
102
103 XSLTPROC = xsltproc
104 outdir = ../regformats
105 OUTPUTS = $(patsubst %,$(outdir)/%.dat,$(WHICH))
106
107 # For targets without feature based target descriptions,
108 # the set of xml files we'll generate .c files for GDB from.  By
109 # default we'll build all .c files, which requires an
110 # --enable-targets=all GDB.  You can override this by passing XMLTOC
111 # to make on the command line.
112 XMLTOC = \
113         arc-v2.xml \
114         arc-arcompact.xml \
115         microblaze-with-stack-protect.xml \
116         microblaze.xml \
117         mips-dsp-linux.xml \
118         mips-linux.xml \
119         mips64-dsp-linux.xml \
120         mips64-linux.xml \
121         nds32.xml \
122         nios2.xml \
123         or1k.xml \
124         rs6000/powerpc-32.xml \
125         rs6000/powerpc-32l.xml \
126         rs6000/powerpc-403.xml \
127         rs6000/powerpc-403gc.xml \
128         rs6000/powerpc-405.xml \
129         rs6000/powerpc-505.xml \
130         rs6000/powerpc-601.xml \
131         rs6000/powerpc-602.xml \
132         rs6000/powerpc-603.xml \
133         rs6000/powerpc-604.xml \
134         rs6000/powerpc-64.xml \
135         rs6000/powerpc-64l.xml \
136         rs6000/powerpc-7400.xml \
137         rs6000/powerpc-750.xml \
138         rs6000/powerpc-860.xml \
139         rs6000/powerpc-altivec32.xml \
140         rs6000/powerpc-altivec32l.xml \
141         rs6000/powerpc-altivec64.xml \
142         rs6000/powerpc-altivec64l.xml \
143         rs6000/powerpc-cell32l.xml \
144         rs6000/powerpc-cell64l.xml \
145         rs6000/powerpc-e500.xml \
146         rs6000/powerpc-e500l.xml \
147         rs6000/powerpc-isa205-32l.xml \
148         rs6000/powerpc-isa205-64l.xml \
149         rs6000/powerpc-isa205-altivec32l.xml \
150         rs6000/powerpc-isa205-altivec64l.xml \
151         rs6000/powerpc-isa205-vsx32l.xml \
152         rs6000/powerpc-isa205-vsx64l.xml \
153         rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml \
154         rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml \
155         rs6000/powerpc-isa207-vsx32l.xml \
156         rs6000/powerpc-isa207-vsx64l.xml \
157         rs6000/powerpc-isa207-htm-vsx32l.xml \
158         rs6000/powerpc-isa207-htm-vsx64l.xml \
159         rs6000/powerpc-vsx32.xml \
160         rs6000/powerpc-vsx32l.xml \
161         rs6000/powerpc-vsx64.xml \
162         rs6000/powerpc-vsx64l.xml \
163         rs6000/rs6000.xml \
164         rx.xml \
165         s390-linux32.xml \
166         s390-linux32v1.xml \
167         s390-linux32v2.xml \
168         s390-linux64.xml \
169         s390-linux64v1.xml \
170         s390-linux64v2.xml \
171         s390-te-linux64.xml \
172         s390x-linux64.xml \
173         s390x-linux64v1.xml \
174         s390x-linux64v2.xml \
175         s390x-te-linux64.xml \
176         s390-tevx-linux64.xml \
177         s390-vx-linux64.xml \
178         s390x-tevx-linux64.xml \
179         s390x-vx-linux64.xml \
180         s390-gs-linux64.xml \
181         s390x-gs-linux64.xml
182
183 TDESC_CFILES = $(patsubst %.xml,%.c,$(XMLTOC))
184 GDB = false
185
186 #Targets which use feature based target descriptions.
187 aarch64-feature = 1
188 arm-feature = 1
189 i386-feature = 1
190 riscv-feature = 1
191 tic6x-feature = 1
192
193 all: $(OUTPUTS)
194
195 $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
196         echo "# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:" > $(outdir)/$*.tmp
197         echo "# Generated from: $<" >> $(outdir)/$*.tmp
198         echo "name:`echo $(notdir $*) | sed 's/-/_/g'`" >> $(outdir)/$*.tmp
199         $(if $($(firstword $(subst /, ,$(subst -, ,$*)))-feature), echo "feature:1") >> $(outdir)/$*.tmp
200         echo "xmltarget:$(<F)" >> $(outdir)/$*.tmp
201         echo "expedite:$(if $($*-expedite),$($*-expedite),$($(firstword $(subst -, ,$(notdir $*)))-expedite))" \
202           >> $(outdir)/$*.tmp
203         $(XSLTPROC) --path "$(PWD)" --xinclude number-regs.xsl $< | \
204           $(XSLTPROC) sort-regs.xsl - | \
205           $(XSLTPROC) gdbserver-regs.xsl - >> $(outdir)/$*.tmp
206         sh ../../move-if-change $(outdir)/$*.tmp $(outdir)/$*.dat
207
208 # For targets with feature based target descriptions,
209 # the set of xml files we'll generate .c files for GDB from.
210 FEATURE_XMLFILES = aarch64-core.xml \
211         aarch64-fpu.xml \
212         aarch64-pauth.xml \
213         arm/arm-core.xml \
214         arm/arm-fpa.xml \
215         arm/arm-m-profile.xml \
216         arm/arm-m-profile-with-fpa.xml \
217         arm/arm-vfpv2.xml \
218         arm/arm-vfpv3.xml \
219         arm/xscale-iwmmxt.xml \
220         i386/32bit-core.xml \
221         i386/32bit-sse.xml \
222         i386/32bit-linux.xml \
223         i386/32bit-avx.xml \
224         i386/32bit-mpx.xml \
225         i386/32bit-avx512.xml \
226         i386/32bit-pkeys.xml \
227         i386/64bit-avx512.xml \
228         i386/64bit-core.xml \
229         i386/64bit-mpx.xml \
230         i386/64bit-segments.xml \
231         i386/64bit-avx.xml \
232         i386/64bit-linux.xml \
233         i386/64bit-pkeys.xml \
234         i386/64bit-sse.xml \
235         i386/x32-core.xml \
236         riscv/32bit-cpu.xml \
237         riscv/32bit-csr.xml \
238         riscv/32bit-fpu.xml \
239         riscv/64bit-cpu.xml \
240         riscv/64bit-csr.xml \
241         riscv/64bit-fpu.xml \
242         rx.xml \
243         tic6x-c6xp.xml \
244         tic6x-core.xml \
245         tic6x-gp.xml
246
247 FEATURE_CFILES = $(patsubst %.xml,%.c,$(FEATURE_XMLFILES))
248
249 cfiles: $(TDESC_CFILES) $(FEATURE_CFILES)
250
251 $(TDESC_CFILES): %.c: %.xml
252         $(GDB) -nx -q -batch -ex 'maint print c-tdesc $<' > $@.tmp
253         sh ../../move-if-change $@.tmp $@
254
255 $(FEATURE_CFILES): %.c: %.xml.tmp
256         $(GDB) -nx -q -batch \
257           -ex 'maint print c-tdesc $<' > $@.tmp
258         sh ../../move-if-change $@.tmp $@
259         rm $<
260
261 # %.xml is the XML file for each target description feature, and
262 # %.xml.tmp is the XML file target description which only includes
263 # one target description feature.
264
265 %.xml.tmp: %.xml
266         echo "<?xml version=\"1.0\"?>" > $@.tmp
267         echo "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">" >> $@.tmp
268         echo "<target>" >> $@.tmp
269         echo "  <xi:include href=\"$(notdir $<)\"/>" >> $@.tmp
270         echo "</target>" >> $@.tmp
271         sh ../../move-if-change $@.tmp $@
272
273 # Regenerate RISC-V CSR feature lists.
274 riscv/32bit-csr.xml riscv/64bit-csr.xml: ../../include/opcode/riscv-opc.h
275         ./riscv/rebuild-csr-xml.sh ../../include/opcode/riscv-opc.h ./riscv
276
277 # 'all' doesn't build the C files, so don't delete them in 'clean'
278 # either.
279 clean-cfiles:
280         rm -f $(TDESC_CFILES) $(FEATURE_CFILES)
281
282 clean:
283         rm -f $(OUTPUTS)