RE: [Patch, microblaze]: Fix for remote G Packet message too long error for baremetal.

Ajit Kumar Agarwal
2014-06-24T13:27:21Z

-----Original Message-----
From: Pedro Alves [mailto:palves@redhat.com]
Sent: Tuesday, June 24, 2014 6:17 PM
To: Ajit Kumar Agarwal
Cc: gdb-patches@sourceware.org; Michael Eager; Vinod Kathail; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: Re: [Patch, microblaze]: Fix for remote G Packet message too long error for baremetal.

On 06/24/2014 01:31 PM, Ajit Kumar Agarwal wrote:

>>
>> The default is choosen to assume stack protect to make compatible with the handling of stack protect registers in XMD Debugger.
>
>>> But you've already added the G packet size guess for that.
>
> In this case is it correct to say
> If (tdesc == NULL)
> tdesc = tdesc_microblaze;
>
> instead of tdesc_microblaze_with_stack_protect?

Yes.

>
>>> -
>>> + if (tdesc_data != NULL)
>>> + {
>>> + tdesc_use_registers (gdbarch, tdesc, tdesc_data);
>>> + set_gdbarch_register_type (gdbarch,
>>> + microblaze_register_type);
>>
>>>> Hmm, why is this set_gdbarch_register_type call necessary?
>>
>> /* Override tdesc_register_type to adjust the types of VFP
>> registers for NEON. */
>> This is done for arm target to set the different type for VFP
>> registers for Neon with Boolean flags is set before this call for VFP
>> registers. In the microblaze target it's not required for special
>> case of stack protect as
> the microblaze_register_type always return builtin_int for these stack protect registers.
>
> Right.

Actually, not right... This comment doesn't really appear to be correct:

> In the microblaze target it's not required for special case of stack
> protect as the microblaze_register_type always return builtin_int for these stack protect registers.

>>static struct type *
>>microblaze_register_type (struct gdbarch *gdbarch, int regnum) {
>>if (regnum == MICROBLAZE_SP_REGNUM)
>> return builtin_type (gdbarch)->builtin_data_ptr;

>>if (regnum == MICROBLAZE_PC_REGNUM)
>>return builtin_type (gdbarch)->builtin_func_ptr;

>>return builtin_type (gdbarch)->builtin_int; }

What I meant the stack protect register are neither MICROBLAZE_SP_REGNUM nor MICROBLAZE_PC_REGNUM so it always return register_type as builtin_int as derived from the code.

MICROBLAZE_SP_REGNUM and MICROBLAZE_PC_REGNUM clearly aren't builtin_int...

>>Doesn't your patch change the output of "ptype $sp" and "ptype $pc" ?

I will check this and add the changes mentioned below in xml files.

That points at something missing in the target description:

> + <feature
> +name="org.gnu.gdb.microblaze.core">
> + <reg name="r1" bitsize="32"/>
...
> + <reg name="rpc" bitsize="32"/>

>>AFAICS, SP is "r1", and PC is "rpc". These should be marked with type="data_ptr" and type="code_ptr" .

Surely I will do this.

>
>>>> As I mentioned before, please don't forget to document the new target features in the manual.
>>
>> Would you mind in explaining which manual need to be changed for the new target.
>
>>> The GDB manual, gdb/doc/gdb.texinfo, describes all the standard XML target features. See the "Standard Target Features" node, and add a new subsection for MicroBlaze.
>
> Thanks !! I will add subsection for Microblaze target.

Thank you.

--
Pedro Alves