This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
gdb 6.8 selected_byte_order function
- From: Richard Stuckey <richard dot stuckey at arc dot com>
- To: gdb at sourceware dot org
- Date: Wed, 24 Sep 2008 11:58:24 +0100
- Subject: gdb 6.8 selected_byte_order function
Hello,
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);
else
return BFD_ENDIAN_UNKNOWN;
}
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;
else
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
architecture.
I can see from the Changelogs, and various pages on the web (like
http://sourceware.org/ml/gdb-patches/2006-11/msg00052.html), 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!
Regards,
Richard Stuckey