* [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
@ 2002-01-18 21:59 Andrew Cagney
2002-01-19 6:47 ` Daniel Jacobowitz
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Andrew Cagney @ 2002-01-18 21:59 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
Hello,
All multi-arch targets (yep, including the i386) allow the byte order to
be selected at run time. This means that the macro
TARGET_BYTE_ORDER_SELECTABLE which was used by non-multi-arch targets is
obsolete.
The attached patch eliminates that macro. I've tested it on a
multi-arch target and I don't think it breaks non-multi-arch targets.
Anyway, I intend committing this in a few days.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 18067 bytes --]
2002-01-19 Andrew Cagney <ac131313@redhat.com>
* remote-sim.c (gdbsim_open): Simplify code testing the macro
TARGET_BYTE_ORDER_SELECTABLE_P. Assume the target is always
byte-order selectable.
* sparc-tdep.c (sparc_target_architecture_hook): Ditto.
* arch-utils.c: Ditto.
(set_endian): Ditto.
(set_endian_from_file): Ditto.
* gdbserver/low-sim.c (create_inferior): Ditto.
* gdbarch.sh: Ditto.
* gdbarch.h: Re-generate.
* config/powerpc/tm-ppc-eabi.h (TARGET_BYTE_ORDER_SELECTABLE_P):
* config/sparc/tm-sparclite.h (TARGET_BYTE_ORDER_SELECTABLE):
* config/sparc/tm-sparclet.h (TARGET_BYTE_ORDER_SELECTABLE):
* config/mcore/tm-mcore.h (TARGET_BYTE_ORDER_SELECTABLE_P):
* config/arm/tm-wince.h (TARGET_BYTE_ORDER_SELECTABLE_P):
* config/arm/tm-linux.h (TARGET_BYTE_ORDER_SELECTABLE_P):
* config/arc/tm-arc.h (TARGET_BYTE_ORDER_SELECTABLE):
* config/arm/tm-arm.h (TARGET_BYTE_ORDER_SELECTABLE_P): Delete
macro definition.
* config/mips/tm-wince.h: Remove #undef of macro
TARGET_BYTE_ORDER_SELECTABLE.
* config/sh/tm-wince.h: Ditto.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.46
diff -p -r1.46 arch-utils.c
*** arch-utils.c 2002/01/05 04:30:14 1.46
--- arch-utils.c 2002/01/19 05:51:15
*************** generic_register_virtual_size (int regnu
*** 399,422 ****
\f
/* Functions to manipulate the endianness of the target. */
- #ifdef TARGET_BYTE_ORDER_SELECTABLE
- /* compat - Catch old targets that expect a selectable byte-order to
- default to BFD_ENDIAN_BIG */
#ifndef TARGET_BYTE_ORDER_DEFAULT
- #define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_BIG
- #endif
- #endif
- #if !TARGET_BYTE_ORDER_SELECTABLE_P
- #ifndef TARGET_BYTE_ORDER_DEFAULT
- /* compat - Catch old non byte-order selectable targets that do not
- define TARGET_BYTE_ORDER_DEFAULT and instead expect
- TARGET_BYTE_ORDER to be used as the default. For targets that
- defined neither TARGET_BYTE_ORDER nor TARGET_BYTE_ORDER_DEFAULT the
- below will get a strange compiler warning. */
- #define TARGET_BYTE_ORDER_DEFAULT TARGET_BYTE_ORDER
- #endif
- #endif
- #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.
--- 399,405 ----
*************** show_endian (char *args, int from_tty)
*** 453,463 ****
static void
set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
{
! if (!TARGET_BYTE_ORDER_SELECTABLE_P)
! {
! printf_unfiltered ("Byte order is not selectable.");
! }
! else if (set_endian_string == endian_auto)
{
target_byte_order_auto = 1;
}
--- 436,442 ----
static void
set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
{
! if (set_endian_string == endian_auto)
{
target_byte_order_auto = 1;
}
*************** set_endian (char *ignore_args, int from_
*** 508,540 ****
static void
set_endian_from_file (bfd *abfd)
{
if (GDB_MULTI_ARCH)
internal_error (__FILE__, __LINE__,
"set_endian_from_file: not for multi-arch");
! if (TARGET_BYTE_ORDER_SELECTABLE_P)
! {
! int want;
!
! if (bfd_big_endian (abfd))
! want = BFD_ENDIAN_BIG;
! else
! want = BFD_ENDIAN_LITTLE;
! if (TARGET_BYTE_ORDER_AUTO)
! target_byte_order = want;
! else if (TARGET_BYTE_ORDER != want)
! warning ("%s endian file does not match %s endian target.",
! want == BFD_ENDIAN_BIG ? "big" : "little",
! TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little");
! }
else
! {
! if (bfd_big_endian (abfd)
! ? TARGET_BYTE_ORDER != BFD_ENDIAN_BIG
! : TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
! warning ("%s endian file does not match %s endian target.",
! bfd_big_endian (abfd) ? "big" : "little",
! TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little");
! }
}
--- 487,506 ----
static void
set_endian_from_file (bfd *abfd)
{
+ int want;
if (GDB_MULTI_ARCH)
internal_error (__FILE__, __LINE__,
"set_endian_from_file: not for multi-arch");
! if (bfd_big_endian (abfd))
! want = BFD_ENDIAN_BIG;
else
! want = BFD_ENDIAN_LITTLE;
! if (TARGET_BYTE_ORDER_AUTO)
! target_byte_order = want;
! else if (TARGET_BYTE_ORDER != want)
! warning ("%s endian file does not match %s endian target.",
! want == BFD_ENDIAN_BIG ? "big" : "little",
! TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "big" : "little");
}
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.73
diff -p -r1.73 gdbarch.h
*** gdbarch.h 2001/12/29 19:25:58 1.73
--- gdbarch.h 2002/01/19 05:51:22
*************** extern void register_gdbarch_swap (void
*** 2408,2440 ****
/* The target-system-dependent byte order is dynamic */
- /* TARGET_BYTE_ORDER_SELECTABLE_P determines if the target endianness
- is selectable at runtime. The user can use the ``set endian''
- command to change it. TARGET_BYTE_ORDER_AUTO is nonzero when
- target_byte_order should be auto-detected (from the program image
- say). */
-
- #if GDB_MULTI_ARCH
- /* Multi-arch GDB is always bi-endian. */
- #define TARGET_BYTE_ORDER_SELECTABLE_P 1
- #endif
-
- #ifndef TARGET_BYTE_ORDER_SELECTABLE_P
- /* compat - Catch old targets that define TARGET_BYTE_ORDER_SLECTABLE
- when they should have defined TARGET_BYTE_ORDER_SELECTABLE_P 1 */
- #ifdef TARGET_BYTE_ORDER_SELECTABLE
- #define TARGET_BYTE_ORDER_SELECTABLE_P 1
- #else
- #define TARGET_BYTE_ORDER_SELECTABLE_P 0
- #endif
- #endif
-
extern int target_byte_order;
- #ifdef TARGET_BYTE_ORDER_SELECTABLE
- /* compat - Catch old targets that define TARGET_BYTE_ORDER_SELECTABLE
- and expect defs.h to re-define TARGET_BYTE_ORDER. */
- #undef TARGET_BYTE_ORDER
- #endif
#ifndef TARGET_BYTE_ORDER
#define TARGET_BYTE_ORDER (target_byte_order + 0)
#endif
--- 2408,2414 ----
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.103
diff -p -r1.103 gdbarch.sh
*** gdbarch.sh 2002/01/05 04:30:17 1.103
--- gdbarch.sh 2002/01/19 05:51:24
*************** extern void register_gdbarch_swap (void
*** 1058,1090 ****
/* The target-system-dependent byte order is dynamic */
- /* TARGET_BYTE_ORDER_SELECTABLE_P determines if the target endianness
- is selectable at runtime. The user can use the \`\`set endian''
- command to change it. TARGET_BYTE_ORDER_AUTO is nonzero when
- target_byte_order should be auto-detected (from the program image
- say). */
-
- #if GDB_MULTI_ARCH
- /* Multi-arch GDB is always bi-endian. */
- #define TARGET_BYTE_ORDER_SELECTABLE_P 1
- #endif
-
- #ifndef TARGET_BYTE_ORDER_SELECTABLE_P
- /* compat - Catch old targets that define TARGET_BYTE_ORDER_SLECTABLE
- when they should have defined TARGET_BYTE_ORDER_SELECTABLE_P 1 */
- #ifdef TARGET_BYTE_ORDER_SELECTABLE
- #define TARGET_BYTE_ORDER_SELECTABLE_P 1
- #else
- #define TARGET_BYTE_ORDER_SELECTABLE_P 0
- #endif
- #endif
-
extern int target_byte_order;
- #ifdef TARGET_BYTE_ORDER_SELECTABLE
- /* compat - Catch old targets that define TARGET_BYTE_ORDER_SELECTABLE
- and expect defs.h to re-define TARGET_BYTE_ORDER. */
- #undef TARGET_BYTE_ORDER
- #endif
#ifndef TARGET_BYTE_ORDER
#define TARGET_BYTE_ORDER (target_byte_order + 0)
#endif
--- 1058,1064 ----
Index: remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.19
diff -p -r1.19 remote-sim.c
*** remote-sim.c 2002/01/05 04:30:18 1.19
--- remote-sim.c 2002/01/19 05:51:27
*************** gdbsim_open (char *args, int from_tty)
*** 472,479 ****
strcpy (arg_buf, "gdbsim"); /* 7 */
/* Specify the byte order for the target when it is both selectable
and explicitly specified by the user (not auto detected). */
! if (TARGET_BYTE_ORDER_SELECTABLE_P
! && !TARGET_BYTE_ORDER_AUTO)
{
switch (TARGET_BYTE_ORDER)
{
--- 472,478 ----
strcpy (arg_buf, "gdbsim"); /* 7 */
/* Specify the byte order for the target when it is both selectable
and explicitly specified by the user (not auto detected). */
! if (!TARGET_BYTE_ORDER_AUTO)
{
switch (TARGET_BYTE_ORDER)
{
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.20
diff -p -r1.20 sparc-tdep.c
*** sparc-tdep.c 2001/12/30 17:00:43 1.20
--- sparc-tdep.c 2002/01/19 05:51:33
*************** sparc_target_architecture_hook (const bf
*** 2200,2214 ****
if (ap->mach == bfd_mach_sparc_sparclite_le)
{
! if (TARGET_BYTE_ORDER_SELECTABLE_P)
! {
! target_byte_order = BFD_ENDIAN_LITTLE;
! bi_endian = 1;
! }
! else
! {
! warning ("This GDB does not support little endian sparclite.");
! }
}
else
bi_endian = 0;
--- 2200,2207 ----
if (ap->mach == bfd_mach_sparc_sparclite_le)
{
! target_byte_order = BFD_ENDIAN_LITTLE;
! bi_endian = 1;
}
else
bi_endian = 0;
Index: config/arc/tm-arc.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arc/tm-arc.h,v
retrieving revision 1.7
diff -p -r1.7 tm-arc.h
*** tm-arc.h 2001/03/21 18:31:48 1.7
--- tm-arc.h 2002/01/19 05:51:36
***************
*** 24,32 ****
/* Used by arc-tdep.c to set the default cpu type. */
#define DEFAULT_ARC_CPU_TYPE "base"
- /* Byte order is selectable. */
- #define TARGET_BYTE_ORDER_SELECTABLE
-
/* We have IEEE floating point, if we have any float at all. */
#define IEEE_FLOAT (1)
--- 24,29 ----
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.13
diff -p -r1.13 tm-arm.h
*** tm-arm.h 2002/01/09 18:39:37 1.13
--- tm-arm.h 2002/01/19 05:51:37
*************** struct value;
*** 31,37 ****
/* Target byte order on ARM defaults to selectable, and defaults to
little endian. */
- #define TARGET_BYTE_ORDER_SELECTABLE_P 1
#define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_LITTLE
/* IEEE format floating point. */
--- 31,36 ----
Index: config/arm/tm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-linux.h,v
retrieving revision 1.8
diff -p -r1.8 tm-linux.h
*** tm-linux.h 2001/12/05 15:11:48 1.8
--- tm-linux.h 2002/01/19 05:51:37
***************
*** 34,43 ****
extern struct link_map_offsets *arm_linux_svr4_fetch_link_map_offsets (void);
#define SVR4_FETCH_LINK_MAP_OFFSETS() arm_linux_svr4_fetch_link_map_offsets ()
- /* Target byte order on ARM Linux is little endian and not selectable. */
- #undef TARGET_BYTE_ORDER_SELECTABLE_P
- #define TARGET_BYTE_ORDER_SELECTABLE_P 0
-
/* Under ARM Linux the traditional way of performing a breakpoint is to
execute a particular software interrupt, rather than use a particular
undefined instruction to provoke a trap. Upon exection of the software
--- 34,39 ----
Index: config/arm/tm-wince.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-wince.h,v
retrieving revision 1.3
diff -p -r1.3 tm-wince.h
*** tm-wince.h 2001/03/20 18:16:16 1.3
--- tm-wince.h 2002/01/19 05:51:37
***************
*** 31,38 ****
void wince_software_single_step (unsigned int, int);
- /* Target byte order is little endian and not selectable on WinCE. */
- #undef TARGET_BYTE_ORDER_SELECTABLE_P
- #define TARGET_BYTE_ORDER_SELECTABLE_P 0
-
#endif /* TM_WINCE_H */
--- 31,34 ----
Index: config/mcore/tm-mcore.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mcore/tm-mcore.h,v
retrieving revision 1.7
diff -p -r1.7 tm-mcore.h
*** tm-mcore.h 2001/12/15 16:53:23 1.7
--- tm-mcore.h 2002/01/19 05:51:37
*************** extern void mcore_virtual_frame_pointer
*** 155,163 ****
#define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \
mcore_virtual_frame_pointer ((PC), (REGP), (OFFP))
- /* MCore can be bi-endian. */
- #define TARGET_BYTE_ORDER_SELECTABLE_P 1
-
/* For PE, gcc will tell us what th real type of
arguments are when it promotes arguments. */
#define BELIEVE_PCC_PROMOTION 1
--- 155,160 ----
Index: config/mips/tm-wince.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-wince.h,v
retrieving revision 1.4
diff -p -r1.4 tm-wince.h
*** tm-wince.h 2001/12/15 16:53:23 1.4
--- tm-wince.h 2002/01/19 05:51:37
***************
*** 29,35 ****
#define SOFTWARE_SINGLE_STEP(sig, bp_p) wince_software_single_step (sig, bp_p)
void wince_software_single_step (unsigned int, int);
- #undef TARGET_BYTE_ORDER_SELECTABLE
#define TARGET_BYTE_ORDER BFD_ENDIAN_LITTLE
#endif /* TM_WINCE_H */
--- 29,34 ----
Index: config/powerpc/tm-ppc-eabi.h
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/tm-ppc-eabi.h,v
retrieving revision 1.7
diff -p -r1.7 tm-ppc-eabi.h
*** tm-ppc-eabi.h 2001/12/03 21:17:49 1.7
--- tm-ppc-eabi.h 2002/01/19 05:51:37
***************
*** 39,46 ****
/* Say that we're using ELF, not XCOFF. */
#define ELF_OBJECT_FORMAT 1
- #define TARGET_BYTE_ORDER_SELECTABLE_P 1
-
/* The value of symbols of type N_SO and N_FUN maybe null when
it shouldn't be. */
#define SOFUN_ADDRESS_MAYBE_MISSING
--- 39,44 ----
Index: config/sh/tm-wince.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sh/tm-wince.h,v
retrieving revision 1.5
diff -p -r1.5 tm-wince.h
*** tm-wince.h 2001/12/15 16:53:24 1.5
--- tm-wince.h 2002/01/19 05:51:37
***************
*** 28,34 ****
#undef SOFTWARE_SINGLE_STEP
#define SOFTWARE_SINGLE_STEP(sig, bp_p) wince_software_single_step (sig, bp_p)
void wince_software_single_step (unsigned int, int);
- #undef TARGET_BYTE_ORDER_SELECTABLE
#define TARGET_BYTE_ORDER BFD_ENDIAN_LITTLE
#endif /* TM_WINCE_H */
--- 28,33 ----
Index: config/sparc/tm-sparclet.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/tm-sparclet.h,v
retrieving revision 1.5
diff -p -r1.5 tm-sparclet.h
*** tm-sparclet.h 2001/03/14 23:23:14 1.5
--- tm-sparclet.h 2002/01/19 05:51:37
*************** enum {
*** 49,55 ****
/* overrides of tm-sparc.h */
#undef TARGET_BYTE_ORDER
- #define TARGET_BYTE_ORDER_SELECTABLE
/* Sequence of bytes for breakpoint instruction (ta 1). */
#undef BREAKPOINT
--- 49,54 ----
Index: config/sparc/tm-sparclite.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/tm-sparclite.h,v
retrieving revision 1.4
diff -p -r1.4 tm-sparclite.h
*** tm-sparclite.h 2001/03/14 23:23:14 1.4
--- tm-sparclite.h 2002/01/19 05:51:39
*************** enum {
*** 45,51 ****
/* overrides of tm-sparc.h */
#undef TARGET_BYTE_ORDER
- #define TARGET_BYTE_ORDER_SELECTABLE
/* Select the sparclite disassembler. Slightly different instruction set from
the V8 sparc. */
--- 45,50 ----
Index: doc/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
retrieving revision 1.136
diff -p -r1.136 ChangeLog
*** ChangeLog 2002/01/18 04:51:09 1.136
--- ChangeLog 2002/01/19 05:51:45
***************
*** 1,3 ****
--- 1,8 ----
+ 2002-01-19 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Delete
+ description of TARGET_BYTE_ORDER_SELECTABLE_P.
+
2002-01-17 Andrew Cagney <ac131313@redhat.com>
* gdbint.texinfo (Host Definition): Remove references to XDEPFILES
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.56
diff -p -r1.56 gdbint.texinfo
*** gdbint.texinfo 2002/01/18 04:51:10 1.56
--- gdbint.texinfo 2002/01/19 05:51:53
*************** The ordering of bytes in the target. Th
*** 3482,3493 ****
@code{BFD_ENDIAN_BIG} or @code{BFD_ENDIAN_LITTLE}. This macro replaces
@code{TARGET_BYTE_ORDER} which is deprecated.
- @item TARGET_BYTE_ORDER_SELECTABLE_P
- @findex TARGET_BYTE_ORDER_SELECTABLE_P
- Non-zero if the target has both @code{BIG_ENDIAN} and
- @code{BFD_ENDIAN_LITTLE} variants. This macro replaces
- @code{TARGET_BYTE_ORDER_SELECTABLE} which is deprecated.
-
@item TARGET_CHAR_BIT
@findex TARGET_CHAR_BIT
Number of bits in a char; defaults to 8.
--- 3482,3487 ----
Index: gdbserver/low-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/low-sim.c,v
retrieving revision 1.6
diff -p -r1.6 low-sim.c
*** low-sim.c 2002/01/17 21:13:49 1.6
--- low-sim.c 2002/01/19 05:51:53
*************** create_inferior (char *program, char **a
*** 88,97 ****
{
bfd *abfd;
int pid = 0;
- #ifdef TARGET_BYTE_ORDER_SELECTABLE
char **new_argv;
int nargs;
- #endif
abfd = bfd_openr (program, 0);
if (!abfd)
--- 88,95 ----
*************** create_inferior (char *program, char **a
*** 108,114 ****
exit (1);
}
- #ifdef TARGET_BYTE_ORDER_SELECTABLE
/* Add "-E big" or "-E little" to the argument list depending on the
endianness of the program to be loaded. */
for (nargs = 0; argv[nargs] != NULL; nargs++) /* count the args */
--- 106,111 ----
*************** create_inferior (char *program, char **a
*** 120,126 ****
new_argv[nargs + 1] = bfd_big_endian (abfd) ? "big" : "little";
new_argv[nargs + 2] = NULL;
argv = new_argv;
- #endif
/* Create an instance of the simulator. */
default_callback.init (&default_callback);
--- 117,122 ----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-18 21:59 [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE Andrew Cagney
@ 2002-01-19 6:47 ` Daniel Jacobowitz
2002-01-19 8:06 ` Michael Snyder
2002-01-19 8:57 ` Andrew Cagney
2002-01-20 0:30 ` Eli Zaretskii
2002-01-20 11:32 ` Andrew Cagney
2 siblings, 2 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2002-01-19 6:47 UTC (permalink / raw)
To: gdb-patches
On Sat, Jan 19, 2002 at 12:58:36AM -0500, Andrew Cagney wrote:
> Hello,
>
> All multi-arch targets (yep, including the i386) allow the byte order to
> be selected at run time. This means that the macro
> TARGET_BYTE_ORDER_SELECTABLE which was used by non-multi-arch targets is
> obsolete.
>
> The attached patch eliminates that macro. I've tested it on a
> multi-arch target and I don't think it breaks non-multi-arch targets.
>
> Anyway, I intend committing this in a few days.
> Andrew
Hmm, I don't know. Do we really want to do this? This allows, for
instance, 'set endian big' on i386. That may someday make someone
think that GDB supports such a beast, on the off chance one is ever
made.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-19 6:47 ` Daniel Jacobowitz
@ 2002-01-19 8:06 ` Michael Snyder
2002-01-19 8:57 ` Andrew Cagney
1 sibling, 0 replies; 12+ messages in thread
From: Michael Snyder @ 2002-01-19 8:06 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
Daniel Jacobowitz wrote:
>
> On Sat, Jan 19, 2002 at 12:58:36AM -0500, Andrew Cagney wrote:
> > Hello,
> >
> > All multi-arch targets (yep, including the i386) allow the byte order to
> > be selected at run time. This means that the macro
> > TARGET_BYTE_ORDER_SELECTABLE which was used by non-multi-arch targets is
> > obsolete.
> >
> > The attached patch eliminates that macro. I've tested it on a
> > multi-arch target and I don't think it breaks non-multi-arch targets.
> >
> > Anyway, I intend committing this in a few days.
> > Andrew
>
> Hmm, I don't know. Do we really want to do this? This allows, for
> instance, 'set endian big' on i386. That may someday make someone
> think that GDB supports such a beast, on the off chance one is ever
> made.
There's a fairly good chance that gdb WOULD support such a
beast (on the off chance that one is ever made). If we've
done our jobs and used "extract_unsigned_integer" etc.
instead of reading things directly from memory...
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-19 6:47 ` Daniel Jacobowitz
2002-01-19 8:06 ` Michael Snyder
@ 2002-01-19 8:57 ` Andrew Cagney
2002-01-19 9:00 ` Daniel Jacobowitz
1 sibling, 1 reply; 12+ messages in thread
From: Andrew Cagney @ 2002-01-19 8:57 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
> On Sat, Jan 19, 2002 at 12:58:36AM -0500, Andrew Cagney wrote:
>
>> Hello,
>>
>> All multi-arch targets (yep, including the i386) allow the byte order to
>> be selected at run time. This means that the macro
>> TARGET_BYTE_ORDER_SELECTABLE which was used by non-multi-arch targets is
>> obsolete.
>>
>> The attached patch eliminates that macro. I've tested it on a
>> multi-arch target and I don't think it breaks non-multi-arch targets.
>>
>> Anyway, I intend committing this in a few days.
>> Andrew
>
>
> Hmm, I don't know. Do we really want to do this? This allows, for
> instance, 'set endian big' on i386. That may someday make someone
> think that GDB supports such a beast, on the off chance one is ever
> made.
Ah, but we live in dangerous times :-)
TARGET_BYTE_ORDER_SELECTABLE, TARGET_BYTE_ORDER_SELECTABLE_P and even
TARGET_BYTE_ORDER_DEFAULT are all there just to prop up old pre-
multi-arch targets. They are not used by a multi-arch GDB.
All multi-arch architectures allow both big and little byte orders
(regardless of what the spec says). This lets the user do things like:
(gdb) print network_structure
(gdb) set endian big
(gdb) print network_structure
enjoy,
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-19 8:57 ` Andrew Cagney
@ 2002-01-19 9:00 ` Daniel Jacobowitz
2002-01-20 10:33 ` Andrew Cagney
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2002-01-19 9:00 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Sat, Jan 19, 2002 at 11:57:10AM -0500, Andrew Cagney wrote:
>
>
> Ah, but we live in dangerous times :-)
>
> TARGET_BYTE_ORDER_SELECTABLE, TARGET_BYTE_ORDER_SELECTABLE_P and even
> TARGET_BYTE_ORDER_DEFAULT are all there just to prop up old pre-
> multi-arch targets. They are not used by a multi-arch GDB.
>
> All multi-arch architectures allow both big and little byte orders
> (regardless of what the spec says). This lets the user do things like:
>
> (gdb) print network_structure
> (gdb) set endian big
> (gdb) print network_structure
Woah! That's neat! I need to remember that :)
And I suppose I of all people shouldn't be griping about allowing more
endianness choices. I have a patch here to support big-endian
ARM/Linux. All I did was change TARGET_BYTE_ORDER_*.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-18 21:59 [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE Andrew Cagney
2002-01-19 6:47 ` Daniel Jacobowitz
@ 2002-01-20 0:30 ` Eli Zaretskii
2002-01-20 11:32 ` Andrew Cagney
2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2002-01-20 0:30 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Sat, 19 Jan 2002, Andrew Cagney wrote:
> + 2002-01-19 Andrew Cagney <ac131313@redhat.com>
> +
> + * gdbint.texinfo (Target Architecture Definition): Delete
> + description of TARGET_BYTE_ORDER_SELECTABLE_P.
This part of the patch is approved.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-19 9:00 ` Daniel Jacobowitz
@ 2002-01-20 10:33 ` Andrew Cagney
2002-01-20 10:36 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cagney @ 2002-01-20 10:33 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
>
> Woah! That's neat! I need to remember that :)
>
> And I suppose I of all people shouldn't be griping about allowing more
> endianness choices. I have a patch here to support big-endian
> ARM/Linux. All I did was change TARGET_BYTE_ORDER_*.
Delete it :-) As Michael observed, if the code is written correctly it
works from day one. (Problem is it has taken ~10 years to figure out
how to correctly write the code :-)
Oh, if you think that is neat, just wait until someone adds byte-order
information to ``struct type''. As it is, gdb knows about the byte
order of certain floating-point types. :-)
enjoy,
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-20 10:33 ` Andrew Cagney
@ 2002-01-20 10:36 ` Daniel Jacobowitz
2002-01-20 11:00 ` Andrew Cagney
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2002-01-20 10:36 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Sun, Jan 20, 2002 at 01:33:29PM -0500, Andrew Cagney wrote:
> >
> >Woah! That's neat! I need to remember that :)
> >
> >And I suppose I of all people shouldn't be griping about allowing more
> >endianness choices. I have a patch here to support big-endian
> >ARM/Linux. All I did was change TARGET_BYTE_ORDER_*.
>
>
> Delete it :-) As Michael observed, if the code is written correctly it
> works from day one. (Problem is it has taken ~10 years to figure out
> how to correctly write the code :-)
Well, I need to set TARGET_BYTE_ORDER_DEFAULT. If you start a cross
debugger without giving it a binary, and attach to a random remote
target, then we need to default to the right one. Other than that
everything is fine, though!
> Oh, if you think that is neat, just wait until someone adds byte-order
> information to ``struct type''. As it is, gdb knows about the byte
> order of certain floating-point types. :-)
And GCC keeps talking about supporting data types with arbitrary byte
order... :)
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-20 10:36 ` Daniel Jacobowitz
@ 2002-01-20 11:00 ` Andrew Cagney
2002-01-20 11:05 ` Daniel Jacobowitz
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cagney @ 2002-01-20 11:00 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
> On Sun, Jan 20, 2002 at 01:33:29PM -0500, Andrew Cagney wrote:
>
>> >
>> >Woah! That's neat! I need to remember that :)
>> >
>> >And I suppose I of all people shouldn't be griping about allowing more
>> >endianness choices. I have a patch here to support big-endian
>> >ARM/Linux. All I did was change TARGET_BYTE_ORDER_*.
>
>>
>>
>> Delete it :-) As Michael observed, if the code is written correctly it
>> works from day one. (Problem is it has taken ~10 years to figure out
>> how to correctly write the code :-)
>
>
> Well, I need to set TARGET_BYTE_ORDER_DEFAULT. If you start a cross
> debugger without giving it a binary, and attach to a random remote
> target, then we need to default to the right one. Other than that
> everything is fine, though!
Nope! I'm about to delete TARGET_BYTE_ORDER_DEFAULT.
There is this really nasty bit of code in arch-utils.c that roots around
the internals of BFD and uses that to determine the initial architecture
and byte-order. Doing this ensures that GDB's behavour is better
aligned with that of BINUTILS.
See arch-utils.c:initialize_current_architecture().
If GDB initializes its self to the wrong byte-order then there is likely
a bug in BFD.
Did I mention that we live in dangerous times :-)
Andrew
PS: Actually the code isn't that bad. What makes it nasty is the need
to prop up the old non-multi-arch behavour.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-20 11:00 ` Andrew Cagney
@ 2002-01-20 11:05 ` Daniel Jacobowitz
2002-01-20 11:18 ` Andrew Cagney
0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2002-01-20 11:05 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Sun, Jan 20, 2002 at 02:00:33PM -0500, Andrew Cagney wrote:
> >On Sun, Jan 20, 2002 at 01:33:29PM -0500, Andrew Cagney wrote:
> >
> >>>
> >>>Woah! That's neat! I need to remember that :)
> >>>
> >>>And I suppose I of all people shouldn't be griping about allowing more
> >>>endianness choices. I have a patch here to support big-endian
> >>>ARM/Linux. All I did was change TARGET_BYTE_ORDER_*.
> >
> >>
> >>
> >>Delete it :-) As Michael observed, if the code is written correctly it
> >>works from day one. (Problem is it has taken ~10 years to figure out
> >>how to correctly write the code :-)
> >
> >
> >Well, I need to set TARGET_BYTE_ORDER_DEFAULT. If you start a cross
> >debugger without giving it a binary, and attach to a random remote
> >target, then we need to default to the right one. Other than that
> >everything is fine, though!
>
>
> Nope! I'm about to delete TARGET_BYTE_ORDER_DEFAULT.
>
> There is this really nasty bit of code in arch-utils.c that roots around
> the internals of BFD and uses that to determine the initial architecture
> and byte-order. Doing this ensures that GDB's behavour is better
> aligned with that of BINUTILS.
> See arch-utils.c:initialize_current_architecture().
>
> If GDB initializes its self to the wrong byte-order then there is likely
> a bug in BFD.
Oh, I see. I -think- this will work correctly for my targets; I'll
check after you do it.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-20 11:05 ` Daniel Jacobowitz
@ 2002-01-20 11:18 ` Andrew Cagney
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Cagney @ 2002-01-20 11:18 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
> Nope! I'm about to delete TARGET_BYTE_ORDER_DEFAULT.
>>
>> There is this really nasty bit of code in arch-utils.c that roots around
>> the internals of BFD and uses that to determine the initial architecture
>> and byte-order. Doing this ensures that GDB's behavour is better
>> aligned with that of BINUTILS.
>> See arch-utils.c:initialize_current_architecture().
>>
>> If GDB initializes its self to the wrong byte-order then there is likely
>> a bug in BFD.
>
>
> Oh, I see. I -think- this will work correctly for my targets; I'll
> check after you do it.
BTW, the MIPS has been using this since:
Wed Jun 7 18:27:51 2000 Andrew Cagney <cagney@b1.cygnus.com>
* configure.in (DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC): Use config.bfd
to determine the default architecture / target.
* acconfig (DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC): Add.
* configure, config.in: Regenerate.
* arch-utils.c (set_endian): Better separate multi-arch and non-
multi-arch cases.
(set_endian_from_file): Call internal_error when multi-arch.
(initialize_current_architecture): Rewrite logic selecting a byte
order. Use DEFAULT_BFD_ARCH DEFAULT_BFD_VEC.
(version.h): Include.
* config/mips/tm-mips.h, config/mips/tm-bigmips64.h,
config/mips/tm-bigmips.h: Delete definition of
TARGET_BYTE_ORDER_DEFAULT.
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE
2002-01-18 21:59 [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE Andrew Cagney
2002-01-19 6:47 ` Daniel Jacobowitz
2002-01-20 0:30 ` Eli Zaretskii
@ 2002-01-20 11:32 ` Andrew Cagney
2 siblings, 0 replies; 12+ messages in thread
From: Andrew Cagney @ 2002-01-20 11:32 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
> 2002-01-19 Andrew Cagney <ac131313@redhat.com>
>
> * remote-sim.c (gdbsim_open): Simplify code testing the macro
> TARGET_BYTE_ORDER_SELECTABLE_P. Assume the target is always
> byte-order selectable.
> * sparc-tdep.c (sparc_target_architecture_hook): Ditto.
> * arch-utils.c: Ditto.
> (set_endian): Ditto.
> (set_endian_from_file): Ditto.
> * gdbserver/low-sim.c (create_inferior): Ditto.
> * gdbarch.sh: Ditto.
> * gdbarch.h: Re-generate.
> * config/powerpc/tm-ppc-eabi.h (TARGET_BYTE_ORDER_SELECTABLE_P):
> * config/sparc/tm-sparclite.h (TARGET_BYTE_ORDER_SELECTABLE):
> * config/sparc/tm-sparclet.h (TARGET_BYTE_ORDER_SELECTABLE):
> * config/mcore/tm-mcore.h (TARGET_BYTE_ORDER_SELECTABLE_P):
> * config/arm/tm-wince.h (TARGET_BYTE_ORDER_SELECTABLE_P):
> * config/arm/tm-linux.h (TARGET_BYTE_ORDER_SELECTABLE_P):
> * config/arc/tm-arc.h (TARGET_BYTE_ORDER_SELECTABLE):
> * config/arm/tm-arm.h (TARGET_BYTE_ORDER_SELECTABLE_P): Delete
> macro definition.
> * config/mips/tm-wince.h: Remove #undef of macro
> TARGET_BYTE_ORDER_SELECTABLE.
> * config/sh/tm-wince.h: Ditto.
>
I've checked this one in. I guess I now get to find out how the
non-multi-arch targets go.
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2002-01-20 19:32 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-18 21:59 [patch/rfc] Eliminate TARGET_BYTE_ORDER_SELECTABLE Andrew Cagney
2002-01-19 6:47 ` Daniel Jacobowitz
2002-01-19 8:06 ` Michael Snyder
2002-01-19 8:57 ` Andrew Cagney
2002-01-19 9:00 ` Daniel Jacobowitz
2002-01-20 10:33 ` Andrew Cagney
2002-01-20 10:36 ` Daniel Jacobowitz
2002-01-20 11:00 ` Andrew Cagney
2002-01-20 11:05 ` Daniel Jacobowitz
2002-01-20 11:18 ` Andrew Cagney
2002-01-20 0:30 ` Eli Zaretskii
2002-01-20 11:32 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox