Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT
@ 2002-01-20 12:27 Andrew Cagney
  2002-01-20 12:33 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-01-20 12:27 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

Per discussion on TARGET_BYTE_ORDER_SELECTABLE.  This patch removes
TARGET_BYTE_ORDER_DEFAULT.

I suspect the patch also fixes a bug in the non-multi-arch code (Daniel
J's prodding made me revisit it).  Unlike the multi-arch case,
the non-multi-arch code wasn't updating target_byte_order with the
byte-order determined from BFD.

I'll leave this one for a few days.

Andrew

PS, the arm still comes up little endian:

ac131313@nettle$ ./gdb/gdb
GNU gdb 2002-01-20-cvs
(gdb) show endian
The target endianness is set automatically (currently little endian)
(gdb)

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 5806 bytes --]

2002-01-20  Andrew Cagney  <ac131313@redhat.com>

	* arch-utils.c (TARGET_BYTE_ORDER_DEFAULT): Delete macro.
	(target_byte_order): Initialize to BFD_ENDIAN_BIG.
	(initialize_current_architecture): Update target_byte_order using
	information from BFD.
	* config/powerpc/tm-ppcle-eabi.h (TARGET_BYTE_ORDER_DEFAULT):
	* config/mcore/tm-mcore.h (TARGET_BYTE_ORDER_DEFAULT): 
	* config/arm/tm-arm.h (TARGET_BYTE_ORDER_DEFAULT): Delete.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.47
diff -p -r1.47 arch-utils.c
*** arch-utils.c	2002/01/20 19:26:48	1.47
--- arch-utils.c	2002/01/20 20:05:43
*************** generic_register_virtual_size (int regnu
*** 399,411 ****
  \f
  /* Functions to manipulate the endianness of the target.  */
  
- #ifndef TARGET_BYTE_ORDER_DEFAULT
- #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_BIG /* arbitrary */
- #endif
  /* ``target_byte_order'' is only used when non- multi-arch.
!    Multi-arch targets obtain the current byte order using
!    TARGET_BYTE_ORDER which is controlled by gdbarch.*. */
! int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
  int target_byte_order_auto = 1;
  
  static const char endian_big[] = "big";
--- 399,412 ----
  \f
  /* Functions to manipulate the endianness of the target.  */
  
  /* ``target_byte_order'' is only used when non- multi-arch.
!    Multi-arch targets obtain the current byte order using the
!    TARGET_BYTE_ORDER gdbarch method.
! 
!    The choice of initial value is entirely arbitrary.  During startup,
!    the function initialize_current_architecture() updates this value
!    based on default byte-order information extracted from BFD.  */
! int target_byte_order = BFD_ENDIAN_BIG;
  int target_byte_order_auto = 1;
  
  static const char endian_big[] = "big";
*************** initialize_current_architecture (void)
*** 725,733 ****
  			"initialize_current_architecture: Arch not found");
      }
  
!   /* take several guesses at a byte order. */
!   /* NB: can't use TARGET_BYTE_ORDER_DEFAULT as its definition is
!      forced above. */
    if (info.byte_order == BFD_ENDIAN_UNKNOWN
        && default_bfd_vec != NULL)
      {
--- 726,732 ----
  			"initialize_current_architecture: Arch not found");
      }
  
!   /* Take several guesses at a byte order.  */
    if (info.byte_order == BFD_ENDIAN_UNKNOWN
        && default_bfd_vec != NULL)
      {
*************** initialize_current_architecture (void)
*** 769,775 ****
  	}
      }
    else
!     initialize_non_multiarch ();
  
    /* Create the ``set architecture'' command appending ``auto'' to the
       list of architectures. */
--- 768,780 ----
  	}
      }
    else
!     {
!       /* If the multi-arch logic comes up with a byte-order (from BFD)
!          use it for the non-multi-arch case.  */
!       if (info.byte_order != BFD_ENDIAN_UNKNOWN)
! 	target_byte_order = info.byte_order;
!       initialize_non_multiarch ();
!     }
  
    /* Create the ``set architecture'' command appending ``auto'' to the
       list of architectures. */
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.15
diff -p -r1.15 tm-arm.h
*** tm-arm.h	2002/01/20 19:26:48	1.15
--- tm-arm.h	2002/01/20 20:05:44
***************
*** 29,38 ****
  struct type;
  struct value;
  
- /* Target byte order on ARM defaults to selectable, and defaults to
-    little endian.  */
- #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_LITTLE
- 
  /* IEEE format floating point.  */
  #define TARGET_DOUBLE_FORMAT  (target_byte_order == BFD_ENDIAN_BIG \
  			       ? &floatformat_ieee_double_big	 \
--- 29,34 ----
Index: config/mcore/tm-mcore.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mcore/tm-mcore.h,v
retrieving revision 1.8
diff -p -r1.8 tm-mcore.h
*** tm-mcore.h	2002/01/20 19:26:49	1.8
--- tm-mcore.h	2002/01/20 20:05:44
***************
*** 20,28 ****
  
  #include "regcache.h"
  
- /* The mcore is little endian (by default) */
- #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_LITTLE
- 
  /* All registers are 32 bits */
  #define REGISTER_SIZE 4
  #define MAX_REGISTER_RAW_SIZE 4
--- 20,25 ----
Index: doc/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
retrieving revision 1.142
diff -p -r1.142 ChangeLog
*** ChangeLog	2002/01/20 19:26:50	1.142
--- ChangeLog	2002/01/20 20:05:51
***************
*** 1,6 ****
--- 1,11 ----
  2002-01-20  Andrew Cagney  <ac131313@redhat.com>
  
  	* gdbint.texinfo (Target Architecture Definition): Delete
+ 	description of TARGET_BYTE_ORDER_DEFAULT.
+ 
+ 2002-01-20  Andrew Cagney  <ac131313@redhat.com>
+ 
+ 	* gdbint.texinfo (Target Architecture Definition): Delete
  	description of TARGET_BYTE_ORDER_SELECTABLE_P.
  
  2002-01-20  Andrew Cagney  <ac131313@redhat.com>
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.60
diff -p -r1.60 gdbint.texinfo
*** gdbint.texinfo	2002/01/20 19:26:50	1.60
--- gdbint.texinfo	2002/01/20 20:06:08
*************** where @var{valbuf} is the address of the
*** 3474,3485 ****
  The default value of the ``symbol-reloading'' variable.  (Never defined in
  current sources.)
  
- @item TARGET_BYTE_ORDER_DEFAULT
- @findex TARGET_BYTE_ORDER_DEFAULT
- The ordering of bytes in the target.  This must be either
- @code{BFD_ENDIAN_BIG} or @code{BFD_ENDIAN_LITTLE}.  This macro replaces
- @code{TARGET_BYTE_ORDER} which is deprecated.
- 
  @item TARGET_CHAR_BIT
  @findex TARGET_CHAR_BIT
  Number of bits in a char; defaults to 8.
--- 3474,3479 ----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT
  2002-01-20 12:27 [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT Andrew Cagney
@ 2002-01-20 12:33 ` Daniel Jacobowitz
  2002-01-20 12:48   ` Andrew Cagney
  2002-01-21  2:19 ` Eli Zaretskii
  2002-01-28 19:35 ` Andrew Cagney
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-01-20 12:33 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

On Sun, Jan 20, 2002 at 03:27:03PM -0500, Andrew Cagney wrote:
> Per discussion on TARGET_BYTE_ORDER_SELECTABLE.  This patch removes
> TARGET_BYTE_ORDER_DEFAULT.
> 
> I suspect the patch also fixes a bug in the non-multi-arch code (Daniel
> J's prodding made me revisit it).  Unlike the multi-arch case,
> the non-multi-arch code wasn't updating target_byte_order with the
> byte-order determined from BFD.
> 
> I'll leave this one for a few days.
> 
> Andrew
> 
> PS, the arm still comes up little endian:
> 
> ac131313@nettle$ ./gdb/gdb
> GNU gdb 2002-01-20-cvs
> (gdb) show endian
> The target endianness is set automatically (currently little endian)
> (gdb)

Could you see what happens if you build an armv5b-elf toolchain?  Does
it default to big endian correctly?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT
  2002-01-20 12:33 ` Daniel Jacobowitz
@ 2002-01-20 12:48   ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-01-20 12:48 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> ac131313@nettle$ ./gdb/gdb
>> GNU gdb 2002-01-20-cvs
>> (gdb) show endian
>> The target endianness is set automatically (currently little endian)
>> (gdb)
> 
> 
> Could you see what happens if you build an armv5b-elf toolchain?  Does
> it default to big endian correctly?


BTW, what is an armv5b-elf?  As far as I can tell, GDB treats arm*-elf 
as straight ARM.  Anyway, I suspect it will come up little endian.  It 
would have been doing that before the change.

Andrew

PS:
*** BFD does not support target armv5b-unknown-elf.
*** Look in bfd/config.bfd for supported targets.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT
  2002-01-20 12:27 [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT Andrew Cagney
  2002-01-20 12:33 ` Daniel Jacobowitz
@ 2002-01-21  2:19 ` Eli Zaretskii
  2002-01-28 19:35 ` Andrew Cagney
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2002-01-21  2:19 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

> Date: Sun, 20 Jan 2002 15:27:03 -0500
> From: Andrew Cagney <ac131313@cygnus.com>
> 
> Per discussion on TARGET_BYTE_ORDER_SELECTABLE.  This patch removes
> TARGET_BYTE_ORDER_DEFAULT.

The gdbint.texinfo patch is approved.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT
  2002-01-20 12:27 [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT Andrew Cagney
  2002-01-20 12:33 ` Daniel Jacobowitz
  2002-01-21  2:19 ` Eli Zaretskii
@ 2002-01-28 19:35 ` Andrew Cagney
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-01-28 19:35 UTC (permalink / raw)
  To: gdb-patches

I've checked in the below.  ARM developers should keep an eye out for this.


At Daniel J's prompting I did do an armeb-elf build and found that it did at least appear to come up with the correct byte order.


enjoy,
Andrew



> Per discussion on TARGET_BYTE_ORDER_SELECTABLE.  This patch removes
> TARGET_BYTE_ORDER_DEFAULT.
> 
> I suspect the patch also fixes a bug in the non-multi-arch code (Daniel
> J's prodding made me revisit it).  Unlike the multi-arch case,
> the non-multi-arch code wasn't updating target_byte_order with the
> byte-order determined from BFD.
> 
> I'll leave this one for a few days.
> 
> Andrew
> 
> PS, the arm still comes up little endian:
> 
> ac131313@nettle$ ./gdb/gdb
> GNU gdb 2002-01-20-cvs
> (gdb) show endian
> The target endianness is set automatically (currently little endian)
> (gdb)
> 
> 

> 2002-01-20  Andrew Cagney  <ac131313@redhat.com>
> 
> * arch-utils.c (TARGET_BYTE_ORDER_DEFAULT): Delete macro.
> 	(target_byte_order): Initialize to BFD_ENDIAN_BIG.
> 	(initialize_current_architecture): Update target_byte_order using
> 	information from BFD.
> 	* config/powerpc/tm-ppcle-eabi.h (TARGET_BYTE_ORDER_DEFAULT):
> 	* config/mcore/tm-mcore.h (TARGET_BYTE_ORDER_DEFAULT): 
> 	* config/arm/tm-arm.h (TARGET_BYTE_ORDER_DEFAULT): Delete.
> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-01-29  3:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-20 12:27 [patch/rfc] Eliminate TARGET_BYTE_ORDER_DEFAULT Andrew Cagney
2002-01-20 12:33 ` Daniel Jacobowitz
2002-01-20 12:48   ` Andrew Cagney
2002-01-21  2:19 ` Eli Zaretskii
2002-01-28 19:35 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox