aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-e7000.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-19 14:11:42 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-19 14:11:42 +0000
commitcc17453a58ec28aaf09575e2554f41221ea160ca (patch)
treef0e508fae551a1fb50759fc70ea13bb46046e914 /gdb/remote-e7000.c
parent25a8b2508dbb81c6302063d379cbcb336d4d4fb5 (diff)
downloadgdb-cc17453a58ec28aaf09575e2554f41221ea160ca.zip
gdb-cc17453a58ec28aaf09575e2554f41221ea160ca.tar.gz
gdb-cc17453a58ec28aaf09575e2554f41221ea160ca.tar.bz2
2000-07-19 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
Multiarch the sh target. * sh-tdep.c: (sh_generic_reg_names, sh_reg_names,sh3_reg_names, sh3e_reg_names, sh_dsp_reg_names, sh3_dsp_reg_names, sh_processor_type_table): Remove. (XMALLOC): Define. (struct frame_extra_info): Define. (sh_register_raw_size, sh_register_virtual_size, sh_register_virtual_type, sh_register_byte, sh_breakpoint_from_pc, sh_frame_saved_pc, sh_skip_prologue, sh_nofp_frame_init_saved_regs, sh_fp_frame_init_saved_regs, sh_extract_struct_value_address, sh_use_struct_convention, sh_store_struct_return, sh_push_arguments, sh_push_return_address, sh_saved_pc_after_call, sh_generic_register_name, sh_sh_register_name, sh_sh3_register_name, sh_sh3e_register_name, sh_sh_dsp_register_name, sh_sh3_dsp_register_name, sh_frame_args_address, sh_frame_locals_address, sh_coerce_float_to_double, sh_default_store_return_value, sh3e_sh4_store_return_value, sh_generic_show_regs, sh3_show_regs,sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh_dsp_show_regs, sh_register_byte, sh_register_raw_size, sh_register_virtual_size, sh_sh3e_register_virtual_type, sh_default_register_virtual_type, sh_gdbarch_init): New functions. (sh_target_architecture_hook, sh_frame_find_saved_regs, sh_show_regs): Delete functions. (sh_frame_chain, sh_find_callers_reg, sh_init_extra_frame_info, sh_pop_frame, sh_extract_return_value): Update * config/sh/tm-sh.h (GDB_MULTI_ARCH): Define to 1. (struct gdbarch_tdep): Define. Remove all unnecessary defines. * remote-e7000.c ({PR,GBR,SR,MACL,VBR,MACH}_REGNUM): Define to -1, for h8300 case. (want_sh,want_nopc_sh,want_nopc_sh3): Make nomenclature consistent. (e7000_fetch_registers): Remove ifdef GDB_TARGET_IS_SH, use runtime check instead. (e7000_wait): Ditto. * sh3-rom.c (sh3_supply_register): Use gdbarch_tdep to get the SSR and SPC register numbers. (sh3_regnames, sh3e_regnames): Don't specify a size. * config/h8300/tm-h8300.h: Add comment.
Diffstat (limited to 'gdb/remote-e7000.c')
-rw-r--r--gdb/remote-e7000.c239
1 files changed, 136 insertions, 103 deletions
diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c
index 6de0315..dcc1384 100644
--- a/gdb/remote-e7000.c
+++ b/gdb/remote-e7000.c
@@ -1,5 +1,5 @@
/* Remote debugging interface for Hitachi E7000 ICE, for GDB
- Copyright 1993, 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain for Cygnus Support.
@@ -61,6 +61,31 @@
#define ACK 0x06
#define CTRLZ 0x1a
+/* This file is used by 2 different targets, sh-elf and h8300. The
+ h8300 is not multiarched and doesn't use the registers defined in
+ tm-sh.h. To avoid using a macro GDB_TARGET_IS_SH, we do runtime check
+ of the target, which requires that these namse below are always
+ defined also in the h8300 case. */
+
+#if !defined (PR_REGNUM)
+#define PR_REGNUM -1
+#endif
+#if !defined (GBR_REGNUM)
+#define GBR_REGNUM -1
+#endif
+#if !defined (VBR_REGNUM)
+#define VBR_REGNUM -1
+#endif
+#if !defined (MACH_REGNUM)
+#define MACH_REGNUM -1
+#endif
+#if !defined (MACL_REGNUM)
+#define MACL_REGNUM -1
+#endif
+#if !defined (SR_REGNUM)
+#define SR_REGNUM -1
+#endif
+
extern void notice_quit (void);
extern void report_transfer_performance (unsigned long, time_t, time_t);
@@ -732,8 +757,6 @@ e7000_resume (pid, step, sig)
BREAK POINT
*/
-#ifdef GDB_TARGET_IS_H8300
-
char *want_h8300h = "PC=%p CCR=%c\n\
ER0 - ER3 %0 %1 %2 %3\n\
ER4 - ER7 %4 %5 %6 %7\n";
@@ -751,17 +774,13 @@ char *want_nopc_h8300s = "%p CCR=%c EXR=%9\n\
ER0 - ER3 %0 %1 %2 %3\n\
ER4 - ER7 %4 %5 %6 %7";
-#endif
-
-#ifdef GDB_TARGET_IS_SH
-
-char *want = "PC=%16 SR=%22\n\
+char *want_sh = "PC=%16 SR=%22\n\
PR=%17 GBR=%18 VBR=%19\n\
MACH=%20 MACL=%21\n\
R0-7 %0 %1 %2 %3 %4 %5 %6 %7\n\
R8-15 %8 %9 %10 %11 %12 %13 %14 %15\n";
-char *want_nopc = "%16 SR=%22\n\
+char *want_nopc_sh = "%16 SR=%22\n\
PR=%17 GBR=%18 VBR=%19\n\
MACH=%20 MACL=%21\n\
R0-7 %0 %1 %2 %3 %4 %5 %6 %7\n\
@@ -777,7 +796,7 @@ R4_BANK0-R7_BANK0 %29 %30 %31 %32\n\
R0_BANK1-R3_BANK1 %33 %34 %35 %36\n\
R4_BANK1-R7_BANK1 %37 %38 %39 %40";
-char *want_sh3_nopc = "%16 SR=%22\n\
+char *want_nopc_sh3 = "%16 SR=%22\n\
PR=%17 GBR=%18 VBR=%19\n\
MACH=%20 MACL=%21 SSR=%22 SPC=%23\n\
R0-7 %0 %1 %2 %3 %4 %5 %6 %7\n\
@@ -787,8 +806,6 @@ char *want_sh3_nopc = "%16 SR=%22\n\
R0_BANK1-R3_BANK1 %33 %34 %35 %36\n\
R4_BANK1-R7_BANK1 %37 %38 %39 %40";
-#endif
-
static int
gch ()
{
@@ -920,22 +937,27 @@ e7000_fetch_registers ()
puts_e7000debug ("R\r");
-#ifdef GDB_TARGET_IS_SH
- wanted = want;
if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
- switch (TARGET_ARCHITECTURE->mach)
- {
- case bfd_mach_sh3:
- case bfd_mach_sh3e:
- case bfd_mach_sh4:
- wanted = want_sh3;
- }
-#else
- if (h8300smode)
- wanted = want_h8300s;
- else
- wanted = want_h8300h;
+ {
+ wanted = want_sh;
+ switch (TARGET_ARCHITECTURE->mach)
+ {
+ case bfd_mach_sh3:
+ case bfd_mach_sh3e:
+ case bfd_mach_sh4:
+ wanted = want_sh3;
+ }
+ }
+#ifdef GDB_TARGET_IS_H8300
+ if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
+ {
+ if (h8300smode)
+ wanted = want_h8300s;
+ else
+ wanted = want_h8300h;
+ }
#endif
+
fetch_regs_from_dump (gch, wanted);
/* And supply the extra ones the simulator uses */
@@ -984,70 +1006,77 @@ e7000_store_register (regno)
return;
}
-#ifdef GDB_TARGET_IS_H8300
- if (regno <= 7)
+ if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
{
- sprintf (buf, ".ER%d %x\r", regno, read_register (regno));
- puts_e7000debug (buf);
- }
- else if (regno == PC_REGNUM)
- {
- sprintf (buf, ".PC %x\r", read_register (regno));
- puts_e7000debug (buf);
- }
- else if (regno == CCR_REGNUM)
- {
- sprintf (buf, ".CCR %x\r", read_register (regno));
- puts_e7000debug (buf);
+ if (regno <= 7)
+ {
+ sprintf (buf, ".ER%d %lx\r", regno, read_register (regno));
+ puts_e7000debug (buf);
+ }
+ else if (regno == PC_REGNUM)
+ {
+ sprintf (buf, ".PC %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
+#ifdef CCR_REGNUM
+ else if (regno == CCR_REGNUM)
+ {
+ sprintf (buf, ".CCR %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
+#endif
}
-#endif /* GDB_TARGET_IS_H8300 */
-#ifdef GDB_TARGET_IS_SH
- switch (regno)
+ else if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
{
- default:
- sprintf (buf, ".R%d %x\r", regno, read_register (regno));
- puts_e7000debug (buf);
- break;
-
- case PC_REGNUM:
- sprintf (buf, ".PC %x\r", read_register (regno));
- puts_e7000debug (buf);
- break;
+ if (regno == PC_REGNUM)
+ {
+ sprintf (buf, ".PC %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
- case SR_REGNUM:
- sprintf (buf, ".SR %x\r", read_register (regno));
- puts_e7000debug (buf);
- break;
+ else if (regno == SR_REGNUM)
+ {
+ sprintf (buf, ".SR %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
- case PR_REGNUM:
- sprintf (buf, ".PR %x\r", read_register (regno));
- puts_e7000debug (buf);
- break;
+ else if (regno == PR_REGNUM)
+ {
+ sprintf (buf, ".PR %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
- case GBR_REGNUM:
- sprintf (buf, ".GBR %x\r", read_register (regno));
- puts_e7000debug (buf);
- break;
+ else if (regno == GBR_REGNUM)
+ {
+ sprintf (buf, ".GBR %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
- case VBR_REGNUM:
- sprintf (buf, ".VBR %x\r", read_register (regno));
- puts_e7000debug (buf);
- break;
+ else if (regno == VBR_REGNUM)
+ {
+ sprintf (buf, ".VBR %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
- case MACH_REGNUM:
- sprintf (buf, ".MACH %x\r", read_register (regno));
- puts_e7000debug (buf);
- break;
+ else if (regno == MACH_REGNUM)
+ {
+ sprintf (buf, ".MACH %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
- case MACL_REGNUM:
- sprintf (buf, ".MACL %x\r", read_register (regno));
- puts_e7000debug (buf);
- break;
+ else if (regno == MACL_REGNUM)
+ {
+ sprintf (buf, ".MACL %lx\r", read_register (regno));
+ puts_e7000debug (buf);
+ }
+ else
+ {
+ sprintf (buf, ".R%d %lx\r", regno, read_register (regno));
+ puts_e7000debug (buf);
+ }
}
-#endif /* GDB_TARGET_IS_SH */
-
expect_prompt ();
}
@@ -1098,7 +1127,7 @@ write_small (memaddr, myaddr, len)
if (((memaddr + i) & 3) == 0 && (i + 3 < len))
{
/* Can be done with a long word */
- sprintf (buf, "m %x %x%02x%02x%02x;l\r",
+ sprintf (buf, "m %lx %x%02x%02x%02x;l\r",
memaddr + i,
myaddr[i], myaddr[i + 1], myaddr[i + 2], myaddr[i + 3]);
puts_e7000debug (buf);
@@ -1106,7 +1135,7 @@ write_small (memaddr, myaddr, len)
}
else
{
- sprintf (buf, "m %x %x\r", memaddr + i, myaddr[i]);
+ sprintf (buf, "m %lx %x\r", memaddr + i, myaddr[i]);
puts_e7000debug (buf);
}
}
@@ -1268,7 +1297,7 @@ e7000_read_inferior_memory (memaddr, myaddr, len)
return 0;
}
- sprintf (buf, "m %x;l\r", memaddr);
+ sprintf (buf, "m %lx;l\r", memaddr);
puts_e7000debug (buf);
for (count = 0; count < len; count += 4)
@@ -1349,7 +1378,7 @@ e7000_read_inferior_memory_large (memaddr, myaddr, len)
return 0;
}
- sprintf (buf, "d %x %x\r", memaddr, memaddr + len - 1);
+ sprintf (buf, "d %lx %lx\r", memaddr, memaddr + len - 1);
puts_e7000debug (buf);
count = 0;
@@ -1603,7 +1632,7 @@ e7000_load (args, from_tty)
section_size = bfd_get_section_size_before_reloc (section);
if (!quiet)
- printf_filtered ("[Loading section %s at 0x%x (%d bytes)]\n",
+ printf_filtered ("[Loading section %s at 0x%x (%ud bytes)]\n",
bfd_get_section_name (pbfd, section),
section_address,
section_size);
@@ -1736,12 +1765,12 @@ e7000_insert_breakpoint (addr, shadow)
#ifdef HARD_BREAKPOINTS
if (BC_BREAKPOINTS)
{
- sprintf (buf, "BC%d A=%x\r", i + 1, addr);
+ sprintf (buf, "BC%d A=%lx\r", i + 1, addr);
puts_e7000debug (buf);
}
else
{
- sprintf (buf, "B %x\r", addr);
+ sprintf (buf, "B %lx\r", addr);
puts_e7000debug (buf);
}
#else
@@ -1782,12 +1811,12 @@ e7000_remove_breakpoint (addr, shadow)
}
else
{
- sprintf (buf, "B - %x\r", addr);
+ sprintf (buf, "B - %lx\r", addr);
puts_e7000debug (buf);
}
expect_prompt ();
#else
- sprintf (buf, "B - %x\r", addr);
+ sprintf (buf, "B - %lx\r", addr);
puts_e7000debug (buf);
expect_prompt ();
@@ -1800,7 +1829,7 @@ e7000_remove_breakpoint (addr, shadow)
return 0;
}
- warning ("Can't find breakpoint associated with 0x%x\n", addr);
+ warning ("Can't find breakpoint associated with 0x%lx\n", addr);
return 1;
}
@@ -2008,7 +2037,7 @@ sub2_from_pc ()
REGISTER_RAW_SIZE (PC_REGNUM),
read_register (PC_REGNUM) - 2);
supply_register (PC_REGNUM, buf);
- sprintf (buf2, ".PC %x\r", read_register (PC_REGNUM));
+ sprintf (buf2, ".PC %lx\r", read_register (PC_REGNUM));
puts_e7000debug (buf2);
}
@@ -2078,21 +2107,25 @@ e7000_wait (pid, status)
/* Skip till the PC= */
expect ("=");
-#ifdef GDB_TARGET_IS_SH
- wanted_nopc = want_nopc;
if (TARGET_ARCHITECTURE->arch == bfd_arch_sh)
- switch (TARGET_ARCHITECTURE->mach)
- {
- case bfd_mach_sh3:
- case bfd_mach_sh3e:
- case bfd_mach_sh4:
- wanted_nopc = want_sh3_nopc;
- }
-#else
- if (h8300smode)
- wanted_nopc = want_nopc_h8300s;
- else
- wanted_nopc = want_nopc_h8300h;
+ {
+ wanted_nopc = want_nopc_sh;
+ switch (TARGET_ARCHITECTURE->mach)
+ {
+ case bfd_mach_sh3:
+ case bfd_mach_sh3e:
+ case bfd_mach_sh4:
+ wanted_nopc = want_nopc_sh3;
+ }
+ }
+#ifdef GDB_TARGET_IS_H8300
+ if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
+ {
+ if (h8300smode)
+ wanted_nopc = want_nopc_h8300s;
+ else
+ wanted_nopc = want_nopc_h8300h;
+ }
#endif
fetch_regs_from_dump (gch, wanted_nopc);