Flexible GDB Target Description
This project makes GDB target descriptions more flexible so that GDB and GDBserver can composite different target descriptions from different target features.
Background
Nowadays, GDB target description isn't flexible (as-of mid 2017),
- All builtin target descriptions are pre-defined. Since all GDB target descriptions are pre-defined, it is not flexible to compose features for different target descriptions. Suppose, some architecture has three hardware features (like avx or mpx in x86), A, B, and C. B and C can be optional. Due to the current GDB target description limitation, we need to define four target descriptions A, A-B, A-C, A-B-C. If we need to add a new optional feature D, we need to double target descriptions.
- Target feature is not parameterized. Registers in the same target feature may have different register sizes in different target descriptions. For example, the register size in "org.gnu.gdb.power.core" and "org.gnu.gdb.mips.cpu" varies between 32-bit variant and 64-bit variant. As a result, there are two xml files for the same feature respectively.
The reason that target description isn't flexible is because target descriptions (in xml files) are statically composed by target features (in xml files). The fix to this problem is that we can dynamically compose target features (in c) for different target descriptions.
Progress and Plan
GDB support both flexible and inflexible target descriptions. Change x86 GDB to use flexible target descriptions Done! See patch v1 and patch v2.
Convert other ports to using flexible target descriptions. tic6x and aarch64 are done. The other ports should be converted too. After we convert most ports' target descriptions, the new port in GDB should use the flexible target descriptions.
Teach GDBserver to create XML target descriptions and target features. Nowadays, GDBserver copies target features into itself during build time, so it can't send flexible target descriptions. See Alan's patches.