+Sun Dec 13 09:52:51 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * defs.h (TARGET_PRINT_INSN_INFO, TARGET_PRINT_INSN): Define.
+ (TARGET_ARCHITECTURE, TARGET_ARCHITECTURE_AUTO): Define.
+ (TARGET_BYTE_ORDER_AUTO): Define.
+ (TARGET_BYTE_ORDER_SELECTABLE_P): Provide default. Replaces
+ TARGET_BYTE_ORDER_SELECTABLE. Handle compat issues.
+ (BITS_BIG_ENDIAN): Simplify.
+ (TARGET_FLOAT_FORMAT): Ditto.
+ (TARGET_DOUBLE_FORMAT):
+
+ * remote-e7000.c, sh-tdep.c, printcmd.c, gdbtk-cmds.c,
+ remote-sim.c, remote-rdi.c, sparc-tdep.c: Update.
+
+ * config/powerpc/tm-ppcle-eabi.h, config/rs6000/tm-rs6000.h,
+ config/powerpc/tm-ppc-eabi.h, config/mn10300/tm-mn10300.h:
+ Convert.
+
Sat Dec 12 09:28:13 1998 Andrew Cagney <cagney@b1.cygnus.com>
* frame.h (struct frame_info): Add CORE_ADDR *saved_regs and
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The mn10300 is little endian. */
-#define TARGET_BYTE_ORDER LITTLE_ENDIAN
+#define TARGET_BYTE_ORDER_DEFAULT LITTLE_ENDIAN
/* All registers are 32bits (phew!). */
#define REGISTER_SIZE 4
/* Use normal ppc-eabi definitions */
#include "powerpc/tm-ppc-eabi.h"
-#undef TARGET_BYTE_ORDER
-#define TARGET_BYTE_ORDER LITTLE_ENDIAN
+#undef TARGET_BYTE_ORDER_DEFAULT
+#define TARGET_BYTE_ORDER_DEFAULT LITTLE_ENDIAN
#endif /* TM_PPCLE_EABI_H */
/* Target-system-dependent parameters for GDB. */
+/* 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). */
+
+#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
-/* The target endianness is selectable at runtime. Define
- TARGET_BYTE_ORDER to be a variable. The user can use the `set
- endian' command to change it. */
-#undef TARGET_BYTE_ORDER
-#define TARGET_BYTE_ORDER target_byte_order
+#define TARGET_BYTE_ORDER_SELECTABLE_P 1
+#else
+#define TARGET_BYTE_ORDER_SELECTABLE_P 0
+#endif
+#endif
+
extern int target_byte_order;
-/* Nonzero when target_byte_order auto-detected */
+#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
+
extern int target_byte_order_auto;
+#ifndef TARGET_BYTE_ORDER_AUTO
+#define TARGET_BYTE_ORDER_AUTO (target_byte_order_auto + 0)
#endif
extern void set_endian_from_file PARAMS ((bfd *));
/* The target architecture can be set at run-time. */
extern int target_architecture_auto;
extern const bfd_arch_info_type *target_architecture;
+#define TARGET_ARCHITECTURE_AUTO (target_architecture_auto + 0)
+#define TARGET_ARCHITECTURE (target_architecture + 0)
extern void set_architecture_from_file PARAMS ((bfd *));
/* Notify target of a change to the selected architecture. Zero return
status indicates that the target did not like the change. */
from byte/word byte order. */
#if !defined (BITS_BIG_ENDIAN)
-#ifndef TARGET_BYTE_ORDER_SELECTABLE
-
-#if TARGET_BYTE_ORDER == BIG_ENDIAN
-#define BITS_BIG_ENDIAN 1
-#endif /* Big endian. */
-
-#if TARGET_BYTE_ORDER == LITTLE_ENDIAN
-#define BITS_BIG_ENDIAN 0
-#endif /* Little endian. */
-
-#else /* defined (TARGET_BYTE_ORDER_SELECTABLE) */
-
#define BITS_BIG_ENDIAN (TARGET_BYTE_ORDER == BIG_ENDIAN)
-
-#endif /* defined (TARGET_BYTE_ORDER_SELECTABLE) */
-#endif /* BITS_BIG_ENDIAN not defined. */
+#endif
/* In findvar.c. */
#define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown
#endif
-#ifndef TARGET_BYTE_ORDER_SELECTABLE
-# if TARGET_BYTE_ORDER == BIG_ENDIAN
-# ifndef TARGET_FLOAT_FORMAT
-# define TARGET_FLOAT_FORMAT &floatformat_ieee_single_big
-# endif
-# ifndef TARGET_DOUBLE_FORMAT
-# define TARGET_DOUBLE_FORMAT &floatformat_ieee_double_big
-# endif
-# else /* LITTLE_ENDIAN */
-# ifndef TARGET_FLOAT_FORMAT
-# define TARGET_FLOAT_FORMAT &floatformat_ieee_single_little
-# endif
-# ifndef TARGET_DOUBLE_FORMAT
-# define TARGET_DOUBLE_FORMAT &floatformat_ieee_double_little
-# endif
-# endif
-#else /* TARGET_BYTE_ORDER_SELECTABLE */
-# ifndef TARGET_FLOAT_FORMAT
-# define TARGET_FLOAT_FORMAT (target_byte_order == BIG_ENDIAN \
- ? &floatformat_ieee_single_big \
- : &floatformat_ieee_single_little)
-# endif
-# ifndef TARGET_DOUBLE_FORMAT
-# define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \
- ? &floatformat_ieee_double_big \
- : &floatformat_ieee_double_little)
-# endif
+#ifndef TARGET_FLOAT_FORMAT
+#define TARGET_FLOAT_FORMAT (target_byte_order == BIG_ENDIAN \
+ ? &floatformat_ieee_single_big \
+ : &floatformat_ieee_single_little)
+#endif
+#ifndef TARGET_DOUBLE_FORMAT
+#define TARGET_DOUBLE_FORMAT (target_byte_order == BIG_ENDIAN \
+ ? &floatformat_ieee_double_big \
+ : &floatformat_ieee_double_little)
#endif
#ifndef TARGET_LONG_DOUBLE_FORMAT
extern int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info*));
extern disassemble_info tm_print_insn_info;
+#ifndef TARGET_PRINT_INSN
+#define TARGET_PRINT_INSN(vma, info) (*tm_print_insn) (vma, info)
+#endif
+#ifndef TARGET_PRINT_INSN_INFO
+#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
+#endif
/* Hooks for alternate command interfaces. */
+Sun Dec 13 10:27:59 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gdbint.texinfo: Document TARGET_BYTE_ORDER_DEFAULT and
+ TARGET_BYTE_ORDER_SELECTABLE_P.
+
Thu Dec 10 16:07:09 1998 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo (FRAME_FIND_SAVED_REGS): Document.
di_initialized = 1;
}
- di.mach = tm_print_insn_info.mach;
+ di.mach = TM_PRINT_INSN_INFO->mach;
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
di.endian = BFD_ENDIAN_BIG;
else
CORE_ADDR memaddr;
GDB_FILE *stream;
{
- /* If there's no disassembler, something is very wrong. */
- if (tm_print_insn == NULL)
- abort ();
-
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
- tm_print_insn_info.endian = BFD_ENDIAN_BIG;
+ TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
else
- tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
+ TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE;
- if (target_architecture != NULL)
- tm_print_insn_info.mach = target_architecture->mach;
+ if (TARGET_ARCHITECTURE != NULL)
+ TARGET_PRINT_INSN_INFO->mach = TARGET_ARCHITECTURE->mach;
/* else: should set .mach=0 but some disassemblers don't grok this */
- return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+ return TARGET_PRINT_INSN (memaddr, TARGET_PRINT_INSN_INFO);
}
\f
/* Remote debugging interface for Hitachi E7000 ICE, for GDB
- Copyright 1993, 1994, 1996 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain for Cygnus Support.
#include <time.h>
#include <ctype.h>
+
#if 1
#define HARD_BREAKPOINTS /* Now handled by set option. */
#define BC_BREAKPOINTS use_hard_breakpoints
error ("Can't pass arguments to remote E7000DEBUG process");
if (execfile == 0 || exec_bfd == 0)
- error ("No exec file specified");
+ error ("No executable file specified");
entry_pt = (int) bfd_get_start_address (exec_bfd);
#ifdef GDB_TARGET_IS_SH
wanted = want;
- if (target_architecture->arch == bfd_arch_sh)
- switch (target_architecture->mach)
+ if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
+ switch (TARGET_ARCHITECTURE->mach)
{
case bfd_mach_sh3:
case bfd_mach_sh3e:
- /* start-sanitize-sh4 */
case bfd_mach_sh4:
- /* end-sanitize-sh4 */
wanted = want_sh3;
}
#else
if (h8300smode)
wanted = want_h8300s;
else
- wanted = want_h8300h);
+ wanted = want_h8300h;
#endif
fetch_regs_from_dump (gch, wanted);
perror_with_name (filename);
return;
}
- old_chain = make_cleanup (bfd_close, pbfd);
+ old_chain = make_cleanup ((make_cleanup_func) bfd_close, pbfd);
if (!bfd_check_format (pbfd, bfd_object))
error ("\"%s\" is not an object file: %s", filename,
#define MAX_E7000DEBUG_BREAKPOINTS MAX_BREAKPOINTS
#endif
-extern int memory_breakpoint_size;
-
/* Since we can change to soft breakpoints dynamically, we must define
more than enough. Was breakaddr[MAX_E7000DEBUG_BREAKPOINTS]. */
static CORE_ADDR breakaddr[MAX_BREAKPOINTS] = {0};
#ifdef GDB_TARGET_IS_SH
wanted_nopc = want_nopc;
- if (target_architecture->arch == bfd_arch_sh)
- switch (target_architecture->mach)
+ if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
+ switch (TARGET_ARCHITECTURE->mach)
{
case bfd_mach_sh3:
case bfd_mach_sh3e:
- /* start-sanitize-sh4 */
case bfd_mach_sh4:
- /* end-sanitize-sh4 */
wanted_nopc = want_sh3_nopc;
}
#else
if (h8300smode)
wanted_nopc = want_nopc_h8300s;
else
- wanted_nopc = want_nopc_h8300h);
+ wanted_nopc = want_nopc_h8300h;
#endif
fetch_regs_from_dump (gch, wanted_nopc);
/* Define the target subroutine names. */
-struct target_ops e7000_ops =
+struct target_ops e7000_ops ;
+static void init_e7000_ops(void)
{
- "e7000",
- "Remote Hitachi e7000 target",
- "Use a remote Hitachi e7000 ICE connected by a serial line,\n\
+ e7000_ops.to_shortname = "e7000";
+ e7000_ops.to_longname = "Remote Hitachi e7000 target";
+ e7000_ops.to_doc = "Use a remote Hitachi e7000 ICE connected by a serial line;\n\
or a network connection.\n\
Arguments are the name of the device for the serial line,\n\
the speed to connect at in bits per second.\n\
eg\n\
target e7000 /dev/ttya 9600\n\
-target e7000 foobar",
- e7000_open, /* to_open */
- e7000_close, /* to_close */
- 0, /* to_attach */
- e7000_detach, /* to_detach */
- e7000_resume, /* to_resume */
- e7000_wait, /* to_wait */
- e7000_fetch_register, /* to_fetch_registers */
- e7000_store_register, /* to_store_registers */
- e7000_prepare_to_store, /* to_prepare_to_store */
- e7000_xfer_inferior_memory, /* to_xfer_memory */
- e7000_files_info, /* to_files_info */
- e7000_insert_breakpoint, /* to_insert_breakpoint */
- e7000_remove_breakpoint, /* to_remove_breakpoint */
- 0, /* to_terminal_init */
- 0, /* to_terminal_inferior */
- 0, /* to_terminal_ours_for_output */
- 0, /* to_terminal_ours */
- 0, /* to_terminal_info */
- e7000_kill, /* to_kill */
- e7000_load, /* to_load */
- 0, /* to_lookup_symbol */
- e7000_create_inferior, /* to_create_inferior */
- e7000_mourn_inferior, /* to_mourn_inferior */
- 0, /* to_can_run */
- 0, /* to_notice_signals */
- 0, /* to_thread_alive */
- e7000_stop, /* to_stop */
- process_stratum, /* to_stratum */
- 0, /* next (unused) */
- 1, /* to_has_all_memory */
- 1, /* to_has_memory */
- 1, /* to_has_stack */
- 1, /* to_has_registers */
- 1, /* to_has_execution */
- 0, /* to_sections */
- 0, /* to_sections_end */
- OPS_MAGIC, /* Always the last thing */
+target e7000 foobar" ;
+ e7000_ops.to_open = e7000_open;
+ e7000_ops.to_close = e7000_close;
+ e7000_ops.to_attach = 0;
+ e7000_ops.to_detach = e7000_detach;
+ e7000_ops.to_resume = e7000_resume;
+ e7000_ops.to_wait = e7000_wait;
+ e7000_ops.to_fetch_registers = e7000_fetch_register;
+ e7000_ops.to_store_registers = e7000_store_register;
+ e7000_ops.to_prepare_to_store = e7000_prepare_to_store;
+ e7000_ops.to_xfer_memory = e7000_xfer_inferior_memory;
+ e7000_ops.to_files_info = e7000_files_info;
+ e7000_ops.to_insert_breakpoint = e7000_insert_breakpoint;
+ e7000_ops.to_remove_breakpoint = e7000_remove_breakpoint;
+ e7000_ops.to_terminal_init = 0;
+ e7000_ops.to_terminal_inferior = 0;
+ e7000_ops.to_terminal_ours_for_output = 0;
+ e7000_ops.to_terminal_ours = 0;
+ e7000_ops.to_terminal_info = 0;
+ e7000_ops.to_kill = e7000_kill;
+ e7000_ops.to_load = e7000_load;
+ e7000_ops.to_lookup_symbol = 0;
+ e7000_ops.to_create_inferior = e7000_create_inferior;
+ e7000_ops.to_mourn_inferior = e7000_mourn_inferior;
+ e7000_ops.to_can_run = 0;
+ e7000_ops.to_notice_signals = 0;
+ e7000_ops.to_thread_alive = 0;
+ e7000_ops.to_stop = e7000_stop;
+ e7000_ops.to_stratum = process_stratum;
+ e7000_ops.DONT_USE = 0;
+ e7000_ops.to_has_all_memory = 1;
+ e7000_ops.to_has_memory = 1;
+ e7000_ops.to_has_stack = 1;
+ e7000_ops.to_has_registers = 1;
+ e7000_ops.to_has_execution = 1;
+ e7000_ops.to_sections = 0;
+ e7000_ops.to_sections_end = 0;
+ e7000_ops.to_magic = OPS_MAGIC;
};
void
_initialize_remote_e7000 ()
{
+ init_e7000_ops() ;
add_target (&e7000_ops);
add_com ("e7000", class_obscure, e7000_command,
if (rslt != adp_ok)
error ("Could not open device \"%s\"", name);
- gdb_config.bytesex = 2 | (target_byte_order == BIG_ENDIAN ? 1 : 0);
+ gdb_config.bytesex = 2 | (TARGET_BYTE_ORDER == BIG_ENDIAN ? 1 : 0);
gdb_config.fpe = 1;
gdb_config.rditype = 2;
gdb_config.heartbeat_on = 1;
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). */
-#ifdef TARGET_BYTE_ORDER_SELECTABLE
- if (!target_byte_order_auto)
+ if (TARGET_BYTE_ORDER_SELECTABLE_P
+ && !TARGET_BYTE_ORDER_AUTO)
{
switch (TARGET_BYTE_ORDER)
{
fatal ("Value of TARGET_BYTE_ORDER unknown");
}
}
-#endif
/* Specify the architecture of the target when it has been
explicitly specified */
- if (!target_architecture_auto)
+ if (!TARGET_ARCHITECTURE_AUTO)
{
strcat (arg_buf, " --architecture=");
- strcat (arg_buf, target_architecture->printable_name);
+ strcat (arg_buf, TARGET_ARCHITECTURE->printable_name);
}
/* finally, any explicit args */
if (args)
int from_tty;
{
int cpu;
- if (target_architecture->arch == bfd_arch_sh)
- cpu = target_architecture->mach;
+ if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
+ cpu = TARGET_ARCHITECTURE->mach;
else
cpu = 0;
/* FIXME: sh4 has more registers */
/* 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 BIG_ENDIAN */
#ifndef TARGET_BYTE_ORDER_DEFAULT
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
#endif
+#endif
+#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
int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
int target_byte_order_auto = 1;
-#else
-static int target_byte_order_auto = 0;
-#endif
/* Called if the user enters ``set endian'' without an argument. */
static void
char *args;
int from_tty;
{
-#ifdef TARGET_BYTE_ORDER_SELECTABLE
- target_byte_order = BIG_ENDIAN;
- target_byte_order_auto = 0;
-#else
- printf_unfiltered ("Byte order is not selectable.");
- show_endian (args, from_tty);
-#endif
+ if (TARGET_BYTE_ORDER_SELECTABLE_P)
+ {
+ target_byte_order = BIG_ENDIAN;
+ target_byte_order_auto = 0;
+ }
+ else
+ {
+ printf_unfiltered ("Byte order is not selectable.");
+ show_endian (args, from_tty);
+ }
}
/* Called by ``set endian little''. */
char *args;
int from_tty;
{
-#ifdef TARGET_BYTE_ORDER_SELECTABLE
- target_byte_order = LITTLE_ENDIAN;
- target_byte_order_auto = 0;
-#else
- printf_unfiltered ("Byte order is not selectable.");
- show_endian (args, from_tty);
-#endif
+ if (TARGET_BYTE_ORDER_SELECTABLE_P)
+ {
+ target_byte_order = LITTLE_ENDIAN;
+ target_byte_order_auto = 0;
+ }
+ else
+ {
+ printf_unfiltered ("Byte order is not selectable.");
+ show_endian (args, from_tty);
+ }
}
/* Called by ``set endian auto''. */
char *args;
int from_tty;
{
-#ifdef TARGET_BYTE_ORDER_SELECTABLE
- target_byte_order_auto = 1;
-#else
- printf_unfiltered ("Byte order is not selectable.");
- show_endian (args, from_tty);
-#endif
+ if (TARGET_BYTE_ORDER_SELECTABLE_P)
+ {
+ target_byte_order_auto = 1;
+ }
+ else
+ {
+ printf_unfiltered ("Byte order is not selectable.");
+ show_endian (args, from_tty);
+ }
}
/* Called by ``show endian''. */
char *args;
int from_tty;
{
- const char *msg =
- (target_byte_order_auto
+ char *msg =
+ (TARGET_BYTE_ORDER_AUTO
? "The target endianness is set automatically (currently %s endian)\n"
: "The target is assumed to be %s endian\n");
- printf_unfiltered ((char *) msg, TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
+ printf_unfiltered (msg, (TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little"));
}
/* Set the endianness from a BFD. */
set_endian_from_file (abfd)
bfd *abfd;
{
-#ifdef TARGET_BYTE_ORDER_SELECTABLE
- int want;
-
- if (bfd_big_endian (abfd))
- want = BIG_ENDIAN;
+ if (TARGET_BYTE_ORDER_SELECTABLE_P)
+ {
+ int want;
+
+ if (bfd_big_endian (abfd))
+ want = BIG_ENDIAN;
+ else
+ want = LITTLE_ENDIAN;
+ 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 == BIG_ENDIAN ? "big" : "little",
+ TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
+ }
else
- want = LITTLE_ENDIAN;
- 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 == BIG_ENDIAN ? "big" : "little",
- TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
-
-#else /* ! defined (TARGET_BYTE_ORDER_SELECTABLE) */
-
- if (bfd_big_endian (abfd)
- ? TARGET_BYTE_ORDER != BIG_ENDIAN
- : TARGET_BYTE_ORDER == BIG_ENDIAN)
- warning ("%s endian file does not match %s endian target.",
- bfd_big_endian (abfd) ? "big" : "little",
- TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
-
-#endif /* ! defined (TARGET_BYTE_ORDER_SELECTABLE) */
+ {
+ if (bfd_big_endian (abfd)
+ ? TARGET_BYTE_ORDER != BIG_ENDIAN
+ : TARGET_BYTE_ORDER == BIG_ENDIAN)
+ warning ("%s endian file does not match %s endian target.",
+ bfd_big_endian (abfd) ? "big" : "little",
+ TARGET_BYTE_ORDER == BIG_ENDIAN ? "big" : "little");
+ }
}
\f
/* Functions to manipulate the architecture of the target */