This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] Enable tracing of pseudo-registers on ARM


Pedro Alves writes:

> On 02/19/2016 07:28 PM, Antoine Tremblay wrote:
>
>> +/* Map the pseudo register number REG to the proper register number.  */
>> +
>> +static int
>> +arm_pseudo_register_to_register (struct gdbarch *gdbarch, int reg)
>> +{
>
>> +  /* Get the remote/tdesc register number.  */
>> +  double_regnum = gdbarch_remote_register_number (gdbarch, double_regnum);
>
> Hmm, I don't think it should be the responsibility of this function to
> map gdb to remote numbers though.  Here I think we should just map
> gdb pseudo to gdb raw.

Yes I had created that function for arm_ax_pseudo_register_* functions
but yes maybe it would be better at a lower level and allow this
function to be used by something else.
>
>> +
>> +  return double_regnum;
>> +}
>> +
>> +/* Implementation of the ax_pseudo_register_collect gdbarch function.  */
>> +
>> +static int
>> +arm_ax_pseudo_register_collect (struct gdbarch *gdbarch,
>> +				struct agent_expr *ax, int reg)
>> +{
>> +  int rawnum = arm_pseudo_register_to_register (gdbarch, reg);
>> +
>> +  /* Error.  */
>> +  if (rawnum < 0)
>> +    return 1;
>> +
>> +  ax_reg_mask (ax, rawnum);
>
> Hmm, seems to me that gdb raw -> target raw mapping should be
> either here, or perhaps even in ax_reg / ax_reg_mask?
>

Yes now that you mention it it would make sense in ax_reg/reg_mask.

> Consider the case of an expression requiring the collection of
> a _raw_ register, thus not even reaching here.  Looking at
> ax-gdb.c/ax-general.c I don't see where is anything mapping gdb raw numbers
> to remote/tdesc numbers?  So how does _that_ work?  Are the register masks that gdb
> is computing actually wrong for the target, and things just happen
> to work because gdbserver ignores them and always collects all registers?
>
I would assume so indeed!

I'll make this a small series send another patch to apply prior to this
one with the change to ax_reg, ax_reg_mask.

Thanks,
Antoine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]