Commit Graph

2 Commits

Author SHA1 Message Date
Tankut Baris Aktemur ef0478f611 gdbserver/linux-low: start turning linux target ops into methods
This is the beginning of a series of patches that convert the linux
low targets into classes derived from linux_process_target.  At the
end of the series we obtain a class hierarchy that looks like this:

process_stratum_target
^
|
|-- linux_process_target
    ^
    |
    |-- x86_target (defined in linux-x86-low)
    |-- aarch64_target (defined in linux-aarch64-low)
    |-- ppc_target (defined in linux-ppc-low)
    |-- ...

In several cases, linux_process_target simply forwards a target op
request to a corresponding linux_target_ops function.  For these
cases, the definition in linux_process_target will be removed and the
definition will be left to the deriving linux low target class; using
inheritance provides a nice and natural, object-oriented
simplification in these cases.

The series converts linux_target_ops into protected methods of
linux_process_target one by one.  Throughout the series, based on the
needs, static functions defined in linux-low.cc are converted to
private methods of linux_process_target as well.  This is done either
as separate patches or as integrated into a patch that convert a
particular linux_target_op into a method.

The series ends with the patch titled "gdbserver/linux-low: delete
'linux_target_ops' and 'the_low_target'".

Built and regression-tested on x86_64-linux.  The following linux low
targets have been built (but not tested) via cross-compilation:
aarch64, arm, m68k, mips, ppc, riscv, s390, sh, sparc.  The other
targets (bfin, cris, crisv32, ia64, m32r, nios2, tic6x, tile, xtensa)
were neither built nor tested.

gdbserver/ChangeLog:
2020-04-02  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* linux-low.h (the_linux_target): New extern declaration.
	* linux-low.cc (initialize_low): Use 'the_linux_target' to set
	'the_target'.
	(the_linux_target): Remove.
	* linux-x86-low.cc (class x86_target): New class.
	(the_x86_target): New static object.
	(the_linux_target): Define as pointer to the_x86_target.
	* linux-aarch64-low.cc (class aarch64_target): New class.
	(the_aarch64_target): New static object.
	(the_linux_target): Define as pointer to the_aarch64_target.
	* linux-arm-low.cc (class arm_target): New class.
	(the_arm_target): New static object.
	(the_linux_target): Define as pointer to the_arm_target.
	* linux-bfin-low.cc (class bfin_target): New class.
	(the_bfin_target): New static object.
	(the_linux_target): Define as pointer to the_bfin_target.
	* linux-cris-low.cc (class cris_target): New class.
	(the_cris_target): New static object.
	(the_linux_target): Define as pointer to the_cris_target.
	* linux-crisv32-low.cc (class crisv32_target): New class.
	(the_crisv32_target): New static object.
	(the_linux_target): Define as pointer to the_crisv32_target.
	* linux-ia64-low.cc (class ia64_target): New class.
	(the_ia64_target): New static object.
	(the_linux_target): Define as pointer to the_ia64_target.
	* linux-m32r-low.cc (class m32r_target): New class.
	(the_m32r_target): New static object.
	(the_linux_target): Define as pointer to the_m32r_target.
	* linux-m68k-low.cc (class m68k_target): New class.
	(the_m68k_target): New static object.
	(the_linux_target): Define as pointer to the_m68k_target.
	* linux-mips-low.cc (class mips_target): New class.
	(the_mips_target): New static object.
	(the_linux_target): Define as pointer to the_mips_target.
	* linux-nios2-low.cc (class nios2_target): New class.
	(the_nios2_target): New static object.
	(the_linux_target): Define as pointer to the_nios2_target.
	* linux-ppc-low.cc (class ppc_target): New class.
	(the_ppc_target): New static object.
	(the_linux_target): Define as pointer to the_ppc_target.
	* linux-riscv-low.cc (class riscv_target): New class.
	(the_riscv_target): New static object.
	(the_linux_target): Define as pointer to the_riscv_target.
	* linux-s390-low.cc (class s390_target): New class.
	(the_s390_target): New static object.
	(the_linux_target): Define as pointer to the_s390_target.
	* linux-sh-low.cc (class sh_target): New class.
	(the_sh_target): New static object.
	(the_linux_target): Define as pointer to the_sh_target.
	* linux-sparc-low.cc (class sparc_target): New class.
	(the_sparc_target): New static object.
	(the_linux_target): Define as pointer to the_sparc_target.
	* linux-tic6x-low.cc (class tic6x_target): New class.
	(the_tic6x_target): New static object.
	(the_linux_target): Define as pointer to the_tic6x_target.
	* linux-tile-low.cc (class tile_target): New class.
	(the_tile_target): New static object.
	(the_linux_target): Define as pointer to the_tile_target.
	* linux-xtensa-low.cc (class xtensa_target): New class.
	(the_xtensa_target): New static object.
	(the_linux_target): Define as pointer to the_xtensa_target.
2020-04-02 15:11:23 +02:00
Simon Marchi feacfcacaa gdbserver: rename source files to .cc
For the same reasons outlined in the previous patch, this patch renames
gdbserver source files to .cc.

I have moved the "-x c++" switch to only those rules that require it.

gdbserver/ChangeLog:

	* Makefile.in: Rename source files from .c to .cc.
	* %.c: Rename to %.cc.
	* configure.ac: Rename server.c to server.cc.
	* configure: Re-generate.
2020-02-13 16:27:51 -05:00