This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/7] Arm: Add read_description read funcs and use in GDB
> On 10 Jul 2019, at 14:52, Alan Hayward <Alan.Hayward@arm.com> wrote:
>
>
>
>> On 10 Jul 2019, at 04:45, Simon Marchi <simark@simark.ca> wrote:
>>
>> On 2019-07-05 5:45 a.m., Alan Hayward wrote:
>>>
>>> +
>>> +/* See arch/arm.h. */
>>> +
>>> +target_desc *
>>> +arm_create_target_description (arm_fp_type fp_type)
>>> +{
>>> + switch (fp_type)
>>> + {
>>> + case ARM_FP_TYPE_NONE:
>>> + return nullptr;
>>> +
>>> + case ARM_FP_TYPE_VFPV2:
>>> + return tdesc_arm_with_vfpv2;
>>> +
>>> + case ARM_FP_TYPE_VFPV3:
>>> + return tdesc_arm_with_vfpv3;
>>> +
>>> + case ARM_FP_TYPE_IWMMXT:
>>> + return tdesc_arm_with_iwmmxt;
>>> +
>>> + default:
>>> + error (_("Invalid Arm FP type: %d"), fp_type);
>>> + }
>>> +}
>>> +
>>> +/* See arch/arm.h. */
>>> +
>>> +target_desc *
>>> +arm_create_mprofile_target_description (arm_m_profile_type m_type)
>>> +{
>>> + switch (m_type)
>>> + {
>>> +#ifndef GDBSERVER
>>> + case ARM_M_TYPE_M_PROFILE:
>>> + return tdesc_arm_with_m;
>>> +
>>> + case ARM_M_TYPE_VFP_D16:
>>> + return tdesc_arm_with_m_fpa_layout;
>>> +
>>> + case ARM_M_TYPE_WITH_FPA:
>>> + return tdesc_arm_with_m_vfp_d16;
>>> +#endif
>>> + default:
>>> + error (_("Invalid Arm M type: %d"), m_type);
>>> + }
>>> +}
>>
>> If it doesn't make sense to have this function shared with GDBserver (given
>> that GDBserver doesn't run on Cortex-Ms), it should probably go in gdb/arm-tdep.c.
>
> Right. I wasn’t thinking of arch as “architecture code shared with gdbserver”,
> but it makes sense.
>
> The GDBSERVER defines do vanish later in the series.
>
> I think I preferred having the two functions together in arch, but I’ve moved it.
>
To this, I’ll add that moving the mprofile function into arm-tdep.c means that
in a later patch, both arm-tdep.c and arch/arm.c have to
#include "features/arm/arm-vfpv2.c”
This is because ARM_M_TYPE_VFP_D16 uses the vfpv2 functions.
It works, but means that the same static function is being included twice.
Alan.