gdb 6.8 selected_byte_order function

Richard Stuckey richard.stuckey@arc.com
Wed Sep 24 13:37:00 GMT 2008


Ah, I see.  So this function is actually returning the byte order, if
any, selected by the user (hence its name!).

I think that the question I should have asked is why, in function
gdbsim_open in file remote-sim.c, the switch statement has been changed
to call selected_byte_order instead of using TARGET_BYTE_ORDER (which is
#defined to be gdbarch_byte_order (current_gdbarch)) as it did in the
6.6 code?

I suppose this change was because in the 6.6 code there was the comment

  /* Specify the byte order for the target when it is both selectable
     and explicitly specified by the user (not auto detected). */

and the code was not actually doing this: calling gdbarch_byte_order was
using auto-detection in the case that the user had not specified the
byte order.

This change caused a difference in the behaviour of the ARC debugger
when using the built-in simulator: the 6.6. version used a default of
little-endian, whereas in the 6.8 version it is now necessary to issue a
"set endian little" command before the "target sim" command, otherwise a
"Target byte order unspecified" error is given.  Alternatively, using
the "file <program>" command before the "target sim" command, instead of
after it, has the desired effect.

 Thanks for clearing this up for me.

     Richard Stuckey, ARC



More information about the Gdb mailing list