Re: [PATCH v2 4/4] arc: Add arc-*-linux regformats

Simon Marchi
2020-06-16T02:08:43Z

On 2020-06-15 7:37 p.m., Shahab Vahedi wrote:
> On Thu, May 14, 2020 at 11:12:55AM -0400, Simon Marchi wrote:
>> On 2020-04-28 12:04 p.m., Shahab Vahedi via Gdb-patches wrote:
>>> From: Anton Kolesov <Anton.Kolesov@synopsys.com>
>>>
>>> gdb/ChangeLog:
>>> 2020-04-28 Anton Kolesov <anton.kolesov@synopsys.com>
>>>
>>> * features/Makefile: Add new files and expedite registers.
>>> * regformats/arc-arcompact-Linux.dat: New file.
>>> * regformats/arc-v2-Linux.dat: Likewise.
>>
>> Can you explain why this is useful? I always forget, but I have the feeling
>> that regformats are something we are going away from, and that if you support
>> target descriptions, you don't need that... but I would need to refresh my
>> memory.
>
> To my understanding, the values of "expedite" registers are always transferred
> from the "server" to GDB client. With every step you take, or any stop you do,
> GDB client will know about the value of "expedite" registers. In case of ARC,
> those are the "program counter" and "stack pointer" registers.
> I _think_ the "dat" files are the mechanism holding information about that.
> After all it is generated from the XML and we also followed other targets
> in doing so.

It's true that these .dat files do that, but it's not the only way. They
don't offer any flexibility for architectures that have optional set of
registers, as it requires you to generate one format for each possible
combination of these options. So the trend has been to move away from that,
towards target descriptions assembled at runtime.

I would encourage you to look at how aarch64 handles it, as it's one of the
latest that was introduced. You'll notice that there is one xml file for
each "feature". They are then assembled at runtime based on the features
detected on the current hardware. The expedite registers are also taken
care of, it's all in gdbserver/linux-aarch64-tdesc.cc.

I'd prefer if we didn't add a new architecture that uses the old method.

Simon