This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3] Enable tracing of pseudo-registers on ARM
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Marcin KoÅcielnicki <koriakin at 0x04 dot net>, "Antoine Tremblay" <antoine dot tremblay at ericsson dot com>, <gdb-patches at sourceware dot org>, <qiyaoltc at gmail dot com>
- Date: Wed, 24 Feb 2016 13:55:46 -0500
- Subject: Re: [PATCH v3] Enable tracing of pseudo-registers on ARM
- Authentication-results: sourceware.org; auth=none
- References: <wwoklh6gpsne dot fsf at ericsson dot com> <1455910116-13237-1-git-send-email-antoine dot tremblay at ericsson dot com> <56C7796B dot 3030504 at redhat dot com> <wwokoab8it8q dot fsf at ericsson dot com> <56CDF23A dot 8000007 at redhat dot com> <56CDF48B dot 5040008 at 0x04 dot net> <56CDF792 dot 3040604 at redhat dot com>
Pedro Alves writes:
> On 02/24/2016 06:20 PM, Marcin KoÅcielnicki wrote:
>> On 24/02/16 19:11, Pedro Alves wrote:
>>> On 02/22/2016 04:51 PM, Antoine Tremblay wrote:
>>>>
>
>>>> While looking at fixing this for all the archs involved it would be
>>>> much simpler to test if gdbserver would make use of it.
>>>>
>>>> As it is now, I'm concerned that calling gdbarch_remote_register_number
>>>> in ax_reg, ax_mask_reg could break things if the arch already considers
>>>> the gdb raw -> target raw mapping like s390 and x86 do already (I'm not
>>>> 100% sure the mapping is already ok)?
>>>
>>> WDTM? Where do they do this already?
>>
>> FWIW, I failed to look at the numbering used when I wrote the x86 and
>> s390 ax functions, so they're most likely wrong (I just copied the
>> regnum computation logic from pseudo_read/write, which uses gdb
>> numbers). s390 hasn't landed yet, so it's only x86 that you'd have to
>> fix now (and mips, I think, but that doesn't support tracepoints yet...).
>
> I don't think there's anything that needs fixing in the i386 implementation.
>
> The x86 implementation maps gdb pseudo register numbers to whatever
> raw gdb registers back the former up, like:
>
> ax_reg_mask (ax, I387_FSTAT_REGNUM (tdep));
>
> That OK.
>
> The trouble is that in the end we send gdb numbers to the target in the
> ax, instead of tdesc/remote numbers.
>
> We never noticed because gdbserver always collects all raw registers
> anyway.
>
> Seems to me that the fix is to make ax_reg / ax_reg_mask take gdb raw
> numbers as input (as it does today), and then make it map those to
> tdesc/remote number just before it puts the reg number in the agent
> expression bytecode / reg mask. And that covers all archs.
>
>>
>> Testing this is possible if you write some conditions that involve
>> reading pseudo-registers (since ax_pseudo_register_push_stack will be
>> called), the problem is that I only implemented
>> ax_pseudo_register_collect for x86...
>>
>> Are you going to make some higher-level patch that will magically fix it
>> for my s390 patch, or do I have to fix that on my own?
>
> I haven't memorized your s390 patch :-) but there's probably nothing to
> do on the s390-specific bits.
>
The only requirement for this to work properly is that the arch uses
tdesc_use_registers, otherwise the default mapping function to tdesc is
identity to GDB numbers.
s390 uses that so it should be fine.
Thanks,
Antoine