0

Generally, we can change the endianness when debuging, but is there someone knows what does gdb do when we running a command as (gdb) set endian big or (gdb) set endian small

I have the gdb sources in hand, but haven't found where to refer yet.

hukeping
  • 665
  • 7
  • 12
  • Note that this setting seems to be partly broken, at least in recent GDB. It corrupts register values. See an example on [Flipping endianness in gdb?](https://stackoverflow.com/q/63552401) – Peter Cordes Aug 23 '20 at 22:16

1 Answers1

1

See gdb/arch-utils.c:set_endian. It tries to select a new gdbarch that matches the specified endianness, via gdbarch_update_p.

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63