Re: [PATCH 14/26] gdbserver: introduce and use regcache::set_register_status

Simon Marchi
2023-12-21T21:30:53Z

On 2/28/23 06:28, Tankut Baris Aktemur via Gdb-patches wrote:
> Introduce and use a setter method in regcache to set the status of a
> register. There already exists get_register_status. So, it made
> sense to add the setter to control access to the register_status
> field.

Does this method (and eventually the register_status field) need to be
public? Or is it only set internally, through some other methods?

> @@ -498,6 +495,16 @@ regcache::get_register_status (int regnum) const
> #endif
> }
>
> +void
> +regcache::set_register_status (int regnum, enum register_status status)
> +{
> +#ifndef IN_PROCESS_AGENT
> + gdb_assert (regnum >= 0 && regnum < tdesc->reg_defs.size ());
> + if (register_status != nullptr)
> + register_status[regnum] = status;
> +#endif

I don't understand why some spots (like here) check for register_status
being nullptr, but others (like get_register_status) don't.

Simon