Commit Graph

8 Commits

Author SHA1 Message Date
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Yao Qi 22916b0786 Convert the rest x86 target descriptions
This patch changes the rest of x86 target descriptions in GDB and
GDBserver.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* amd64-tdep.c (amd64_target_description): Create target
	descriptions.
	(_initialize_amd64_tdep): Don't call functions
	initialize_tdesc_amd64_*.  Add self tests.
	* arch/amd64.c (amd64_create_target_description): Add parameter
	is_linux.  Call set_tdesc_osabi if is_linux is true.
	* arch/amd64.h (amd64_create_target_description): Update the
	declaration.
	* arch/i386.c (i386_create_target_description): Add parameter
	is_linux.  Call set_tdesc_osabi if is_linux is true.
	* arch/i386.h (i386_create_target_description): Update
	declaration.
	* configure.tgt: Add i386.o to gdb_target_obs.
	* features/Makefile (XMLTOC): Remove i386/*.xml.
	* features/i386/amd64-avx-avx512.c: Remove.
	* features/i386/amd64-avx-mpx-avx512-pku.c: Remove.
	* features/i386/amd64-avx-mpx.c: Remove.
	* features/i386/amd64-avx.c: Remove.
	* features/i386/amd64-mpx.c: Remove.
	* features/i386/amd64.c: Remove.
	* features/i386/i386-avx-avx512.c: Remove.
	* features/i386/i386-avx-mpx-avx512-pku.c: Remove.
	* features/i386/i386-avx-mpx.c: Remove.
	* features/i386/i386-avx.c: Remove.
	* features/i386/i386-mmx.c: Remove.
	* features/i386/i386-mpx.c: Remove.
	* features/i386/i386.c: Remove.
	* i386-tdep.c: Don't include features/i386/i386*.c., include
	target-descriptions.h and arch/i386.h.
	(i386_target_description): Create target descriptions.
	(i386_gdbarch_init): Don't call initialize_tdesc_i386_*
	functions.  Do self tests.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv (srv_i386_regobj): Remove.
	(srv_amd64_regobj): Remove.
	(srv_regobj): Set it to "" for x86 non-linux targets.
	* linux-x86-tdesc.c (i386_linux_read_description):
	* lynx-i386-low.c: Include x86-xstate.h and arch/i386.h.
	(init_registers_i386): Remove the declaration.
	(tdesc_i386): Remove the declaration.
	(lynx_i386_arch_setup): Call i386_create_target_description.
	* nto-x86-low.c: Likewise.
	* win32-i386-low.c [__x86_64__]: include arch/amd64.h.
	[!__x86_64__]: include arch/i386.h.
	(i386_arch_setup) [__x86_64__]: Call amd64_create_target_description.
2017-09-05 09:54:54 +01:00
Yao Qi b4570e4b30 Convert amd64-linux target descriptions
This patch changes amd64-linux target descriptions so that they can be
dynamically generated in both GDB and GDBserver.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (arch-amd64.o): New rule.
	* configure.srv: Append arch-amd64.o.
	* linux-amd64-ipa.c: Include common/x86-xstate.h.
	(get_ipa_tdesc): Call amd64_linux_read_description.
	(initialize_low_tracepoint): Don't call init_registers_x32_XXX
	and init_registers_amd64_XXX.
	* linux-x86-low.c (x86_linux_read_description): Call
	amd64_linux_read_description.
	(x86_get_ipa_tdesc_idx): Call amd64_get_ipa_tdesc_idx.
	(initialize_low_arch): Don't call init_registers_x32_XXX and
	init_registers_amd64_XXX.
	* linux-x86-tdesc-selftest.c: Declare init_registers_amd64_XXX
	and tdesc_amd64_XXX.
	[__x86_64__] (amd64_tdesc_test): New function.
	(initialize_low_tdesc) [__x86_64__]: Call init_registers_x32_XXX
	and init_registers_amd64_XXX.
	* linux-x86-tdesc.c: Include arch/amd64.h.
	(xcr0_to_tdesc_idx): New function.
	(i386_linux_read_description): New function.
	(amd64_get_ipa_tdesc_idx): New function.
	* linux-x86-tdesc.h (amd64_get_ipa_tdesc_idx): Declare.
	(amd64_get_ipa_tdesc): Declare.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* amd64-linux-tdep.c: Include arch/amd64.h.  Don't include
	features/i386/*.c.
	(amd64_linux_read_description): Call
	amd64_create_target_description.
	* arch/amd64.c: New file.
	* arch/amd64.h: New file.
	* configure.tgt (x86_64-*-linux*): Append amd64.o.
	* Makefile.in (ALL_64_TARGET_OBS): Append amd64.o.
2017-09-05 09:54:54 +01:00
Yao Qi 25a93583f3 [GDBserver] Use pre-generated tdesc as test
Now, these *-generate.c files are only used in GDBserver for unit test.
If $development is false (in release), these *-generate.c files won't be
used at all.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv: Set srv_i386_linux_regobj empty if $development
	is false.
	* linux-i386-ipa.c (initialize_low_tracepoint): Don't call
	initialize_low_tdesc.
	* linux-x86-low.c (initialize_low_arch): Wrap initialize_low_tdesc
	with #if initialize_low_tdesc.
	* linux-x86-tdesc-selftest.c: New file.
	* linux-x86-tdesc.c: Move code to linux-x86-tdesc-selftest.c.
2017-09-05 09:54:53 +01:00
Yao Qi 5f035c0716 Share i386-linux target description between GDB and GDBserver
The code on creating i386-linux target descriptions are quite similar
between GDB and GDBserver, so this patch moves them into a shared file
arch/i386.c.  I didn't name it as i386-linux.c, because I want to reuse it
to create other i386 non-linux target descriptions later.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (ALL_TARGET_OBS): Add i386.o.
	(SFILES): Add arch/i386.c.
	(HFILES_NO_SRCDIR): Add arch/i386.h.
	* arch/i386.c: New file.
	* arch/i386.h: New file.
	* arch/tdesc.h (allocate_target_description): Declare.
	(set_tdesc_architecture): Declare.
	(set_tdesc_osabi): Declare.
	* configure.tgt (i[34567]86-*-linux*): Add i386.o.
	* i386-linux-tdep.c: Don't include ../features/i386/32bit-XXX.c.
	include arch/i386.h.
	(i386_linux_read_description): Remove code and call
	i386_create_target_description.
	(set_tdesc_architecture): New function.
	(set_tdesc_osabi): New function.
	* target-descriptions.h (allocate_target_description): Remove.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* Makefile.in (arch-i386.o): New rule.
	* configure.srv (i[34567]86-*-linux*): Add arch-i386.o.
	(x86_64-*-linux*): Likewise.
	* linux-x86-tdesc.c: Don't include ../features/i386/32bit-XXX.c,
	include arch/i386.h.
	(i386_linux_read_description): Remove code and call
	i386_create_target_description.
	* tdesc.c (allocate_target_description): New function.
	* tdesc.h (set_tdesc_architecture): Remove declaration.
	(set_tdesc_osabi): Likewise.
2017-09-05 09:54:53 +01:00
Yao Qi 0abe8a8992 Dynamically composite xml in reply to GDB
GDBserver still uses pre-generated target descriptions in order to
reply to GDB's query on target description (see xml-builtin-generated.c
in GDBserver build directory).  This patch teaches GDBserver to
create XML contents according to the target descriptions rather than
using pre-generated ones.

First, change target feature c files to pass the feature xml file
name to tdesc_create_feature, so that target description in GDBserver
can record them, and create XML contents from these features in
buffer, like

  ...
  <xi:include href="$FEATURE1_XML_NAME"/>
  <xi:include href="$FEATURE2_XML_NAME"/>
  ...

and send this buffer back to GDB.

Note that this patch reuses target_desc.xmltarget a little bit, which is
to hold the XML contents dynamically generated in tdesc_get_features_xml.
However, it is not xfree'ed in ~target_desc, because we can't tell it is
from xstrdup or a literal string.  Since we don't delete target_desc,
there is no memory leak yet.  After we change all target descriptions to
the new style, target_desc.xmltarget is from xstrdup, then, we can safely
xfree it in ~target_desc.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* arch/tdesc.h (tdesc_create_feature): Add an argument xml.
	* target-descriptions.c (tdesc_create_feature): Likewise, and
	adjust code.
	* features/i386/32bit-avx.c: Re-generated.
	* features/i386/32bit-avx512.c: Re-generated.
	* features/i386/32bit-core.c: Re-generated.
	* features/i386/32bit-linux.c: Re-generated.
	* features/i386/32bit-mpx.c: Re-generated.
	* features/i386/32bit-pkeys.c: Re-generated.
	* features/i386/32bit-sse.c: Re-generated.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* linux-x86-tdesc.c: Don't include <inttypes.h>.
	(i386_linux_read_description) [!IN_PROCESS_AGENT]: Call
	set_tdesc_architecture and set_tdesc_osabi.  Remove code setting
	.xmltarget.
	* server.c (get_features_xml): Call tdesc_get_features_xml.
	* tdesc.c (set_tdesc_architecture): New function.
	(set_tdesc_osabi): New function.
	(tdesc_get_features_xml): New function.
	(tdesc_create_feature): Add an argument.
	* tdesc.h (struct target_desc) <features>: New field.
	<arch, osabi>: New field.
	(~target_desc): xfree features, arch, and osabi.
	(target_desc::oerator==): Don't compare .xmltarget.
	[!IN_PROCESS_AGENT] (set_tdesc_architecture): Declare.
	(set_tdesc_osabi): Likewise.
	(tdesc_get_features_xml): Likewise.
2017-09-05 09:54:53 +01:00
Yao Qi 0a188386c0 [GDBserver] unit test to i386_tdesc
This patch adds a unit test in GDBserver to test dynamically created
target descriptions equal these pre-generated ones.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* linux-x86-tdesc.c: Include selftest.h.
	(i386_tdesc_test): New function.
	(initialize_low_tdesc): Call selftests::register_test.
	* tdesc.h: Include regdef.h.
	(target_desc): Override operator == and !=.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* regformats/regdef.h (struct reg): Override operator == and !=.
2017-09-05 09:54:53 +01:00
Yao Qi f49ff00066 [GDBserver] Centralize tdesc for i386-linux
tdesc_i386_XXX_linux is used in many places in linux-x86-low.c and this
patch adds a new function i386_linux_read_description to return the right
tdesc according to xcr0.  i386_linux_read_description is quite similar to
the counterpart in GDB, and the following patch will share the duplicated
code, so this patch adds arch/tdesc.h includes the declarations of various
tdesc apis which are used by the shared code.  The generated c feature
files can include arch/tdesc.h only.

gdb/gdbserver:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* configure.srv (srv_tgtobj): Append linux-x86-tdesc.o.
	(ipa_obj): Likewise.
	* linux-i386-ipa.c: Include common/x86-xstate.h
	(get_ipa_tdesc): Call i386_linux_read_description.
	(initialize_low_tracepoint): Don't call  init_registers_XXX
	functions, call initialize_low_tdesc instead.
	* linux-x86-low.c (x86_linux_read_description): Call
	i386_linux_read_description.
	(initialize_low_arch): Don't call init_registers_i386_XXX
	functions, call initialize_low_tdesc.
	* linux-x86-tdesc.c: New file.
	* linux-x86-tdesc.h (x86_linux_tdesc): New X86_TDESC_LAST.
	(i386_get_ipa_tdesc_idx): Declare.
	(i386_get_ipa_tdesc): Declare.
	(initialize_low_tdesc): Declare.

gdb:

2017-09-05  Yao Qi  <yao.qi@linaro.org>

	* arch/tdesc.h: New file.
	* regformats/regdat.sh: Generate code using tdesc_create_reg.
	* target-descriptions.c: Update comments.
	* target-descriptions.h: Include "arch/tdesc.h".  Remove the
	declarations.
	* features/i386/32bit-avx.c: Re-generated.
	* features/i386/32bit-avx512.c: Re-generated.
	* features/i386/32bit-core.c: Re-generated.
	* features/i386/32bit-linux.c: Re-generated.
	* features/i386/32bit-mpx.c: Re-generated.
	* features/i386/32bit-pkeys.c: Re-generated.
	* features/i386/32bit-sse.c: Re-generated.
2017-09-05 09:54:53 +01:00