Re: [PATCH v3 4/8] gdbserver/linux-aarch64: When thread stops, update its target description

Simon Marchi via Gdb-patches
2023-02-09T02:47:21Z

> That is, assuming we continue with the thread-specific tdesc approach
> rather than the one which expands tdescs to allow describing one
> register's type in terms of another one. I'll revisit my notes and think
> more about this.

Can we expand about this idea? I think I like it, but I don't see 100%
how it would work. I can imagine a vector of registers whose size
depends directly on the value of some other register that comes before,
like:

<vector id="vec" type="some_type" count="some_other_register"/>

Here, "some_other_register" would be a scalar register that comes before
"vec", and whose value dictates directly the number of elements of
"vec". But if you wanted to say that the number of elements in "vec" is
the value of some_other_register, times 2? I guess we could write:

<vector id="vec" type="some_type" count="some_other_register * 2"/>

.. but then we get in the realm of defining a grammar, building a
parser / evaluator, etc.

The type of the vector elements needs to be dynamic too, how do
we define that?

If the number of possibilities is known and static, we could have some
kind of "variant" type, where we list all the possible types, and select
among them at runtime based on the value of a preceding register.

If I understand correctly, all of this makes it so the size of the
response to the g packet will be dynamic too?

Simon