gdb's model of the target machine is rather simple. gdb assumes the machine includes a bank of registers and a block of memory. Each register may have a different size.
gdb does not have a magical way to match up with the
compiler's idea of which registers are which; however, it is critical
that they do match up accurately. The only way to make this work is
to get accurate information about the order that the compiler uses,
and to reflect that in the
gdbarch_register_name and related functions.
gdb can handle big-endian, little-endian, and bi-endian architectures.