binutils-gdb/gdb/features
Simon Marchi d4a0e8b57d Split tdesc_type into multiple classes
This patch makes tdesc_type an abstract base class and creates three
subclasses:

- tdesc_type_builtin, for builtin types
- tdesc_type_vector, for vector types
- tdesc_type_with_fields, for struct, union, flag and enum types

This allows getting rid of the union in tdesc_type and to not allow the
std::vector separately.  I tried to go further and create separate
classes for struct, union, flag and enum, but it proved too difficult.
One problem is that from the point of the of the target description
code, the types tdesc_type_* are opaque (only forward-declared).
Therefore, it doesn't know about inheritance relationship between those
classes.  This makes it impossible to make functions that accept a
pointer to a base class and pass a pointer to a derived class, for
example.  I think this patch here is a good compromise, and if somebody
wants to improve things further, the door is open.

A make_gdb_type virtual pure method is added to tdesc_type, which
replaces the current tdesc_gdb_type function.  Calling this method on a
tdesc_type returns the corresponding built gdb type.

gdb/ChangeLog:

	* target-descriptions.c (struct tdesc_type): Use default
	destructor.
	<u>: Remove.
	<accept>: Remove.
	(struct tdesc_type_builtin): New.
	(struct tdesc_type_vector): New.
	(struct tdesc_type_with_fields): New.
	(tdesc_predefined_types): Change type to tdesc_type_builtin[].
	(tdesc_gdb_type): Remove.
	(tdesc_register_type): Adjust.
	(tdesc_create_vector): Create tdesc_type_vector.
	(tdesc_create_struct): Create tdesc_type_with_fields.
	(tdesc_set_struct_size): Change parameter type.
	(tdesc_create_union): Create tdesc_type_with_fields.
	(tdesc_create_flags): Likewise.
	(tdesc_create_enum): Likewise.
	(tdesc_add_field): Change parameter type.
	(tdesc_add_typed_bitfield): Likewise.
	(tdesc_add_bitfield): Likewise.
	(tdesc_add_flag): Likewise.
	(tdesc_add_enum_value): Likewise.
	(print_c_tdesc) <visit>: Remove overload with tdesc_type
	parameter, add overloads for tdesc_type_builtin,
	tdesc_type_with_fields and tdesc_type_vector.
	<m_printed_type>: Remove.
	<m_printed_element_type, m_printed_type_with_fields>: Add.
	* target-descriptions.h (tdesc_create_enum): Change return type.
	(tdesc_add_typed_bitfield): Change parameter type.
	(tdesc_add_enum_value): Change parameter type.
	* xml-tdesc.c (struct tdesc_parsing_data) <current_type>: Change
	type to tdesc_type_with_fields.
	(tdesc_start_struct): Adjust.
	(tdesc_start_flags): Adjust.
	(tdesc_start_enum): Adjust.
	(tdesc_start_field): Adjust.
	* arch/tdesc.h (struct tdesc_type_builtin): Forward-declare.
	(struct tdesc_type_vector): Forward-declare.
	(struct tdesc_type_with_fields): Forward-declare.
	(tdesc_create_struct): Change return type.
	(tdesc_create_union): Likewise.
	(tdesc_create_flags): Likewise.
	(tdesc_add_field): Change parameter type.
	(tdesc_set_struct_size): Likewise.
	(tdesc_add_bitfield): Likewise.
	(tdesc_add_flag): Likewise.
	* features: Re-generate C files.

gdb/gdbserver/ChangeLog:

	* tdesc.c (struct tdesc_type): Change return type.
	(tdesc_add_flag): Change parameter type.
	(tdesc_add_bitfield): Likewise.
	(tdesc_add_field): Likewise.
	(tdesc_set_struct_size): Likewise.
2017-12-05 16:30:28 -05:00
..
arm Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
i386 Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
rs6000 Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
sparc gdb: provide and use sparc{32,64} target description XML files. 2017-02-05 23:44:03 -08:00
aarch64-core.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
aarch64-core.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
aarch64-fpu.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
aarch64-fpu.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
aarch64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
arc-arcompact.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
arc-arcompact.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
arc-v2.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
arc-v2.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
btrace-conf.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
btrace.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
feature_to_c.sh update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
gdb-target.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
gdbserver-regs.xsl
library-list-aix.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
library-list-svr4.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
library-list.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
m68k-core.xml
Makefile Use flexible target descriptors for aarch64 2017-11-24 11:18:19 +00:00
microblaze-core.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
microblaze-stack-protect.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
microblaze-with-stack-protect.c
microblaze-with-stack-protect.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
microblaze.c
microblaze.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips64-cp0.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips64-cpu.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips64-dsp-linux.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
mips64-dsp-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips64-dsp.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips64-fpu.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips64-linux.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
mips64-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips-cp0.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips-cpu.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips-dsp-linux.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
mips-dsp-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips-dsp.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips-fpu.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mips-linux.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
mips-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nds32-core.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nds32-fpu.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nds32-system.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nds32.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
nds32.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nios2-cpu.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nios2-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
nios2.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
nios2.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
number-regs.xsl
osdata.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-acr.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-core32.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-core64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-fpr.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-gs-linux64.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
s390-gs-linux64.xml S390: Add guarded-storage register definitions and tdescs 2017-09-25 16:02:23 +02:00
s390-gs.xml S390: Add guarded-storage register definitions and tdescs 2017-09-25 16:02:23 +02:00
s390-gsbc.xml S390: Add guarded-storage register definitions and tdescs 2017-09-25 16:02:23 +02:00
s390-linux32.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390-linux32.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-linux32v1.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390-linux32v1.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-linux32v2.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390-linux32v2.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-linux64.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-linux64v1.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390-linux64v1.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-linux64v2.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390-linux64v2.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-tdb.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-te-linux64.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390-te-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-tevx-linux64.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
s390-tevx-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-vx-linux64.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
s390-vx-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390-vx.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390x-core64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390x-gs-linux64.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
s390x-gs-linux64.xml S390: Add guarded-storage register definitions and tdescs 2017-09-25 16:02:23 +02:00
s390x-linux64.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390x-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390x-linux64v1.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390x-linux64v1.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390x-linux64v2.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390x-linux64v2.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390x-te-linux64.c Use visitor pattern for "maint print c-tdesc" 2017-07-26 12:56:54 +01:00
s390x-te-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390x-tevx-linux64.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
s390x-tevx-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
s390x-vx-linux64.c Split tdesc_type into multiple classes 2017-12-05 16:30:28 -05:00
s390x-vx-linux64.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
sort-regs.xsl
threads.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tic6x-c6xp.c Change tic6x target descriptions 2017-11-24 09:29:43 +00:00
tic6x-c6xp.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tic6x-c62x-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tic6x-c64x-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tic6x-c64xp-linux.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tic6x-core.c Change tic6x target descriptions 2017-11-24 09:29:43 +00:00
tic6x-core.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tic6x-gp.c Change tic6x target descriptions 2017-11-24 09:29:43 +00:00
tic6x-gp.xml update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
traceframe-info.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
xinclude.dtd update copyright year range in GDB files 2017-01-01 10:52:34 +04:00