Arm: Use feature target descriptions

In arm arm_create_target_description and
aarch32_create_target_description create feature based target descriptions
instead of returning the old style descriptions.

Ensure the descriptions are created in exactly the same way as the old xml
files.

Remove the old initialize calls.

gdb/ChangeLog:

	* arch/aarch32.c (aarch32_create_target_description): Create
	target descriptions using features.
	* arch/arm.c (arm_create_target_description)
	(arm_create_mprofile_target_description): Likewise.
	* arm-tdep.c (_initialize_arm_tdep): Remove tdesc init calls.
This commit is contained in:
Alan Hayward
2019-07-19 15:01:11 +01:00
parent d105cce5dd
commit f29ec96643
4 changed files with 72 additions and 43 deletions

View File

@ -1,3 +1,11 @@
2019-07-19 Alan Hayward <alan.hayward@arm.com>
* arch/aarch32.c (aarch32_create_target_description): Create
target descriptions using features.
* arch/arm.c (arm_create_target_description)
(arm_create_mprofile_target_description): Likewise.
* arm-tdep.c (_initialize_arm_tdep): Remove tdesc init calls.
2019-07-19 Alan Hayward <alan.hayward@arm.com> 2019-07-19 Alan Hayward <alan.hayward@arm.com>
* Makefile.in: Add new files. * Makefile.in: Add new files.

View File

@ -18,12 +18,26 @@
#include "gdbsupport/common-defs.h" #include "gdbsupport/common-defs.h"
#include "aarch32.h" #include "aarch32.h"
extern struct target_desc *tdesc_arm_with_neon; #include "../features/arm/arm-core.c"
#include "../features/arm/arm-vfpv3.c"
/* See aarch32.h. */ /* See aarch32.h. */
target_desc * target_desc *
aarch32_create_target_description () aarch32_create_target_description ()
{ {
return tdesc_arm_with_neon; target_desc *tdesc = allocate_target_description ();
#ifndef IN_PROCESS_AGENT
set_tdesc_architecture (tdesc, "arm");
#endif
long regnum = 0;
regnum = create_feature_arm_arm_core (tdesc, regnum);
/* Create a vfpv3 feature, then a blank NEON feature. */
regnum = create_feature_arm_arm_vfpv3 (tdesc, regnum);
tdesc_create_feature (tdesc, "org.gnu.gdb.arm.neon");
return tdesc;
} }

View File

@ -21,16 +21,12 @@
#include "gdbsupport/common-regcache.h" #include "gdbsupport/common-regcache.h"
#include "arm.h" #include "arm.h"
extern struct target_desc *tdesc_arm_with_vfpv2; #include "../features/arm/arm-core.c"
extern struct target_desc *tdesc_arm_with_vfpv3; #include "../features/arm/arm-vfpv2.c"
extern struct target_desc *tdesc_arm_with_iwmmxt; #include "../features/arm/arm-vfpv3.c"
#include "../features/arm/xscale-iwmmxt.c"
/* Temporary ifdef. Will be removed when target descriptions are switched. */ #include "../features/arm/arm-m-profile.c"
#ifndef GDBSERVER #include "../features/arm/arm-m-profile-with-fpa.c"
extern struct target_desc *tdesc_arm_with_m;
extern struct target_desc *tdesc_arm_with_m_vfp_d16;
extern struct target_desc *tdesc_arm_with_m_fpa_layout;
#endif
/* See arm.h. */ /* See arm.h. */
@ -389,24 +385,41 @@ shifted_reg_val (struct regcache *regcache, unsigned long inst,
target_desc * target_desc *
arm_create_target_description (arm_fp_type fp_type) arm_create_target_description (arm_fp_type fp_type)
{ {
target_desc *tdesc = allocate_target_description ();
#ifndef IN_PROCESS_AGENT
if (fp_type == ARM_FP_TYPE_IWMMXT)
set_tdesc_architecture (tdesc, "iwmmxt");
else
set_tdesc_architecture (tdesc, "arm");
#endif
long regnum = 0;
regnum = create_feature_arm_arm_core (tdesc, regnum);
switch (fp_type) switch (fp_type)
{ {
case ARM_FP_TYPE_NONE: case ARM_FP_TYPE_NONE:
return nullptr; break;
/* Temporary ifdef. Will be removed when target descriptions are switched. */
#ifndef GDBSERVER
case ARM_FP_TYPE_VFPV2: case ARM_FP_TYPE_VFPV2:
return tdesc_arm_with_vfpv2; regnum = create_feature_arm_arm_vfpv2 (tdesc, regnum);
break;
case ARM_FP_TYPE_VFPV3: case ARM_FP_TYPE_VFPV3:
return tdesc_arm_with_vfpv3; regnum = create_feature_arm_arm_vfpv3 (tdesc, regnum);
break;
case ARM_FP_TYPE_IWMMXT: case ARM_FP_TYPE_IWMMXT:
return tdesc_arm_with_iwmmxt; regnum = create_feature_arm_xscale_iwmmxt (tdesc, regnum);
#endif break;
default: default:
error (_("Invalid Arm FP type: %d"), fp_type); error (_("Invalid Arm FP type: %d"), fp_type);
} }
return tdesc;
} }
/* See arch/arm.h. */ /* See arch/arm.h. */
@ -414,21 +427,32 @@ arm_create_target_description (arm_fp_type fp_type)
target_desc * target_desc *
arm_create_mprofile_target_description (arm_m_profile_type m_type) arm_create_mprofile_target_description (arm_m_profile_type m_type)
{ {
target_desc *tdesc = allocate_target_description ();
#ifndef IN_PROCESS_AGENT
set_tdesc_architecture (tdesc, "arm");
#endif
long regnum = 0;
switch (m_type) switch (m_type)
{ {
/* Temporary ifdef. Will be removed when target descriptions are switched. */
#ifndef GDBSERVER
case ARM_M_TYPE_M_PROFILE: case ARM_M_TYPE_M_PROFILE:
return tdesc_arm_with_m; regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
break;
case ARM_M_TYPE_VFP_D16: case ARM_M_TYPE_VFP_D16:
return tdesc_arm_with_m_fpa_layout; regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
regnum = create_feature_arm_arm_vfpv2 (tdesc, regnum);
break;
case ARM_M_TYPE_WITH_FPA: case ARM_M_TYPE_WITH_FPA:
return tdesc_arm_with_m_vfp_d16; regnum = create_feature_arm_arm_m_profile_with_fpa (tdesc, regnum);
#endif break;
default: default:
error (_("Invalid Arm M type: %d"), m_type); error (_("Invalid Arm M type: %d"), m_type);
} }
}
return tdesc;
}

View File

@ -61,14 +61,6 @@
#include "record-full.h" #include "record-full.h"
#include <algorithm> #include <algorithm>
#include "features/arm/arm-with-m.c"
#include "features/arm/arm-with-m-fpa-layout.c"
#include "features/arm/arm-with-m-vfp-d16.c"
#include "features/arm/arm-with-iwmmxt.c"
#include "features/arm/arm-with-vfpv2.c"
#include "features/arm/arm-with-vfpv3.c"
#include "features/arm/arm-with-neon.c"
#if GDB_SELF_TEST #if GDB_SELF_TEST
#include "gdbsupport/selftest.h" #include "gdbsupport/selftest.h"
#endif #endif
@ -9451,15 +9443,6 @@ _initialize_arm_tdep (void)
bfd_target_elf_flavour, bfd_target_elf_flavour,
arm_elf_osabi_sniffer); arm_elf_osabi_sniffer);
/* Initialize the standard target descriptions. */
initialize_tdesc_arm_with_m ();
initialize_tdesc_arm_with_m_fpa_layout ();
initialize_tdesc_arm_with_m_vfp_d16 ();
initialize_tdesc_arm_with_iwmmxt ();
initialize_tdesc_arm_with_vfpv2 ();
initialize_tdesc_arm_with_vfpv3 ();
initialize_tdesc_arm_with_neon ();
/* Add root prefix command for all "set arm"/"show arm" commands. */ /* Add root prefix command for all "set arm"/"show arm" commands. */
add_prefix_cmd ("arm", no_class, set_arm_command, add_prefix_cmd ("arm", no_class, set_arm_command,
_("Various ARM-specific commands."), _("Various ARM-specific commands."),