diff options
author | Alan Hayward <alan.hayward@arm.com> | 2019-07-19 14:59:10 +0100 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2019-07-19 14:59:10 +0100 |
commit | d105cce5dd8d6a5218b044fc161ce89c6b245432 (patch) | |
tree | 1562d65f665cc3e2dc5023d48e24de0a428eb79c /gdb/arm-tdep.c | |
parent | 231097b03afffd0c5a2b520cd999dbcbe8d64eda (diff) | |
download | gdb-d105cce5dd8d6a5218b044fc161ce89c6b245432.zip gdb-d105cce5dd8d6a5218b044fc161ce89c6b245432.tar.gz gdb-d105cce5dd8d6a5218b044fc161ce89c6b245432.tar.bz2 |
Arm: Add read_description read funcs and use in GDB
Switch the Arm target to get target descriptions via arm_read_description
and aarch32_read_description, in the same style as other feature targets.
Add an enum to specify the different types - this will also be of use to
gdbserver in a later patch.
Under the hood return the same existing pre-feature target descriptions.
gdb/ChangeLog:
* Makefile.in: Add new files.
* aarch32-tdep.c: New file.
* aarch32-tdep.h: New file.
* aarch64-linux-nat.c (aarch64_linux_nat_target::read_description):
Call aarch32_read_description.
* arch/aarch32.c: New file.
* arch/aarch32.h: New file.
* arch/arm.c (arm_create_target_description)
(arm_create_mprofile_target_description): New function.
* arch/arm.h (arm_fp_type, arm_m_profile_type): New enum.
(arm_create_target_description)
(arm_create_mprofile_target_description): New declaration.
* arm-fbsd-tdep.c (arm_fbsd_read_description_auxv): Call
read_description functions.
* arm-linux-nat.c (arm_linux_nat_target::read_description):
Likewise.
* arm-linux-tdep.c (arm_linux_core_read_description): Likewise.
* arm-tdep.c (tdesc_arm_list): New variable.
(arm_register_g_packet_guesses): Call create description functions.
(arm_read_description) (arm_read_mprofile_description): New
function.
* arm-tdep.h (arm_read_description)
(arm_read_mprofile_description): Add declaration.
* configure.tgt: Add new files.
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r-- | gdb/arm-tdep.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index c1ee397..1b19b72 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -240,6 +240,10 @@ static const char **valid_disassembly_styles; /* Disassembly style to use. Default to "std" register names. */ static const char *disassembly_style; +/* All possible arm target descriptors. */ +static struct target_desc *tdesc_arm_list[ARM_FP_TYPE_INVALID]; +static struct target_desc *tdesc_arm_mprofile_list[ARM_M_TYPE_INVALID]; + /* This is used to keep the bfd arch_info in sync with the disassembly style. */ static void set_disassembly_style_sfunc (const char *, int, @@ -8739,7 +8743,6 @@ arm_register_reggroup_p (struct gdbarch *gdbarch, int regnum, return default_register_reggroup_p (gdbarch, regnum, group); } - /* For backward-compatibility we allow two 'g' packet lengths with the remote protocol depending on whether FPA registers are supplied. M-profile targets do not have FPA registers, but some @@ -8753,21 +8756,26 @@ arm_register_g_packet_guesses (struct gdbarch *gdbarch) { if (gdbarch_tdep (gdbarch)->is_m) { + const target_desc *tdesc; + /* If we know from the executable this is an M-profile target, cater for remote targets whose register set layout is the same as the FPA layout. */ + tdesc = arm_read_mprofile_description (ARM_M_TYPE_WITH_FPA); register_remote_g_packet_guess (gdbarch, ARM_CORE_REGS_SIZE + ARM_FP_REGS_SIZE, - tdesc_arm_with_m_fpa_layout); + tdesc); /* The regular M-profile layout. */ + tdesc = arm_read_mprofile_description (ARM_M_TYPE_M_PROFILE); register_remote_g_packet_guess (gdbarch, ARM_CORE_REGS_SIZE, - tdesc_arm_with_m); + tdesc); /* M-profile plus M4F VFP. */ + tdesc = arm_read_mprofile_description (ARM_M_TYPE_VFP_D16); register_remote_g_packet_guess (gdbarch, ARM_CORE_REGS_SIZE + ARM_VFP2_REGS_SIZE, - tdesc_arm_with_m_vfp_d16); + tdesc); } /* Otherwise we don't have a useful guess. */ @@ -13310,3 +13318,35 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache, return ret; } + +/* See arm-tdep.h. */ + +const target_desc * +arm_read_description (arm_fp_type fp_type) +{ + struct target_desc *tdesc = tdesc_arm_list[fp_type]; + + if (tdesc == nullptr) + { + tdesc = arm_create_target_description (fp_type); + tdesc_arm_list[fp_type] = tdesc; + } + + return tdesc; +} + +/* See arm-tdep.h. */ + +const target_desc * +arm_read_mprofile_description (arm_m_profile_type m_type) +{ + struct target_desc *tdesc = tdesc_arm_mprofile_list[m_type]; + + if (tdesc == nullptr) + { + tdesc = arm_create_mprofile_target_description (m_type); + tdesc_arm_mprofile_list[m_type] = tdesc; + } + + return tdesc; +} |