X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fremote-e7000.c;h=76a245c9973c48ec5ed931a5808da2df5e613a20;hb=b4f4e59ffff89dd86068046263008836e145ae41;hp=fcc175f6672f3333f07480fac185c8783275267a;hpb=2cd58942b9bf50ccde261085d8a2b3e7ced88e5e;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index fcc175f667..76a245c997 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -1,6 +1,8 @@ -/* Remote debugging interface for Hitachi E7000 ICE, for GDB - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. +/* Remote debugging interface for Renesas E7000 ICE, for GDB + + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004 Free Software Foundation, Inc. + Contributed by Cygnus Support. Written by Steve Chamberlain for Cygnus Support. @@ -22,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* The E7000 is an in-circuit emulator for the Hitachi H8/300-H and - Hitachi-SH processor. It has serial port and a lan port. +/* The E7000 is an in-circuit emulator for the Renesas H8/300-H and + Renesas-SH processor. It has serial port and a lan port. The monitor command set makes it difficult to load large ammounts of data over the lan without using ftp - so try not to issue load @@ -41,6 +43,7 @@ #include "value.h" #include "command.h" #include "gdb_string.h" +#include "exceptions.h" #include "gdbcmd.h" #include #include "serial.h" @@ -149,7 +152,7 @@ static void puts_e7000debug (char *buf) { if (!e7000_desc) - error ("Use \"target e7000 ...\" first."); + error (_("Use \"target e7000 ...\" first.")); if (remote_debug) printf_unfiltered ("Sending %s\n", buf); @@ -207,10 +210,10 @@ readchar (int timeout) if (timeout == 0) return -1; echo = 0; - error ("Timeout reading from remote system."); + error (_("Timeout reading from remote system.")); } else if (c < 0) - error ("Serial communication error"); + error (_("Serial communication error")); if (remote_debug) { @@ -360,7 +363,7 @@ get_hex_regs (int n, int regno) val = 0; for (j = 0; j < 8; j++) val = (val << 4) + get_hex_digit (j == 0); - supply_register (regno++, (char *) &val); + regcache_raw_supply (current_regcache, regno++, (char *) &val); } } #endif @@ -369,15 +372,16 @@ get_hex_regs (int n, int regno) user types "run" after having attached. */ static void -e7000_create_inferior (char *execfile, char *args, char **env) +e7000_create_inferior (char *execfile, char *args, char **env, + int from_tty) { int entry_pt; if (args && *args) - error ("Can't pass arguments to remote E7000DEBUG process"); + error (_("Can't pass arguments to remote E7000DEBUG process")); if (execfile == 0 || exec_bfd == 0) - error ("No executable file specified"); + error (_("No executable file specified")); entry_pt = (int) bfd_get_start_address (exec_bfd); @@ -456,7 +460,7 @@ e7000_login_command (char *args, int from_tty) } else { - error ("Syntax is ftplogin "); + error (_("Syntax is ftplogin ")); } } @@ -520,10 +524,10 @@ e7000_parse_device (char *args, char *dev_name, int baudrate) if (n != 1 && n != 2) { - error ("Bad arguments. Usage:\ttarget e7000 \n\ + error (_("Bad arguments. Usage:\ttarget e7000 \n\ or \t\ttarget e7000 [:]\n\ or \t\ttarget e7000 tcp_remote [:]\n\ -or \t\ttarget e7000 pc\n"); +or \t\ttarget e7000 pc\n")); } #if !defined(__GO32__) && !defined(_WIN32) && !defined(__CYGWIN__) @@ -610,7 +614,7 @@ e7000_start_remote (void *dummy) if (!sync) { fprintf_unfiltered (gdb_stderr, "Giving up after %d tries...\n", try); - error ("Unable to synchronize with target.\n"); + error (_("Unable to synchronize with target.")); } puts_e7000debug ("\r"); @@ -627,9 +631,7 @@ e7000_start_remote (void *dummy) flush_cached_frames (); registers_changed (); stop_pc = read_pc (); - set_current_frame (create_new_frame (read_fp (), stop_pc)); - select_frame (get_current_frame (), 0); - print_stack_frame (selected_frame, -1, 1); + print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC); return 1; } @@ -657,10 +659,6 @@ e7000_open (char *args, int from_tty) } serial_raw (e7000_desc); -#ifdef GDB_TARGET_IS_H8300 - h8300hmode = 1; -#endif - /* Start the remote connection; if error (0), discard this target. In particular, if the user quits, be sure to discard it (we'd be in an inconsistent state otherwise). */ @@ -781,16 +779,16 @@ gbyte (void) return (high << 4) + low; } -void +static void fetch_regs_from_dump (int (*nextchar) (), char *want) { int regno; - char buf[MAX_REGISTER_RAW_SIZE]; + char buf[MAX_REGISTER_SIZE]; int thischar = nextchar (); if (want == NULL) - internal_error (__FILE__, __LINE__, "Register set not selected."); + internal_error (__FILE__, __LINE__, _("Register set not selected.")); while (*want) { @@ -828,7 +826,7 @@ fetch_regs_from_dump (int (*nextchar) (), char *want) } else { - error ("out of sync in fetch registers wanted <%s>, got <%c 0x%x>", + error (_("out of sync in fetch registers wanted <%s>, got <%c 0x%x>"), want, thischar, thischar); } @@ -856,9 +854,9 @@ fetch_regs_from_dump (int (*nextchar) (), char *want) want++; break; #endif -#ifdef FP_REGNUM +#ifdef DEPRECATED_FP_REGNUM case 'f': - regno = FP_REGNUM; + regno = DEPRECATED_FP_REGNUM; want++; break; #endif @@ -879,12 +877,12 @@ fetch_regs_from_dump (int (*nextchar) (), char *want) } else - internal_error (__FILE__, __LINE__, "failed internal consistency check"); + internal_error (__FILE__, __LINE__, _("failed internal consistency check")); } store_signed_integer (buf, - REGISTER_RAW_SIZE (regno), + register_size (current_gdbarch, regno), (LONGEST) get_hex (&thischar)); - supply_register (regno, buf); + regcache_raw_supply (current_regcache, regno, buf); break; } } @@ -895,12 +893,14 @@ e7000_fetch_registers (void) { int regno; char *wanted = NULL; + int realregs = 0; puts_e7000debug ("R\r"); if (TARGET_ARCHITECTURE->arch == bfd_arch_sh) { wanted = want_sh; + realregs = 59; switch (TARGET_ARCHITECTURE->mach) { case bfd_mach_sh3: @@ -909,24 +909,29 @@ e7000_fetch_registers (void) wanted = want_sh3; } } -#ifdef GDB_TARGET_IS_H8300 if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300) { - if (h8300smode) - wanted = want_h8300s; - else - wanted = want_h8300h; + wanted = want_h8300h; + realregs = 10; + switch (TARGET_ARCHITECTURE->mach) + { + case bfd_mach_h8300s: + case bfd_mach_h8300sn: + case bfd_mach_h8300sx: + case bfd_mach_h8300sxn: + wanted = want_h8300s; + realregs = 11; + } } -#endif fetch_regs_from_dump (gch, wanted); /* And supply the extra ones the simulator uses */ - for (regno = NUM_REALREGS; regno < NUM_REGS; regno++) + for (regno = realregs; regno < NUM_REGS; regno++) { int buf = 0; - supply_register (regno, (char *) (&buf)); + regcache_raw_supply (current_regcache, regno, (char *) (&buf)); } } @@ -945,8 +950,18 @@ static void e7000_store_registers (void) { int regno; + int realregs = 0; - for (regno = 0; regno < NUM_REALREGS; regno++) + if (TARGET_ARCHITECTURE->arch == bfd_arch_sh) + realregs = 59; + if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300) { + realregs = ((TARGET_ARCHITECTURE->mach == bfd_mach_h8300s || + TARGET_ARCHITECTURE->mach == bfd_mach_h8300sn || + TARGET_ARCHITECTURE->mach == bfd_mach_h8300sx || + TARGET_ARCHITECTURE->mach == bfd_mach_h8300sxn) ? 11 : 10); + } + + for (regno = 0; regno < realregs; regno++) e7000_store_register (regno); registers_changed (); @@ -1081,15 +1096,15 @@ write_small (CORE_ADDR memaddr, unsigned char *myaddr, int len) if (((memaddr + i) & 3) == 0 && (i + 3 < len)) { /* Can be done with a long word */ - sprintf (buf, "m %lx %x%02x%02x%02x;l\r", - memaddr + i, + sprintf (buf, "m %s %x%02x%02x%02x;l\r", + paddr_nz (memaddr + i), myaddr[i], myaddr[i + 1], myaddr[i + 2], myaddr[i + 3]); puts_e7000debug (buf); i += 3; } else { - sprintf (buf, "m %lx %x\r", memaddr + i, myaddr[i]); + sprintf (buf, "m %s %x\r", paddr_nz (memaddr + i), myaddr[i]); puts_e7000debug (buf); } } @@ -1180,7 +1195,7 @@ write_large (CORE_ADDR memaddr, unsigned char *myaddr, int len) { /* Hmm, it's trying to tell us something */ expect (":"); - error ("Error writing memory"); + error (_("Error writing memory")); } else { @@ -1242,7 +1257,7 @@ e7000_read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) return 0; } - sprintf (buf, "m %lx;l\r", memaddr); + sprintf (buf, "m %s;l\r", paddr_nz (memaddr)); puts_e7000debug (buf); for (count = 0; count < len; count += 4) @@ -1321,7 +1336,7 @@ e7000_read_inferior_memory_large (CORE_ADDR memaddr, unsigned char *myaddr, return 0; } - sprintf (buf, "d %lx %lx\r", memaddr, memaddr + len - 1); + sprintf (buf, "d %s %s\r", paddr_nz (memaddr), paddr_nz (memaddr + len - 1)); puts_e7000debug (buf); count = 0; @@ -1389,7 +1404,7 @@ fast_but_for_the_pause_e7000_read_inferior_memory (CORE_ADDR memaddr, if (c != ENQ) { /* Got an error */ - error ("Memory read error"); + error (_("Memory read error")); } putchar_e7000 (ACK); expect ("SV s"); @@ -1463,10 +1478,9 @@ fast_but_for_the_pause_e7000_read_inferior_memory (CORE_ADDR memaddr, Returns the number of bytes transferred. */ static int -e7000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, - int len, int write, - struct mem_attrib *attrib ATTRIBUTE_UNUSED, - struct target_ops *target ATTRIBUTE_UNUSED) +e7000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, + int write, struct mem_attrib *attrib, + struct target_ops *target) { if (write) return e7000_write_inferior_memory (memaddr, myaddr, len); @@ -1536,7 +1550,7 @@ e7000_load (char *args, int from_tty) else if (strncmp (arg, "-nostart", strlen (arg)) == 0) nostart = 1; else - error ("unknown option `%s'", arg); + error (_("unknown option `%s'"), arg); } if (!filename) @@ -1551,7 +1565,7 @@ e7000_load (char *args, int from_tty) old_chain = make_cleanup_bfd_close (pbfd); if (!bfd_check_format (pbfd, bfd_object)) - error ("\"%s\" is not an object file: %s", filename, + error (_("\"%s\" is not an object file: %s"), filename, bfd_errmsg (bfd_get_error ())); start_time = time (NULL); @@ -1570,7 +1584,7 @@ e7000_load (char *args, int from_tty) file_ptr fptr; section_address = bfd_get_section_vma (pbfd, section); - section_size = bfd_get_section_size_before_reloc (section); + section_size = bfd_get_section_size (section); if (!quiet) printf_filtered ("[Loading section %s at 0x%s (%s bytes)]\n", @@ -1688,7 +1702,7 @@ static CORE_ADDR breakaddr[MAX_BREAKPOINTS] = {0}; static int -e7000_insert_breakpoint (CORE_ADDR addr, char *shadow) +e7000_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow) { int i; char buf[200]; @@ -1704,12 +1718,12 @@ e7000_insert_breakpoint (CORE_ADDR addr, char *shadow) #ifdef HARD_BREAKPOINTS if (BC_BREAKPOINTS) { - sprintf (buf, "BC%d A=%lx\r", i + 1, addr); + sprintf (buf, "BC%d A=%s\r", i + 1, paddr_nz (addr)); puts_e7000debug (buf); } else { - sprintf (buf, "B %lx\r", addr); + sprintf (buf, "B %s\r", paddr_nz (addr)); puts_e7000debug (buf); } #else @@ -1725,13 +1739,13 @@ e7000_insert_breakpoint (CORE_ADDR addr, char *shadow) return 0; } - error ("Too many breakpoints ( > %d) for the E7000\n", + error (_("Too many breakpoints ( > %d) for the E7000."), MAX_E7000DEBUG_BREAKPOINTS); return 1; } static int -e7000_remove_breakpoint (CORE_ADDR addr, char *shadow) +e7000_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow) { int i; char buf[200]; @@ -1748,12 +1762,12 @@ e7000_remove_breakpoint (CORE_ADDR addr, char *shadow) } else { - sprintf (buf, "B - %lx\r", addr); + sprintf (buf, "B - %s\r", paddr_nz (addr)); puts_e7000debug (buf); } expect_prompt (); #else - sprintf (buf, "B - %lx\r", addr); + sprintf (buf, "B - %s\r", paddr_nz (addr)); puts_e7000debug (buf); expect_prompt (); @@ -1765,8 +1779,8 @@ e7000_remove_breakpoint (CORE_ADDR addr, char *shadow) return 0; } - - warning ("Can't find breakpoint associated with 0x%lx\n", addr); + + warning (_("Can't find breakpoint associated with 0x%s."), paddr_nz (addr)); return 1; } @@ -1782,7 +1796,7 @@ e7000_command (char *args, int fromtty) echo = 0; if (!e7000_desc) - error ("e7000 target not open."); + error (_("e7000 target not open.")); if (!args) { puts_e7000debug ("\r"); @@ -1813,7 +1827,7 @@ e7000_drain_command (char *args, int fromtty) puts_e7000debug ("end\r"); putchar_e7000 (CTRLC); - while ((c = readchar (1) != -1)) + while ((c = readchar (1)) != -1) { if (quit_flag) { @@ -1874,7 +1888,7 @@ why_stop (void) /* Suck characters, if a string match, then return the strings index otherwise echo them. */ -int +static int expect_n (char **strings) { char *(ptr[10]); @@ -1965,9 +1979,9 @@ sub2_from_pc (void) char buf2[200]; store_signed_integer (buf, - REGISTER_RAW_SIZE (PC_REGNUM), + register_size (current_gdbarch, PC_REGNUM), read_register (PC_REGNUM) - 2); - supply_register (PC_REGNUM, buf); + regcache_raw_supply (current_regcache, PC_REGNUM, buf); sprintf (buf2, ".PC %s\r", phex_nz (read_register (PC_REGNUM), 0)); puts_e7000debug (buf2); } @@ -1998,6 +2012,7 @@ e7000_wait (ptid_t ptid, struct target_waitstatus *status) int had_sleep = 0; int loop = 1; char *wanted_nopc = NULL; + int realregs = 0; /* Then echo chars until PC= string seen */ gch (); /* Drop cr */ @@ -2039,6 +2054,7 @@ e7000_wait (ptid_t ptid, struct target_waitstatus *status) if (TARGET_ARCHITECTURE->arch == bfd_arch_sh) { wanted_nopc = want_nopc_sh; + realregs = 59; switch (TARGET_ARCHITECTURE->mach) { case bfd_mach_sh3: @@ -2047,22 +2063,27 @@ e7000_wait (ptid_t ptid, struct target_waitstatus *status) 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; + wanted_nopc = want_nopc_h8300h; + realregs = 10; + switch (TARGET_ARCHITECTURE->mach) + { + case bfd_mach_h8300s: + case bfd_mach_h8300sn: + case bfd_mach_h8300sx: + case bfd_mach_h8300sxn: + wanted_nopc = want_nopc_h8300s; + realregs = 11; + } } -#endif fetch_regs_from_dump (gch, wanted_nopc); /* And supply the extra ones the simulator uses */ - for (regno = NUM_REALREGS; regno < NUM_REGS; regno++) + for (regno = realregs; regno < NUM_REGS; regno++) { int buf = 0; - supply_register (regno, (char *) &buf); + regcache_raw_supply (current_regcache, regno, (char *) &buf); } stop_reason = why_stop (); @@ -2109,7 +2130,7 @@ e7000_wait (ptid_t ptid, struct target_waitstatus *status) break; default: /* Get the user's attention - this should never happen. */ - internal_error (__FILE__, __LINE__, "failed internal consistency check"); + internal_error (__FILE__, __LINE__, _("failed internal consistency check")); } return inferior_ptid; @@ -2132,8 +2153,8 @@ static void init_e7000_ops (void) { 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\ + e7000_ops.to_longname = "Remote Renesas e7000 target"; + e7000_ops.to_doc = "Use a remote Renesas 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\ @@ -2142,65 +2163,32 @@ target e7000 /dev/ttya 9600\n\ target e7000 foobar"; e7000_ops.to_open = e7000_open; e7000_ops.to_close = e7000_close; - e7000_ops.to_attach = 0; - e7000_ops.to_post_attach = NULL; - e7000_ops.to_require_attach = NULL; e7000_ops.to_detach = e7000_detach; - e7000_ops.to_require_detach = NULL; e7000_ops.to_resume = e7000_resume; e7000_ops.to_wait = e7000_wait; - e7000_ops.to_post_wait = NULL; 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.deprecated_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_post_startup_inferior = NULL; - e7000_ops.to_acknowledge_created_inferior = NULL; - e7000_ops.to_clone_and_follow_inferior = NULL; - e7000_ops.to_post_follow_inferior_by_clone = NULL; - e7000_ops.to_insert_fork_catchpoint = NULL; - e7000_ops.to_remove_fork_catchpoint = NULL; - e7000_ops.to_insert_vfork_catchpoint = NULL; - e7000_ops.to_remove_vfork_catchpoint = NULL; - e7000_ops.to_has_forked = NULL; - e7000_ops.to_has_vforked = NULL; - e7000_ops.to_can_follow_vfork_prior_to_exec = NULL; - e7000_ops.to_post_follow_vfork = NULL; - e7000_ops.to_insert_exec_catchpoint = NULL; - e7000_ops.to_remove_exec_catchpoint = NULL; - e7000_ops.to_has_execd = NULL; - e7000_ops.to_reported_exec_events_per_exec_call = NULL; - e7000_ops.to_has_exited = NULL; 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_pid_to_exec_file = NULL; 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; }; +extern initialize_file_ftype _initialize_remote_e7000; /* -Wmissing-prototypes */ + void _initialize_remote_e7000 (void) { @@ -2208,19 +2196,22 @@ _initialize_remote_e7000 (void) add_target (&e7000_ops); add_com ("e7000", class_obscure, e7000_command, - "Send a command to the e7000 monitor."); + _("Send a command to the e7000 monitor.")); add_com ("ftplogin", class_obscure, e7000_login_command, - "Login to machine and change to directory."); + _("Login to machine and change to directory.")); add_com ("ftpload", class_obscure, e7000_ftp_command, - "Fetch and load a file from previously described place."); + _("Fetch and load a file from previously described place.")); add_com ("drain", class_obscure, e7000_drain_command, - "Drain pending e7000 text buffers."); - - add_show_from_set (add_set_cmd ("usehardbreakpoints", no_class, - var_integer, (char *) &use_hard_breakpoints, - "Set use of hardware breakpoints for all breakpoints.\n", &setlist), - &showlist); + _("Drain pending e7000 text buffers.")); + + add_setshow_integer_cmd ("usehardbreakpoints", no_class, + &use_hard_breakpoints, _("\ +Set use of hardware breakpoints for all breakpoints."), _("\ +Show use of hardware breakpoints for all breakpoints."), NULL, + NULL, + NULL, /* FIXME: i18n: */ + &setlist, &showlist); }