Re: [PATCH 10/26] gdbserver: convert registers_to_string into regcache::registers_to_string

Simon Marchi
2023-12-21T21:20:09Z

On 12/21/23 16:13, Simon Marchi wrote:
> On 2/28/23 06:28, Tankut Baris Aktemur via Gdb-patches wrote:
>> Convert the free `registers_to_string` function into a method of
>> the regcache struct.
>
> I'm not strongly opposed to this change, but I think that it works just
> as well as a free function. Not everything working on a regcache needs
> to be a method of regcache. If you imagine that all the members of
> regcache are private, and it offers an interface to access the register
> contents and statuses, then registers_to_string can very well be
> implemented using that public interface.

To clarify, I think that this functionality might belong more in the
remote-utils.cc's area of responsibility, since it's serializing the
regcache's content specifically for the remote protocol.

Simon