### 10.1 Target Descriptions Implementation

Before gdb connects to a new target, or runs a new program on an existing target, it discards any existing target description and reverts to a default gdbarch. Then, after connecting, it looks for a new target description by calling `target_find_description`.

A description may come from a user specified file (XML), the remote ``qXfer:features:read`' packet (also XML), or from any custom `to_read_description` routine in the target vector. For instance, the remote target supports guessing whether a MIPS target is 32-bit or 64-bit based on the size of the ``g`' packet.

If any target description is found, gdb creates a new gdbarch incorporating the description by calling `gdbarch_update_p`. Any ``<architecture>`' element is handled first, to determine which architecture's gdbarch initialization routine is called to create the new architecture. Then the initialization routine is called, and has a chance to adjust the constructed architecture based on the contents of the target description. For instance, it can recognize any properties set by a `to_read_description` routine. Also see Adding Target Described Register Support.