gdb 6.8 selected_byte_order function

Richard Stuckey
Wed Sep 24 10:59:00 GMT 2008


I am currently moving the ARC port of gdb from 6.6 on to 6.8, and I am a
little puzzled by the selected_byte_order function in file arch-utils.c;
I wonder if anyone could perhaps enlighten me about it.

The 6.8 code (this function did not exist in 6.6) is

enum bfd_endian
selected_byte_order (void)
  if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
    return gdbarch_byte_order (current_gdbarch);

Given that that the variable ‘target_byte_order_user ‘ holds the user’s
preference as specified by the “set endian” command, it seems to me that
the code should be

  if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
    return target_byte_order_user;
    return gdbarch_byte_order (current_gdbarch);

i.e. if the user has explicitly specified the byte order then we use
that, otherwise we use the order determined from the current

I can see from the Changelogs, and various pages on the web (like, that this
function has a history of change – so apologies if I have missed out on
all the reasoning that has led to the current version of the code!


          Richard Stuckey 

More information about the Gdb mailing list