summaryrefslogtreecommitdiff
path: root/gdb/m32r-rom.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-02-04 23:26:43 +0000
committerAndrew Cagney <cagney@redhat.com>2003-02-04 23:26:43 +0000
commitc20ef709c57de74d5f7955d173d9a67ebdea5c50 (patch)
tree5f5b6136ba3c6b5b2d4ecc92059d2589e061f51c /gdb/m32r-rom.c
parent65d22babac4a5f9f7eaa8aad98924a12eab6aef8 (diff)
downloadgdb-c20ef709c57de74d5f7955d173d9a67ebdea5c50.tar.gz
2003-02-04 Andrew Cagney <ac131313@redhat.com>
* NEWS: Note that the m32r-*-elf* is obsolete. * monitor.c (monitor_expect): Obsolete reference to m32r. * configure.tgt: Mark m32r-*-elf* as obsolete. * MAINTAINERS: Mark m32k as obsolete. * m32r-rom.c: Obsolete file. * config/m32r/m32r.mt: Obsolete file. * config/m32r/tm-m32r.h: Obsolete file. * m32r-stub.c: Obsolete file. * m32r-tdep.c: Obsolete file.
Diffstat (limited to 'gdb/m32r-rom.c')
-rw-r--r--gdb/m32r-rom.c1252
1 files changed, 626 insertions, 626 deletions
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index b4bfefdf210..f8ac1542409 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -1,626 +1,626 @@
-/* Remote debugging interface to m32r and mon2000 ROM monitors for GDB,
- the GNU debugger.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
-
- Adapted by Michael Snyder of Cygnus Support.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* This module defines communication with the Mitsubishi m32r monitor */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "monitor.h"
-#include "serial.h"
-#include "symtab.h"
-#include "command.h"
-#include "gdbcmd.h"
-#include "symfile.h" /* for generic load */
-#include <time.h> /* for time_t */
-#include "gdb_string.h"
-#include "objfiles.h" /* for ALL_OBJFILES etc. */
-#include "inferior.h" /* for write_pc() */
-#include <ctype.h>
-#include "regcache.h"
-
-extern void report_transfer_performance (unsigned long, time_t, time_t);
-
-/*
- * All this stuff just to get my host computer's IP address!
- */
-#include <sys/types.h>
-#include <netdb.h> /* for hostent */
-#include <netinet/in.h> /* for struct in_addr */
-#if 1
-#include <arpa/inet.h> /* for inet_ntoa */
-#endif
-
-static char *board_addr; /* user-settable IP address for M32R-EVA */
-static char *server_addr; /* user-settable IP address for gdb host */
-static char *download_path; /* user-settable path for SREC files */
-
-
-/*
- * Function: m32r_load_1 (helper function)
- */
-
-static void
-m32r_load_section (bfd *abfd, asection *s, void *obj)
-{
- unsigned int *data_count = obj;
- if (s->flags & SEC_LOAD)
- {
- bfd_size_type section_size = bfd_section_size (abfd, s);
- bfd_vma section_base = bfd_section_lma (abfd, s);
- unsigned int buffer, i;
-
- *data_count += section_size;
-
- printf_filtered ("Loading section %s, size 0x%lx lma ",
- bfd_section_name (abfd, s), section_size);
- print_address_numeric (section_base, 1, gdb_stdout);
- printf_filtered ("\n");
- gdb_flush (gdb_stdout);
- monitor_printf ("%s mw\r", paddr_nz (section_base));
- for (i = 0; i < section_size; i += 4)
- {
- QUIT;
- monitor_expect (" -> ", NULL, 0);
- bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
- monitor_printf ("%x\n", buffer);
- }
- monitor_expect (" -> ", NULL, 0);
- monitor_printf ("q\n");
- monitor_expect_prompt (NULL, 0);
- }
-}
-
-static int
-m32r_load_1 (void *dummy)
-{
- int data_count = 0;
-
- bfd_map_over_sections ((bfd *) dummy, m32r_load_section, &data_count);
- return data_count;
-}
-
-/*
- * Function: m32r_load (an alternate way to load)
- */
-
-static void
-m32r_load (char *filename, int from_tty)
-{
- bfd *abfd;
- asection *s;
- unsigned int i, data_count = 0;
- time_t start_time, end_time; /* for timing of download */
-
- if (filename == NULL || filename[0] == 0)
- filename = get_exec_file (1);
-
- abfd = bfd_openr (filename, 0);
- if (!abfd)
- error ("Unable to open file %s\n", filename);
- if (bfd_check_format (abfd, bfd_object) == 0)
- error ("File is not an object file\n");
- start_time = time (NULL);
-#if 0
- for (s = abfd->sections; s; s = s->next)
- if (s->flags & SEC_LOAD)
- {
- bfd_size_type section_size = bfd_section_size (abfd, s);
- bfd_vma section_base = bfd_section_vma (abfd, s);
- unsigned int buffer;
-
- data_count += section_size;
-
- printf_filtered ("Loading section %s, size 0x%lx vma ",
- bfd_section_name (abfd, s), section_size);
- print_address_numeric (section_base, 1, gdb_stdout);
- printf_filtered ("\n");
- gdb_flush (gdb_stdout);
- monitor_printf ("%x mw\r", section_base);
- for (i = 0; i < section_size; i += 4)
- {
- monitor_expect (" -> ", NULL, 0);
- bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
- monitor_printf ("%x\n", buffer);
- }
- monitor_expect (" -> ", NULL, 0);
- monitor_printf ("q\n");
- monitor_expect_prompt (NULL, 0);
- }
-#else
- if (!(catch_errors (m32r_load_1, abfd, "Load aborted!\n", RETURN_MASK_ALL)))
- {
- monitor_printf ("q\n");
- return;
- }
-#endif
- end_time = time (NULL);
- printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
- report_transfer_performance (data_count, start_time, end_time);
-
- /* Finally, make the PC point at the start address */
- if (exec_bfd)
- write_pc (bfd_get_start_address (exec_bfd));
-
- inferior_ptid = null_ptid; /* No process now */
-
- /* This is necessary because many things were based on the PC at the
- time that we attached to the monitor, which is no longer valid
- now that we have loaded new code (and just changed the PC).
- Another way to do this might be to call normal_stop, except that
- the stack may not be valid, and things would get horribly
- confused... */
-
- clear_symtab_users ();
-}
-
-static void
-m32r_load_gen (char *filename, int from_tty)
-{
- generic_load (filename, from_tty);
-}
-
-static void m32r_open (char *args, int from_tty);
-static void mon2000_open (char *args, int from_tty);
-
-/* This array of registers needs to match the indexes used by GDB. The
- whole reason this exists is because the various ROM monitors use
- different names than GDB does, and don't support all the registers
- either. So, typing "info reg sp" becomes an "A7". */
-
-static char *m32r_regnames[] =
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
-};
-
-static void
-m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
-{
- int regno;
- int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
-
- for (regno = 0; regno < num_regs; regno++)
- if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0)
- break;
-
- if (regno >= num_regs)
- return; /* no match */
-
- if (regno == ACCL_REGNUM)
- { /* special handling for 64-bit acc reg */
- monitor_supply_register (ACCH_REGNUM, val);
- val = strchr (val, ':'); /* skip past ':' to get 2nd word */
- if (val != NULL)
- monitor_supply_register (ACCL_REGNUM, val + 1);
- }
- else
- {
- monitor_supply_register (regno, val);
- if (regno == PSW_REGNUM)
- {
- unsigned long psw = strtoul (val, NULL, 16);
- char *zero = "00000000", *one = "00000001";
-
-#ifdef SM_REGNUM
- /* Stack mode bit */
- monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
-#endif
-#ifdef BSM_REGNUM
- /* Backup stack mode bit */
- monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
-#endif
-#ifdef IE_REGNUM
- /* Interrupt enable bit */
- monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
-#endif
-#ifdef BIE_REGNUM
- /* Backup interrupt enable bit */
- monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
-#endif
-#ifdef COND_REGNUM
- /* Condition bit (carry etc.) */
- monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
-#endif
-#ifdef CBR_REGNUM
- monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
-#endif
-#ifdef BPC_REGNUM
- monitor_supply_register (BPC_REGNUM, zero); /* KLUDGE: (???????) */
-#endif
-#ifdef BCARRY_REGNUM
- monitor_supply_register (BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
-#endif
- }
-
- if (regno == SPI_REGNUM || regno == SPU_REGNUM)
- { /* special handling for stack pointer (spu or spi) */
- unsigned long stackmode = read_register (PSW_REGNUM) & 0x80;
-
- if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
- monitor_supply_register (SP_REGNUM, val);
- else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
- monitor_supply_register (SP_REGNUM, val);
- }
- }
-}
-
-/* m32r RevC board monitor */
-
-static struct target_ops m32r_ops;
-
-static char *m32r_inits[] =
-{"\r", NULL};
-
-static struct monitor_ops m32r_cmds;
-
-static void
-init_m32r_cmds (void)
-{
- m32r_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
- m32r_cmds.init = m32r_inits; /* Init strings */
- m32r_cmds.cont = "go\r"; /* continue command */
- m32r_cmds.step = "step\r"; /* single step */
- m32r_cmds.stop = NULL; /* interrupt command */
- m32r_cmds.set_break = "%x +bp\r"; /* set a breakpoint */
- m32r_cmds.clr_break = "%x -bp\r"; /* clear a breakpoint */
- m32r_cmds.clr_all_break = "bpoff\r"; /* clear all breakpoints */
- m32r_cmds.fill = "%x %x %x fill\r"; /* fill (start length val) */
- m32r_cmds.setmem.cmdb = "%x 1 %x fill\r"; /* setmem.cmdb (addr, value) */
- m32r_cmds.setmem.cmdw = "%x 1 %x fillh\r"; /* setmem.cmdw (addr, value) */
- m32r_cmds.setmem.cmdl = "%x 1 %x fillw\r"; /* setmem.cmdl (addr, value) */
- m32r_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
- m32r_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
- m32r_cmds.setmem.term = NULL; /* setmem.term */
- m32r_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
- m32r_cmds.getmem.cmdb = "%x %x dump\r"; /* getmem.cmdb (addr, len) */
- m32r_cmds.getmem.cmdw = NULL; /* getmem.cmdw (addr, len) */
- m32r_cmds.getmem.cmdl = NULL; /* getmem.cmdl (addr, len) */
- m32r_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
- m32r_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
- m32r_cmds.getmem.term = NULL; /* getmem.term */
- m32r_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
- m32r_cmds.setreg.cmd = "%x to %%%s\r"; /* setreg.cmd (name, value) */
- m32r_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
- m32r_cmds.setreg.term = NULL; /* setreg.term */
- m32r_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
- m32r_cmds.getreg.cmd = NULL; /* getreg.cmd (name) */
- m32r_cmds.getreg.resp_delim = NULL; /* getreg.resp_delim */
- m32r_cmds.getreg.term = NULL; /* getreg.term */
- m32r_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
- m32r_cmds.dump_registers = ".reg\r"; /* dump_registers */
- m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
- m32r_cmds.supply_register = m32r_supply_register; /* supply_register */
- m32r_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
- m32r_cmds.load = NULL; /* download command */
- m32r_cmds.loadresp = NULL; /* load response */
- m32r_cmds.prompt = "ok "; /* monitor command prompt */
- m32r_cmds.line_term = "\r"; /* end-of-line terminator */
- m32r_cmds.cmd_end = NULL; /* optional command terminator */
- m32r_cmds.target = &m32r_ops; /* target operations */
- m32r_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
- m32r_cmds.regnames = m32r_regnames; /* registers names */
- m32r_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
-} /* init_m32r_cmds */
-
-static void
-m32r_open (char *args, int from_tty)
-{
- monitor_open (args, &m32r_cmds, from_tty);
-}
-
-/* Mon2000 monitor (MSA2000 board) */
-
-static struct target_ops mon2000_ops;
-static struct monitor_ops mon2000_cmds;
-
-static void
-init_mon2000_cmds (void)
-{
- mon2000_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
- mon2000_cmds.init = m32r_inits; /* Init strings */
- mon2000_cmds.cont = "go\r"; /* continue command */
- mon2000_cmds.step = "step\r"; /* single step */
- mon2000_cmds.stop = NULL; /* interrupt command */
- mon2000_cmds.set_break = "%x +bp\r"; /* set a breakpoint */
- mon2000_cmds.clr_break = "%x -bp\r"; /* clear a breakpoint */
- mon2000_cmds.clr_all_break = "bpoff\r"; /* clear all breakpoints */
- mon2000_cmds.fill = "%x %x %x fill\r"; /* fill (start length val) */
- mon2000_cmds.setmem.cmdb = "%x 1 %x fill\r"; /* setmem.cmdb (addr, value) */
- mon2000_cmds.setmem.cmdw = "%x 1 %x fillh\r"; /* setmem.cmdw (addr, value) */
- mon2000_cmds.setmem.cmdl = "%x 1 %x fillw\r"; /* setmem.cmdl (addr, value) */
- mon2000_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
- mon2000_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
- mon2000_cmds.setmem.term = NULL; /* setmem.term */
- mon2000_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
- mon2000_cmds.getmem.cmdb = "%x %x dump\r"; /* getmem.cmdb (addr, len) */
- mon2000_cmds.getmem.cmdw = NULL; /* getmem.cmdw (addr, len) */
- mon2000_cmds.getmem.cmdl = NULL; /* getmem.cmdl (addr, len) */
- mon2000_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
- mon2000_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
- mon2000_cmds.getmem.term = NULL; /* getmem.term */
- mon2000_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
- mon2000_cmds.setreg.cmd = "%x to %%%s\r"; /* setreg.cmd (name, value) */
- mon2000_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
- mon2000_cmds.setreg.term = NULL; /* setreg.term */
- mon2000_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
- mon2000_cmds.getreg.cmd = NULL; /* getreg.cmd (name) */
- mon2000_cmds.getreg.resp_delim = NULL; /* getreg.resp_delim */
- mon2000_cmds.getreg.term = NULL; /* getreg.term */
- mon2000_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
- mon2000_cmds.dump_registers = ".reg\r"; /* dump_registers */
- mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
- mon2000_cmds.supply_register = m32r_supply_register; /* supply_register */
- mon2000_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
- mon2000_cmds.load = NULL; /* download command */
- mon2000_cmds.loadresp = NULL; /* load response */
- mon2000_cmds.prompt = "Mon2000>"; /* monitor command prompt */
- mon2000_cmds.line_term = "\r"; /* end-of-line terminator */
- mon2000_cmds.cmd_end = NULL; /* optional command terminator */
- mon2000_cmds.target = &mon2000_ops; /* target operations */
- mon2000_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
- mon2000_cmds.regnames = m32r_regnames; /* registers names */
- mon2000_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
-} /* init_mon2000_cmds */
-
-static void
-mon2000_open (char *args, int from_tty)
-{
- monitor_open (args, &mon2000_cmds, from_tty);
-}
-
-/* Function: set_board_address
- Tell the BootOne monitor what it's ethernet IP address is. */
-
-static void
-m32r_set_board_address (char *args, int from_tty)
-{
- int resp_len;
- char buf[1024];
-
- if (args && *args)
- {
- monitor_printf ("ulip %s\n", args);
- resp_len = monitor_expect_prompt (buf, sizeof (buf));
- /* now parse the result for success */
- }
- else
- error ("Requires argument (IP address for M32R-EVA board)");
-}
-
-/* Function: set_server_address
- Tell the BootOne monitor what gdb's ethernet IP address is. */
-
-static void
-m32r_set_server_address (char *args, int from_tty)
-{
- int resp_len;
- char buf[1024];
-
- if (args && *args)
- {
- monitor_printf ("uhip %s\n", args);
- resp_len = monitor_expect_prompt (buf, sizeof (buf));
- /* now parse the result for success */
- }
- else
- error ("Requires argument (IP address of GDB's host computer)");
-}
-
-/* Function: set_download_path
- Tell the BootOne monitor the default path for downloadable SREC files. */
-
-static void
-m32r_set_download_path (char *args, int from_tty)
-{
- int resp_len;
- char buf[1024];
-
- if (args && *args)
- {
- monitor_printf ("up %s\n", args);
- resp_len = monitor_expect_prompt (buf, sizeof (buf));
- /* now parse the result for success */
- }
- else
- error ("Requires argument (default path for downloadable SREC files)");
-}
-
-static void
-m32r_upload_command (char *args, int from_tty)
-{
- bfd *abfd;
- asection *s;
- time_t start_time, end_time; /* for timing of download */
- int resp_len, data_count = 0;
- char buf[1024];
- struct hostent *hostent;
- struct in_addr inet_addr;
-
- /* first check to see if there's an ethernet port! */
- monitor_printf ("ust\r");
- resp_len = monitor_expect_prompt (buf, sizeof (buf));
- if (!strchr (buf, ':'))
- error ("No ethernet connection!");
-
- if (board_addr == 0)
- {
- /* scan second colon in the output from the "ust" command */
- char *myIPaddress = strchr (strchr (buf, ':') + 1, ':') + 1;
-
- while (isspace (*myIPaddress))
- myIPaddress++;
-
- if (!strncmp (myIPaddress, "0.0.", 4)) /* empty */
- error ("Please use 'set board-address' to set the M32R-EVA board's IP address.");
- if (strchr (myIPaddress, '('))
- *(strchr (myIPaddress, '(')) = '\0'; /* delete trailing junk */
- board_addr = xstrdup (myIPaddress);
- }
- if (server_addr == 0)
- {
- buf[0] = 0;
- gethostname (buf, sizeof (buf));
- if (buf[0] != 0)
- hostent = gethostbyname (buf);
- if (hostent != 0)
- {
-#if 1
- memcpy (&inet_addr.s_addr, hostent->h_addr,
- sizeof (inet_addr.s_addr));
- server_addr = (char *) inet_ntoa (inet_addr);
-#else
- server_addr = (char *) inet_ntoa (hostent->h_addr);
-#endif
- }
- if (server_addr == 0) /* failed? */
- error ("Need to know gdb host computer's IP address (use 'set server-address')");
- }
-
- if (args == 0 || args[0] == 0) /* no args: upload the current file */
- args = get_exec_file (1);
-
- if (args[0] != '/' && download_path == 0)
- {
- if (current_directory)
- download_path = xstrdup (current_directory);
- else
- error ("Need to know default download path (use 'set download-path')");
- }
-
- start_time = time (NULL);
- monitor_printf ("uhip %s\r", server_addr);
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
- monitor_printf ("ulip %s\r", board_addr);
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
- if (args[0] != '/')
- monitor_printf ("up %s\r", download_path); /* use default path */
- else
- monitor_printf ("up\r"); /* rooted filename/path */
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
-
- if (strrchr (args, '.') && !strcmp (strrchr (args, '.'), ".srec"))
- monitor_printf ("ul %s\r", args);
- else /* add ".srec" suffix */
- monitor_printf ("ul %s.srec\r", args);
- resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
-
- if (buf[0] == 0 || strstr (buf, "complete") == 0)
- error ("Upload file not found: %s.srec\nCheck IP addresses and download path.", args);
- else
- printf_filtered (" -- Ethernet load complete.\n");
-
- end_time = time (NULL);
- abfd = bfd_openr (args, 0);
- if (abfd != NULL)
- { /* Download is done -- print section statistics */
- if (bfd_check_format (abfd, bfd_object) == 0)
- {
- printf_filtered ("File is not an object file\n");
- }
- for (s = abfd->sections; s; s = s->next)
- if (s->flags & SEC_LOAD)
- {
- bfd_size_type section_size = bfd_section_size (abfd, s);
- bfd_vma section_base = bfd_section_lma (abfd, s);
- unsigned int buffer;
-
- data_count += section_size;
-
- printf_filtered ("Loading section %s, size 0x%lx lma ",
- bfd_section_name (abfd, s), section_size);
- print_address_numeric (section_base, 1, gdb_stdout);
- printf_filtered ("\n");
- gdb_flush (gdb_stdout);
- }
- /* Finally, make the PC point at the start address */
- write_pc (bfd_get_start_address (abfd));
- report_transfer_performance (data_count, start_time, end_time);
- printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
- }
- inferior_ptid = null_ptid; /* No process now */
-
- /* This is necessary because many things were based on the PC at the
- time that we attached to the monitor, which is no longer valid
- now that we have loaded new code (and just changed the PC).
- Another way to do this might be to call normal_stop, except that
- the stack may not be valid, and things would get horribly
- confused... */
-
- clear_symtab_users ();
-}
-
-void
-_initialize_m32r_rom (void)
-{
- /* Initialize m32r RevC monitor target */
- init_m32r_cmds ();
- init_monitor_ops (&m32r_ops);
-
- m32r_ops.to_shortname = "m32r";
- m32r_ops.to_longname = "m32r monitor";
- m32r_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
- m32r_ops.to_doc = "Debug via the m32r monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
- m32r_ops.to_open = m32r_open;
- add_target (&m32r_ops);
-
- /* Initialize mon2000 monitor target */
- init_mon2000_cmds ();
- init_monitor_ops (&mon2000_ops);
-
- mon2000_ops.to_shortname = "mon2000";
- mon2000_ops.to_longname = "Mon2000 monitor";
- mon2000_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
- mon2000_ops.to_doc = "Debug via the Mon2000 monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
- mon2000_ops.to_open = mon2000_open;
- add_target (&mon2000_ops);
-
- add_show_from_set
- (add_set_cmd ("download-path", class_obscure, var_string,
- (char *) &download_path,
- "Set the default path for downloadable SREC files.",
- &setlist),
- &showlist);
-
- add_show_from_set
- (add_set_cmd ("board-address", class_obscure, var_string,
- (char *) &board_addr,
- "Set IP address for M32R-EVA target board.",
- &setlist),
- &showlist);
-
- add_show_from_set
- (add_set_cmd ("server-address", class_obscure, var_string,
- (char *) &server_addr,
- "Set IP address for download server (GDB's host computer).",
- &setlist),
- &showlist);
-
- add_com ("upload", class_obscure, m32r_upload_command,
- "Upload the srec file via the monitor's Ethernet upload capability.");
-
- add_com ("tload", class_obscure, m32r_load, "test upload command.");
-}
+// OBSOLETE /* Remote debugging interface to m32r and mon2000 ROM monitors for GDB,
+// OBSOLETE the GNU debugger.
+// OBSOLETE Copyright 1996, 1997, 1998, 1999, 2000, 2001
+// OBSOLETE Free Software Foundation, Inc.
+// OBSOLETE
+// OBSOLETE Adapted by Michael Snyder of Cygnus Support.
+// OBSOLETE
+// OBSOLETE This file is part of GDB.
+// OBSOLETE
+// OBSOLETE This program is free software; you can redistribute it and/or modify
+// OBSOLETE it under the terms of the GNU General Public License as published by
+// OBSOLETE the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE (at your option) any later version.
+// OBSOLETE
+// OBSOLETE This program is distributed in the hope that it will be useful,
+// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// OBSOLETE GNU General Public License for more details.
+// OBSOLETE
+// OBSOLETE You should have received a copy of the GNU General Public License
+// OBSOLETE along with this program; if not, write to the Free Software
+// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE Boston, MA 02111-1307, USA. */
+// OBSOLETE
+// OBSOLETE /* This module defines communication with the Mitsubishi m32r monitor */
+// OBSOLETE
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "monitor.h"
+// OBSOLETE #include "serial.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE #include "command.h"
+// OBSOLETE #include "gdbcmd.h"
+// OBSOLETE #include "symfile.h" /* for generic load */
+// OBSOLETE #include <time.h> /* for time_t */
+// OBSOLETE #include "gdb_string.h"
+// OBSOLETE #include "objfiles.h" /* for ALL_OBJFILES etc. */
+// OBSOLETE #include "inferior.h" /* for write_pc() */
+// OBSOLETE #include <ctype.h>
+// OBSOLETE #include "regcache.h"
+// OBSOLETE
+// OBSOLETE extern void report_transfer_performance (unsigned long, time_t, time_t);
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * All this stuff just to get my host computer's IP address!
+// OBSOLETE */
+// OBSOLETE #include <sys/types.h>
+// OBSOLETE #include <netdb.h> /* for hostent */
+// OBSOLETE #include <netinet/in.h> /* for struct in_addr */
+// OBSOLETE #if 1
+// OBSOLETE #include <arpa/inet.h> /* for inet_ntoa */
+// OBSOLETE #endif
+// OBSOLETE
+// OBSOLETE static char *board_addr; /* user-settable IP address for M32R-EVA */
+// OBSOLETE static char *server_addr; /* user-settable IP address for gdb host */
+// OBSOLETE static char *download_path; /* user-settable path for SREC files */
+// OBSOLETE
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Function: m32r_load_1 (helper function)
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_load_section (bfd *abfd, asection *s, void *obj)
+// OBSOLETE {
+// OBSOLETE unsigned int *data_count = obj;
+// OBSOLETE if (s->flags & SEC_LOAD)
+// OBSOLETE {
+// OBSOLETE bfd_size_type section_size = bfd_section_size (abfd, s);
+// OBSOLETE bfd_vma section_base = bfd_section_lma (abfd, s);
+// OBSOLETE unsigned int buffer, i;
+// OBSOLETE
+// OBSOLETE *data_count += section_size;
+// OBSOLETE
+// OBSOLETE printf_filtered ("Loading section %s, size 0x%lx lma ",
+// OBSOLETE bfd_section_name (abfd, s), section_size);
+// OBSOLETE print_address_numeric (section_base, 1, gdb_stdout);
+// OBSOLETE printf_filtered ("\n");
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE monitor_printf ("%s mw\r", paddr_nz (section_base));
+// OBSOLETE for (i = 0; i < section_size; i += 4)
+// OBSOLETE {
+// OBSOLETE QUIT;
+// OBSOLETE monitor_expect (" -> ", NULL, 0);
+// OBSOLETE bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
+// OBSOLETE monitor_printf ("%x\n", buffer);
+// OBSOLETE }
+// OBSOLETE monitor_expect (" -> ", NULL, 0);
+// OBSOLETE monitor_printf ("q\n");
+// OBSOLETE monitor_expect_prompt (NULL, 0);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static int
+// OBSOLETE m32r_load_1 (void *dummy)
+// OBSOLETE {
+// OBSOLETE int data_count = 0;
+// OBSOLETE
+// OBSOLETE bfd_map_over_sections ((bfd *) dummy, m32r_load_section, &data_count);
+// OBSOLETE return data_count;
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /*
+// OBSOLETE * Function: m32r_load (an alternate way to load)
+// OBSOLETE */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_load (char *filename, int from_tty)
+// OBSOLETE {
+// OBSOLETE bfd *abfd;
+// OBSOLETE asection *s;
+// OBSOLETE unsigned int i, data_count = 0;
+// OBSOLETE time_t start_time, end_time; /* for timing of download */
+// OBSOLETE
+// OBSOLETE if (filename == NULL || filename[0] == 0)
+// OBSOLETE filename = get_exec_file (1);
+// OBSOLETE
+// OBSOLETE abfd = bfd_openr (filename, 0);
+// OBSOLETE if (!abfd)
+// OBSOLETE error ("Unable to open file %s\n", filename);
+// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0)
+// OBSOLETE error ("File is not an object file\n");
+// OBSOLETE start_time = time (NULL);
+// OBSOLETE #if 0
+// OBSOLETE for (s = abfd->sections; s; s = s->next)
+// OBSOLETE if (s->flags & SEC_LOAD)
+// OBSOLETE {
+// OBSOLETE bfd_size_type section_size = bfd_section_size (abfd, s);
+// OBSOLETE bfd_vma section_base = bfd_section_vma (abfd, s);
+// OBSOLETE unsigned int buffer;
+// OBSOLETE
+// OBSOLETE data_count += section_size;
+// OBSOLETE
+// OBSOLETE printf_filtered ("Loading section %s, size 0x%lx vma ",
+// OBSOLETE bfd_section_name (abfd, s), section_size);
+// OBSOLETE print_address_numeric (section_base, 1, gdb_stdout);
+// OBSOLETE printf_filtered ("\n");
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE monitor_printf ("%x mw\r", section_base);
+// OBSOLETE for (i = 0; i < section_size; i += 4)
+// OBSOLETE {
+// OBSOLETE monitor_expect (" -> ", NULL, 0);
+// OBSOLETE bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
+// OBSOLETE monitor_printf ("%x\n", buffer);
+// OBSOLETE }
+// OBSOLETE monitor_expect (" -> ", NULL, 0);
+// OBSOLETE monitor_printf ("q\n");
+// OBSOLETE monitor_expect_prompt (NULL, 0);
+// OBSOLETE }
+// OBSOLETE #else
+// OBSOLETE if (!(catch_errors (m32r_load_1, abfd, "Load aborted!\n", RETURN_MASK_ALL)))
+// OBSOLETE {
+// OBSOLETE monitor_printf ("q\n");
+// OBSOLETE return;
+// OBSOLETE }
+// OBSOLETE #endif
+// OBSOLETE end_time = time (NULL);
+// OBSOLETE printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
+// OBSOLETE report_transfer_performance (data_count, start_time, end_time);
+// OBSOLETE
+// OBSOLETE /* Finally, make the PC point at the start address */
+// OBSOLETE if (exec_bfd)
+// OBSOLETE write_pc (bfd_get_start_address (exec_bfd));
+// OBSOLETE
+// OBSOLETE inferior_ptid = null_ptid; /* No process now */
+// OBSOLETE
+// OBSOLETE /* This is necessary because many things were based on the PC at the
+// OBSOLETE time that we attached to the monitor, which is no longer valid
+// OBSOLETE now that we have loaded new code (and just changed the PC).
+// OBSOLETE Another way to do this might be to call normal_stop, except that
+// OBSOLETE the stack may not be valid, and things would get horribly
+// OBSOLETE confused... */
+// OBSOLETE
+// OBSOLETE clear_symtab_users ();
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_load_gen (char *filename, int from_tty)
+// OBSOLETE {
+// OBSOLETE generic_load (filename, from_tty);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void m32r_open (char *args, int from_tty);
+// OBSOLETE static void mon2000_open (char *args, int from_tty);
+// OBSOLETE
+// OBSOLETE /* This array of registers needs to match the indexes used by GDB. The
+// OBSOLETE whole reason this exists is because the various ROM monitors use
+// OBSOLETE different names than GDB does, and don't support all the registers
+// OBSOLETE either. So, typing "info reg sp" becomes an "A7". */
+// OBSOLETE
+// OBSOLETE static char *m32r_regnames[] =
+// OBSOLETE {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+// OBSOLETE "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+// OBSOLETE "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
+// OBSOLETE };
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
+// OBSOLETE {
+// OBSOLETE int regno;
+// OBSOLETE int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
+// OBSOLETE
+// OBSOLETE for (regno = 0; regno < num_regs; regno++)
+// OBSOLETE if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0)
+// OBSOLETE break;
+// OBSOLETE
+// OBSOLETE if (regno >= num_regs)
+// OBSOLETE return; /* no match */
+// OBSOLETE
+// OBSOLETE if (regno == ACCL_REGNUM)
+// OBSOLETE { /* special handling for 64-bit acc reg */
+// OBSOLETE monitor_supply_register (ACCH_REGNUM, val);
+// OBSOLETE val = strchr (val, ':'); /* skip past ':' to get 2nd word */
+// OBSOLETE if (val != NULL)
+// OBSOLETE monitor_supply_register (ACCL_REGNUM, val + 1);
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE {
+// OBSOLETE monitor_supply_register (regno, val);
+// OBSOLETE if (regno == PSW_REGNUM)
+// OBSOLETE {
+// OBSOLETE unsigned long psw = strtoul (val, NULL, 16);
+// OBSOLETE char *zero = "00000000", *one = "00000001";
+// OBSOLETE
+// OBSOLETE #ifdef SM_REGNUM
+// OBSOLETE /* Stack mode bit */
+// OBSOLETE monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef BSM_REGNUM
+// OBSOLETE /* Backup stack mode bit */
+// OBSOLETE monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef IE_REGNUM
+// OBSOLETE /* Interrupt enable bit */
+// OBSOLETE monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef BIE_REGNUM
+// OBSOLETE /* Backup interrupt enable bit */
+// OBSOLETE monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef COND_REGNUM
+// OBSOLETE /* Condition bit (carry etc.) */
+// OBSOLETE monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef CBR_REGNUM
+// OBSOLETE monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef BPC_REGNUM
+// OBSOLETE monitor_supply_register (BPC_REGNUM, zero); /* KLUDGE: (???????) */
+// OBSOLETE #endif
+// OBSOLETE #ifdef BCARRY_REGNUM
+// OBSOLETE monitor_supply_register (BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
+// OBSOLETE #endif
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (regno == SPI_REGNUM || regno == SPU_REGNUM)
+// OBSOLETE { /* special handling for stack pointer (spu or spi) */
+// OBSOLETE unsigned long stackmode = read_register (PSW_REGNUM) & 0x80;
+// OBSOLETE
+// OBSOLETE if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
+// OBSOLETE monitor_supply_register (SP_REGNUM, val);
+// OBSOLETE else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
+// OBSOLETE monitor_supply_register (SP_REGNUM, val);
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* m32r RevC board monitor */
+// OBSOLETE
+// OBSOLETE static struct target_ops m32r_ops;
+// OBSOLETE
+// OBSOLETE static char *m32r_inits[] =
+// OBSOLETE {"\r", NULL};
+// OBSOLETE
+// OBSOLETE static struct monitor_ops m32r_cmds;
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE init_m32r_cmds (void)
+// OBSOLETE {
+// OBSOLETE m32r_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
+// OBSOLETE m32r_cmds.init = m32r_inits; /* Init strings */
+// OBSOLETE m32r_cmds.cont = "go\r"; /* continue command */
+// OBSOLETE m32r_cmds.step = "step\r"; /* single step */
+// OBSOLETE m32r_cmds.stop = NULL; /* interrupt command */
+// OBSOLETE m32r_cmds.set_break = "%x +bp\r"; /* set a breakpoint */
+// OBSOLETE m32r_cmds.clr_break = "%x -bp\r"; /* clear a breakpoint */
+// OBSOLETE m32r_cmds.clr_all_break = "bpoff\r"; /* clear all breakpoints */
+// OBSOLETE m32r_cmds.fill = "%x %x %x fill\r"; /* fill (start length val) */
+// OBSOLETE m32r_cmds.setmem.cmdb = "%x 1 %x fill\r"; /* setmem.cmdb (addr, value) */
+// OBSOLETE m32r_cmds.setmem.cmdw = "%x 1 %x fillh\r"; /* setmem.cmdw (addr, value) */
+// OBSOLETE m32r_cmds.setmem.cmdl = "%x 1 %x fillw\r"; /* setmem.cmdl (addr, value) */
+// OBSOLETE m32r_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
+// OBSOLETE m32r_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
+// OBSOLETE m32r_cmds.setmem.term = NULL; /* setmem.term */
+// OBSOLETE m32r_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
+// OBSOLETE m32r_cmds.getmem.cmdb = "%x %x dump\r"; /* getmem.cmdb (addr, len) */
+// OBSOLETE m32r_cmds.getmem.cmdw = NULL; /* getmem.cmdw (addr, len) */
+// OBSOLETE m32r_cmds.getmem.cmdl = NULL; /* getmem.cmdl (addr, len) */
+// OBSOLETE m32r_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
+// OBSOLETE m32r_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
+// OBSOLETE m32r_cmds.getmem.term = NULL; /* getmem.term */
+// OBSOLETE m32r_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
+// OBSOLETE m32r_cmds.setreg.cmd = "%x to %%%s\r"; /* setreg.cmd (name, value) */
+// OBSOLETE m32r_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
+// OBSOLETE m32r_cmds.setreg.term = NULL; /* setreg.term */
+// OBSOLETE m32r_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
+// OBSOLETE m32r_cmds.getreg.cmd = NULL; /* getreg.cmd (name) */
+// OBSOLETE m32r_cmds.getreg.resp_delim = NULL; /* getreg.resp_delim */
+// OBSOLETE m32r_cmds.getreg.term = NULL; /* getreg.term */
+// OBSOLETE m32r_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
+// OBSOLETE m32r_cmds.dump_registers = ".reg\r"; /* dump_registers */
+// OBSOLETE m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
+// OBSOLETE m32r_cmds.supply_register = m32r_supply_register; /* supply_register */
+// OBSOLETE m32r_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
+// OBSOLETE m32r_cmds.load = NULL; /* download command */
+// OBSOLETE m32r_cmds.loadresp = NULL; /* load response */
+// OBSOLETE m32r_cmds.prompt = "ok "; /* monitor command prompt */
+// OBSOLETE m32r_cmds.line_term = "\r"; /* end-of-line terminator */
+// OBSOLETE m32r_cmds.cmd_end = NULL; /* optional command terminator */
+// OBSOLETE m32r_cmds.target = &m32r_ops; /* target operations */
+// OBSOLETE m32r_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
+// OBSOLETE m32r_cmds.regnames = m32r_regnames; /* registers names */
+// OBSOLETE m32r_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
+// OBSOLETE } /* init_m32r_cmds */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_open (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE monitor_open (args, &m32r_cmds, from_tty);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Mon2000 monitor (MSA2000 board) */
+// OBSOLETE
+// OBSOLETE static struct target_ops mon2000_ops;
+// OBSOLETE static struct monitor_ops mon2000_cmds;
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE init_mon2000_cmds (void)
+// OBSOLETE {
+// OBSOLETE mon2000_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
+// OBSOLETE mon2000_cmds.init = m32r_inits; /* Init strings */
+// OBSOLETE mon2000_cmds.cont = "go\r"; /* continue command */
+// OBSOLETE mon2000_cmds.step = "step\r"; /* single step */
+// OBSOLETE mon2000_cmds.stop = NULL; /* interrupt command */
+// OBSOLETE mon2000_cmds.set_break = "%x +bp\r"; /* set a breakpoint */
+// OBSOLETE mon2000_cmds.clr_break = "%x -bp\r"; /* clear a breakpoint */
+// OBSOLETE mon2000_cmds.clr_all_break = "bpoff\r"; /* clear all breakpoints */
+// OBSOLETE mon2000_cmds.fill = "%x %x %x fill\r"; /* fill (start length val) */
+// OBSOLETE mon2000_cmds.setmem.cmdb = "%x 1 %x fill\r"; /* setmem.cmdb (addr, value) */
+// OBSOLETE mon2000_cmds.setmem.cmdw = "%x 1 %x fillh\r"; /* setmem.cmdw (addr, value) */
+// OBSOLETE mon2000_cmds.setmem.cmdl = "%x 1 %x fillw\r"; /* setmem.cmdl (addr, value) */
+// OBSOLETE mon2000_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
+// OBSOLETE mon2000_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
+// OBSOLETE mon2000_cmds.setmem.term = NULL; /* setmem.term */
+// OBSOLETE mon2000_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
+// OBSOLETE mon2000_cmds.getmem.cmdb = "%x %x dump\r"; /* getmem.cmdb (addr, len) */
+// OBSOLETE mon2000_cmds.getmem.cmdw = NULL; /* getmem.cmdw (addr, len) */
+// OBSOLETE mon2000_cmds.getmem.cmdl = NULL; /* getmem.cmdl (addr, len) */
+// OBSOLETE mon2000_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
+// OBSOLETE mon2000_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
+// OBSOLETE mon2000_cmds.getmem.term = NULL; /* getmem.term */
+// OBSOLETE mon2000_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
+// OBSOLETE mon2000_cmds.setreg.cmd = "%x to %%%s\r"; /* setreg.cmd (name, value) */
+// OBSOLETE mon2000_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
+// OBSOLETE mon2000_cmds.setreg.term = NULL; /* setreg.term */
+// OBSOLETE mon2000_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
+// OBSOLETE mon2000_cmds.getreg.cmd = NULL; /* getreg.cmd (name) */
+// OBSOLETE mon2000_cmds.getreg.resp_delim = NULL; /* getreg.resp_delim */
+// OBSOLETE mon2000_cmds.getreg.term = NULL; /* getreg.term */
+// OBSOLETE mon2000_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
+// OBSOLETE mon2000_cmds.dump_registers = ".reg\r"; /* dump_registers */
+// OBSOLETE mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
+// OBSOLETE mon2000_cmds.supply_register = m32r_supply_register; /* supply_register */
+// OBSOLETE mon2000_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
+// OBSOLETE mon2000_cmds.load = NULL; /* download command */
+// OBSOLETE mon2000_cmds.loadresp = NULL; /* load response */
+// OBSOLETE mon2000_cmds.prompt = "Mon2000>"; /* monitor command prompt */
+// OBSOLETE mon2000_cmds.line_term = "\r"; /* end-of-line terminator */
+// OBSOLETE mon2000_cmds.cmd_end = NULL; /* optional command terminator */
+// OBSOLETE mon2000_cmds.target = &mon2000_ops; /* target operations */
+// OBSOLETE mon2000_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
+// OBSOLETE mon2000_cmds.regnames = m32r_regnames; /* registers names */
+// OBSOLETE mon2000_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
+// OBSOLETE } /* init_mon2000_cmds */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE mon2000_open (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE monitor_open (args, &mon2000_cmds, from_tty);
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Function: set_board_address
+// OBSOLETE Tell the BootOne monitor what it's ethernet IP address is. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_set_board_address (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int resp_len;
+// OBSOLETE char buf[1024];
+// OBSOLETE
+// OBSOLETE if (args && *args)
+// OBSOLETE {
+// OBSOLETE monitor_printf ("ulip %s\n", args);
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE /* now parse the result for success */
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE error ("Requires argument (IP address for M32R-EVA board)");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Function: set_server_address
+// OBSOLETE Tell the BootOne monitor what gdb's ethernet IP address is. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_set_server_address (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int resp_len;
+// OBSOLETE char buf[1024];
+// OBSOLETE
+// OBSOLETE if (args && *args)
+// OBSOLETE {
+// OBSOLETE monitor_printf ("uhip %s\n", args);
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE /* now parse the result for success */
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE error ("Requires argument (IP address of GDB's host computer)");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE /* Function: set_download_path
+// OBSOLETE Tell the BootOne monitor the default path for downloadable SREC files. */
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_set_download_path (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE int resp_len;
+// OBSOLETE char buf[1024];
+// OBSOLETE
+// OBSOLETE if (args && *args)
+// OBSOLETE {
+// OBSOLETE monitor_printf ("up %s\n", args);
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE /* now parse the result for success */
+// OBSOLETE }
+// OBSOLETE else
+// OBSOLETE error ("Requires argument (default path for downloadable SREC files)");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE static void
+// OBSOLETE m32r_upload_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE bfd *abfd;
+// OBSOLETE asection *s;
+// OBSOLETE time_t start_time, end_time; /* for timing of download */
+// OBSOLETE int resp_len, data_count = 0;
+// OBSOLETE char buf[1024];
+// OBSOLETE struct hostent *hostent;
+// OBSOLETE struct in_addr inet_addr;
+// OBSOLETE
+// OBSOLETE /* first check to see if there's an ethernet port! */
+// OBSOLETE monitor_printf ("ust\r");
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE if (!strchr (buf, ':'))
+// OBSOLETE error ("No ethernet connection!");
+// OBSOLETE
+// OBSOLETE if (board_addr == 0)
+// OBSOLETE {
+// OBSOLETE /* scan second colon in the output from the "ust" command */
+// OBSOLETE char *myIPaddress = strchr (strchr (buf, ':') + 1, ':') + 1;
+// OBSOLETE
+// OBSOLETE while (isspace (*myIPaddress))
+// OBSOLETE myIPaddress++;
+// OBSOLETE
+// OBSOLETE if (!strncmp (myIPaddress, "0.0.", 4)) /* empty */
+// OBSOLETE error ("Please use 'set board-address' to set the M32R-EVA board's IP address.");
+// OBSOLETE if (strchr (myIPaddress, '('))
+// OBSOLETE *(strchr (myIPaddress, '(')) = '\0'; /* delete trailing junk */
+// OBSOLETE board_addr = xstrdup (myIPaddress);
+// OBSOLETE }
+// OBSOLETE if (server_addr == 0)
+// OBSOLETE {
+// OBSOLETE buf[0] = 0;
+// OBSOLETE gethostname (buf, sizeof (buf));
+// OBSOLETE if (buf[0] != 0)
+// OBSOLETE hostent = gethostbyname (buf);
+// OBSOLETE if (hostent != 0)
+// OBSOLETE {
+// OBSOLETE #if 1
+// OBSOLETE memcpy (&inet_addr.s_addr, hostent->h_addr,
+// OBSOLETE sizeof (inet_addr.s_addr));
+// OBSOLETE server_addr = (char *) inet_ntoa (inet_addr);
+// OBSOLETE #else
+// OBSOLETE server_addr = (char *) inet_ntoa (hostent->h_addr);
+// OBSOLETE #endif
+// OBSOLETE }
+// OBSOLETE if (server_addr == 0) /* failed? */
+// OBSOLETE error ("Need to know gdb host computer's IP address (use 'set server-address')");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE if (args == 0 || args[0] == 0) /* no args: upload the current file */
+// OBSOLETE args = get_exec_file (1);
+// OBSOLETE
+// OBSOLETE if (args[0] != '/' && download_path == 0)
+// OBSOLETE {
+// OBSOLETE if (current_directory)
+// OBSOLETE download_path = xstrdup (current_directory);
+// OBSOLETE else
+// OBSOLETE error ("Need to know default download path (use 'set download-path')");
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE start_time = time (NULL);
+// OBSOLETE monitor_printf ("uhip %s\r", server_addr);
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+// OBSOLETE monitor_printf ("ulip %s\r", board_addr);
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+// OBSOLETE if (args[0] != '/')
+// OBSOLETE monitor_printf ("up %s\r", download_path); /* use default path */
+// OBSOLETE else
+// OBSOLETE monitor_printf ("up\r"); /* rooted filename/path */
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+// OBSOLETE
+// OBSOLETE if (strrchr (args, '.') && !strcmp (strrchr (args, '.'), ".srec"))
+// OBSOLETE monitor_printf ("ul %s\r", args);
+// OBSOLETE else /* add ".srec" suffix */
+// OBSOLETE monitor_printf ("ul %s.srec\r", args);
+// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
+// OBSOLETE
+// OBSOLETE if (buf[0] == 0 || strstr (buf, "complete") == 0)
+// OBSOLETE error ("Upload file not found: %s.srec\nCheck IP addresses and download path.", args);
+// OBSOLETE else
+// OBSOLETE printf_filtered (" -- Ethernet load complete.\n");
+// OBSOLETE
+// OBSOLETE end_time = time (NULL);
+// OBSOLETE abfd = bfd_openr (args, 0);
+// OBSOLETE if (abfd != NULL)
+// OBSOLETE { /* Download is done -- print section statistics */
+// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0)
+// OBSOLETE {
+// OBSOLETE printf_filtered ("File is not an object file\n");
+// OBSOLETE }
+// OBSOLETE for (s = abfd->sections; s; s = s->next)
+// OBSOLETE if (s->flags & SEC_LOAD)
+// OBSOLETE {
+// OBSOLETE bfd_size_type section_size = bfd_section_size (abfd, s);
+// OBSOLETE bfd_vma section_base = bfd_section_lma (abfd, s);
+// OBSOLETE unsigned int buffer;
+// OBSOLETE
+// OBSOLETE data_count += section_size;
+// OBSOLETE
+// OBSOLETE printf_filtered ("Loading section %s, size 0x%lx lma ",
+// OBSOLETE bfd_section_name (abfd, s), section_size);
+// OBSOLETE print_address_numeric (section_base, 1, gdb_stdout);
+// OBSOLETE printf_filtered ("\n");
+// OBSOLETE gdb_flush (gdb_stdout);
+// OBSOLETE }
+// OBSOLETE /* Finally, make the PC point at the start address */
+// OBSOLETE write_pc (bfd_get_start_address (abfd));
+// OBSOLETE report_transfer_performance (data_count, start_time, end_time);
+// OBSOLETE printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
+// OBSOLETE }
+// OBSOLETE inferior_ptid = null_ptid; /* No process now */
+// OBSOLETE
+// OBSOLETE /* This is necessary because many things were based on the PC at the
+// OBSOLETE time that we attached to the monitor, which is no longer valid
+// OBSOLETE now that we have loaded new code (and just changed the PC).
+// OBSOLETE Another way to do this might be to call normal_stop, except that
+// OBSOLETE the stack may not be valid, and things would get horribly
+// OBSOLETE confused... */
+// OBSOLETE
+// OBSOLETE clear_symtab_users ();
+// OBSOLETE }
+// OBSOLETE
+// OBSOLETE void
+// OBSOLETE _initialize_m32r_rom (void)
+// OBSOLETE {
+// OBSOLETE /* Initialize m32r RevC monitor target */
+// OBSOLETE init_m32r_cmds ();
+// OBSOLETE init_monitor_ops (&m32r_ops);
+// OBSOLETE
+// OBSOLETE m32r_ops.to_shortname = "m32r";
+// OBSOLETE m32r_ops.to_longname = "m32r monitor";
+// OBSOLETE m32r_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
+// OBSOLETE m32r_ops.to_doc = "Debug via the m32r monitor.\n\
+// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).";
+// OBSOLETE m32r_ops.to_open = m32r_open;
+// OBSOLETE add_target (&m32r_ops);
+// OBSOLETE
+// OBSOLETE /* Initialize mon2000 monitor target */
+// OBSOLETE init_mon2000_cmds ();
+// OBSOLETE init_monitor_ops (&mon2000_ops);
+// OBSOLETE
+// OBSOLETE mon2000_ops.to_shortname = "mon2000";
+// OBSOLETE mon2000_ops.to_longname = "Mon2000 monitor";
+// OBSOLETE mon2000_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
+// OBSOLETE mon2000_ops.to_doc = "Debug via the Mon2000 monitor.\n\
+// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).";
+// OBSOLETE mon2000_ops.to_open = mon2000_open;
+// OBSOLETE add_target (&mon2000_ops);
+// OBSOLETE
+// OBSOLETE add_show_from_set
+// OBSOLETE (add_set_cmd ("download-path", class_obscure, var_string,
+// OBSOLETE (char *) &download_path,
+// OBSOLETE "Set the default path for downloadable SREC files.",
+// OBSOLETE &setlist),
+// OBSOLETE &showlist);
+// OBSOLETE
+// OBSOLETE add_show_from_set
+// OBSOLETE (add_set_cmd ("board-address", class_obscure, var_string,
+// OBSOLETE (char *) &board_addr,
+// OBSOLETE "Set IP address for M32R-EVA target board.",
+// OBSOLETE &setlist),
+// OBSOLETE &showlist);
+// OBSOLETE
+// OBSOLETE add_show_from_set
+// OBSOLETE (add_set_cmd ("server-address", class_obscure, var_string,
+// OBSOLETE (char *) &server_addr,
+// OBSOLETE "Set IP address for download server (GDB's host computer).",
+// OBSOLETE &setlist),
+// OBSOLETE &showlist);
+// OBSOLETE
+// OBSOLETE add_com ("upload", class_obscure, m32r_upload_command,
+// OBSOLETE "Upload the srec file via the monitor's Ethernet upload capability.");
+// OBSOLETE
+// OBSOLETE add_com ("tload", class_obscure, m32r_load, "test upload command.");
+// OBSOLETE }