mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
Delete the remaining ROM monitor targets
Ref: https://sourceware.org/ml/gdb/2015-07/msg00011.html All of these targets use gdb/monitor.c, which has bit rotted years ago (I'd guess around ~6), and nobody seems to have noticed: | target | source | |----------------+----------------------| | target dbug | gdb/dbug-rom.c | | target picobug | gdb/microblaze-rom.c | | target dink32 | gdb/dink32-rom.c | | target m32r | gdb/m32r-rom.c | | target mon2000 | gdb/m32r-rom.c | | target ppcbug | gdb/ppcbug-rom.c | This deletes them, along with finally removing monitor.c. A manual update will be done separately. gdb/ChangeLog: 2015-08-24 Pedro Alves <palves@redhat.com> * NEWS: Mention removed support for the various ROM monitors. * Makefile.in (ALL_TARGET_OBS): Remove dbug-rom.o, dink32-rom.o, ppcbug-rom.o, m32r-rom.o, dsrec.o and monitor.o from gdb_target_obs. * configure.tgt (h8300-*-*): Remove monitor.o and m32r-rom.o from gdb_target_obs. (m68*-*-*): Remove monitor.o dbug-rom.o and dsrec.o from gdb_target_obs. (microblaze*-linux-*): Remove microblaze-rom.o, monitor.o and dsrec.o from gdb_target_obs. (microblaze*-*-*): Remove microblaze-rom.o, monitor.o and dsrec.o from gdb_target_obs. (powerpc-*-lynx*178): Remove monitor.o and dsrec.o from gdb_target_obs. (powerpc*-*-*): Remove monitor.o, dsrec.o, ppcbug-rom.o and dink32-rom.o from gdb_target_obs. (sh*-*-linux*): Remove monitor.o and dsrec.o from gdb_target_obs. (sh*): Remove monitor.o and dsrec.o from gdb_target_obs. * dbug-rom.c, dink32-rom.c, dsrec.c, m32r-rom.c, microblaze-rom.c, monitor.c, monitor.h, ppcbug-rom.c, srec.h: Delete files.
This commit is contained in:
parent
5f40e14d76
commit
40e0b27177
@ -1,3 +1,25 @@
|
||||
2015-08-24 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* NEWS: Mention removed support for the various ROM monitors.
|
||||
* Makefile.in (ALL_TARGET_OBS): Remove dbug-rom.o, dink32-rom.o,
|
||||
ppcbug-rom.o, m32r-rom.o, dsrec.o and monitor.o from gdb_target_obs.
|
||||
* configure.tgt (h8300-*-*): Remove monitor.o and m32r-rom.o from
|
||||
gdb_target_obs.
|
||||
(m68*-*-*): Remove monitor.o dbug-rom.o and dsrec.o from
|
||||
gdb_target_obs.
|
||||
(microblaze*-linux-*): Remove microblaze-rom.o, monitor.o and
|
||||
dsrec.o from gdb_target_obs.
|
||||
(microblaze*-*-*): Remove microblaze-rom.o, monitor.o and dsrec.o
|
||||
from gdb_target_obs.
|
||||
(powerpc-*-lynx*178): Remove monitor.o and dsrec.o from
|
||||
gdb_target_obs.
|
||||
(powerpc*-*-*): Remove monitor.o, dsrec.o, ppcbug-rom.o and
|
||||
dink32-rom.o from gdb_target_obs.
|
||||
(sh*-*-linux*): Remove monitor.o and dsrec.o from gdb_target_obs.
|
||||
(sh*): Remove monitor.o and dsrec.o from gdb_target_obs.
|
||||
* dbug-rom.c, dink32-rom.c, dsrec.c, m32r-rom.c, microblaze-rom.c,
|
||||
monitor.c, monitor.h, ppcbug-rom.c, srec.h: Delete files.
|
||||
|
||||
2015-08-21 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* frame.c (null_frame_id): Explicitly zero-initialize.
|
||||
|
@ -715,7 +715,6 @@ ALL_TARGET_OBS = \
|
||||
sol2-tdep.o \
|
||||
solib-frv.o solib-svr4.o \
|
||||
solib-darwin.o solib-dsbt.o \
|
||||
dbug-rom.o dink32-rom.o ppcbug-rom.o m32r-rom.o dsrec.o monitor.o \
|
||||
remote-m32r-sdi.o remote-mips.o \
|
||||
xcoffread.o \
|
||||
symfile-mem.o \
|
||||
@ -945,7 +944,7 @@ complaints.h gdb_proc_service.h gdb_regex.h xtensa-tdep.h inf-loop.h \
|
||||
common/gdb_wait.h common/gdb_assert.h solib.h ppc-tdep.h cp-support.h glibc-tdep.h \
|
||||
interps.h auxv.h gdbcmd.h tramp-frame.h mipsnbsd-tdep.h \
|
||||
amd64-linux-tdep.h linespec.h location.h i387-tdep.h mn10300-tdep.h \
|
||||
sparc64-tdep.h monitor.h ppcobsd-tdep.h srec.h \
|
||||
sparc64-tdep.h ppcobsd-tdep.h \
|
||||
coff-pe-read.h parser-defs.h gdb_ptrace.h mips-linux-tdep.h \
|
||||
m68k-tdep.h spu-tdep.h jv-lang.h environ.h amd64-tdep.h \
|
||||
doublest.h regset.h hppa-tdep.h ppc-linux-tdep.h ppc64-tdep.h \
|
||||
|
9
gdb/NEWS
9
gdb/NEWS
@ -35,6 +35,15 @@ show debug bfd-cache
|
||||
The "/m" option is now considered deprecated: its "source-centric"
|
||||
output hasn't proved useful in practice.
|
||||
|
||||
* Support for various ROM monitors has been removed:
|
||||
|
||||
target dbug dBUG ROM monitor for Motorola ColdFire
|
||||
target picobug Motorola picobug monitor
|
||||
target dink32 DINK32 ROM monitor for PowerPC
|
||||
target m32r Renesas M32R/D ROM monitor
|
||||
target mon2000 mon2000 ROM monitor
|
||||
target ppcbug PPCBUG ROM monitor for PowerPC
|
||||
|
||||
*** Changes in GDB 7.10
|
||||
|
||||
* Support for process record-replay and reverse debugging on aarch64*-linux*
|
||||
|
@ -147,8 +147,8 @@ moxie-*-elf | moxie-*-moxiebox | moxie-*-rtems*)
|
||||
;;
|
||||
|
||||
h8300-*-*)
|
||||
# Target: H8300 with HMS monitor and H8 simulator
|
||||
gdb_target_obs="h8300-tdep.o monitor.o dsrec.o"
|
||||
# Target: H8300 processor
|
||||
gdb_target_obs="h8300-tdep.o"
|
||||
gdb_sim=../sim/h8300/libsim.a
|
||||
;;
|
||||
|
||||
@ -289,8 +289,7 @@ m32r*-*-linux*)
|
||||
;;
|
||||
m32r*-*-*)
|
||||
# Target: Renesas m32r processor
|
||||
gdb_target_obs="m32r-tdep.o monitor.o m32r-rom.o dsrec.o \
|
||||
remote-m32r-sdi.o"
|
||||
gdb_target_obs="m32r-tdep.o remote-m32r-sdi.o"
|
||||
gdb_sim=../sim/m32r/libsim.a
|
||||
;;
|
||||
|
||||
@ -302,8 +301,8 @@ m68hc11*-*-*|m6811*-*-*)
|
||||
|
||||
m68*-*-aout* | m68*-*-coff* | m68*-*-elf* | m68*-*-rtems* | m68*-*-uclinux* | \
|
||||
fido-*-elf*)
|
||||
# Target: Motorola m68k embedded (e.g. bug monitors)
|
||||
gdb_target_obs="m68k-tdep.o monitor.o dbug-rom.o dsrec.o"
|
||||
# Target: Motorola m68k embedded
|
||||
gdb_target_obs="m68k-tdep.o"
|
||||
;;
|
||||
m68*-*-linux*)
|
||||
# Target: Motorola m68k with a.out and ELF
|
||||
@ -333,13 +332,13 @@ mep-*-*)
|
||||
|
||||
microblaze*-linux-*|microblaze*-*-linux*)
|
||||
# Target: Xilinx MicroBlaze running Linux
|
||||
gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o \
|
||||
monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o"
|
||||
gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o solib-svr4.o \
|
||||
symfile-mem.o linux-tdep.o"
|
||||
gdb_sim=../sim/microblaze/libsim.a
|
||||
;;
|
||||
microblaze*-*-*)
|
||||
# Target: Xilinx MicroBlaze running standalone
|
||||
gdb_target_obs="microblaze-tdep.o microblaze-rom.o monitor.o dsrec.o"
|
||||
gdb_target_obs="microblaze-tdep.o"
|
||||
gdb_sim=../sim/microblaze/libsim.a
|
||||
;;
|
||||
|
||||
@ -442,13 +441,12 @@ powerpc*-*-linux*)
|
||||
powerpc-*-lynx*178)
|
||||
# Target: PowerPC running Lynx178.
|
||||
gdb_target_obs="rs6000-tdep.o rs6000-lynx178-tdep.o \
|
||||
xcoffread.o monitor.o dsrec.o ppc-sysv-tdep.o \
|
||||
xcoffread.o ppc-sysv-tdep.o \
|
||||
ravenscar-thread.o ppc-ravenscar-thread.o"
|
||||
;;
|
||||
powerpc*-*-*)
|
||||
# Target: PowerPC running eabi
|
||||
gdb_target_obs="rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o \
|
||||
dink32-rom.o ppc-sysv-tdep.o solib-svr4.o \
|
||||
gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o solib-svr4.o \
|
||||
ravenscar-thread.o ppc-ravenscar-thread.o"
|
||||
if test -f ../sim/ppc/Makefile; then
|
||||
gdb_sim=../sim/ppc/libsim.a
|
||||
@ -484,8 +482,8 @@ score-*-*)
|
||||
|
||||
sh*-*-linux*)
|
||||
# Target: GNU/Linux Super-H
|
||||
gdb_target_obs="sh-tdep.o sh64-tdep.o sh-linux-tdep.o monitor.o \
|
||||
dsrec.o solib-svr4.o symfile-mem.o \
|
||||
gdb_target_obs="sh-tdep.o sh64-tdep.o sh-linux-tdep.o \
|
||||
solib-svr4.o symfile-mem.o \
|
||||
glibc-tdep.o linux-tdep.o"
|
||||
gdb_sim=../sim/sh/libsim.a
|
||||
build_gdbserver=yes
|
||||
@ -505,8 +503,8 @@ sh64-*-elf*)
|
||||
gdb_sim=../sim/sh64/libsim.a
|
||||
;;
|
||||
sh*)
|
||||
# Target: Embedded Renesas Super-H with ICE and simulator
|
||||
gdb_target_obs="sh-tdep.o sh64-tdep.o monitor.o dsrec.o"
|
||||
# Target: Embedded Renesas Super-H processor
|
||||
gdb_target_obs="sh-tdep.o sh64-tdep.o"
|
||||
gdb_sim=../sim/sh/libsim.a
|
||||
;;
|
||||
|
||||
|
176
gdb/dbug-rom.c
176
gdb/dbug-rom.c
@ -1,176 +0,0 @@
|
||||
/* Remote debugging interface to dBUG ROM monitor for GDB, the GNU debugger.
|
||||
Copyright (C) 1996-2015 Free Software Foundation, Inc.
|
||||
|
||||
Written by Stan Shebs 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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* dBUG is a monitor supplied on various Motorola boards, including
|
||||
m68k, ColdFire, and PowerPC-based designs. The code here assumes
|
||||
the ColdFire, and (as of 9/25/96) has only been tested with a
|
||||
ColdFire IDP board. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "gdbcore.h"
|
||||
#include "target.h"
|
||||
#include "monitor.h"
|
||||
#include "serial.h"
|
||||
#include "regcache.h"
|
||||
|
||||
#include "m68k-tdep.h"
|
||||
|
||||
static void
|
||||
dbug_supply_register (struct regcache *regcache, char *regname,
|
||||
int regnamelen, char *val, int vallen)
|
||||
{
|
||||
int regno;
|
||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
|
||||
if (regnamelen != 2)
|
||||
return;
|
||||
|
||||
switch (regname[0])
|
||||
{
|
||||
case 'S':
|
||||
if (regname[1] != 'R')
|
||||
return;
|
||||
regno = gdbarch_ps_regnum (gdbarch);
|
||||
break;
|
||||
case 'P':
|
||||
if (regname[1] != 'C')
|
||||
return;
|
||||
regno = gdbarch_pc_regnum (gdbarch);
|
||||
break;
|
||||
case 'D':
|
||||
if (regname[1] < '0' || regname[1] > '7')
|
||||
return;
|
||||
regno = regname[1] - '0' + M68K_D0_REGNUM;
|
||||
break;
|
||||
case 'A':
|
||||
if (regname[1] < '0' || regname[1] > '7')
|
||||
return;
|
||||
regno = regname[1] - '0' + M68K_A0_REGNUM;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
monitor_supply_register (regcache, regno, val);
|
||||
}
|
||||
|
||||
/* 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 const char *
|
||||
dbug_regname (int index)
|
||||
{
|
||||
static char *regnames[] =
|
||||
{
|
||||
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
|
||||
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
|
||||
"SR", "PC"
|
||||
/* no float registers */
|
||||
};
|
||||
|
||||
if (index >= ARRAY_SIZE (regnames) || index < 0)
|
||||
return NULL;
|
||||
else
|
||||
return regnames[index];
|
||||
|
||||
}
|
||||
|
||||
static struct target_ops dbug_ops;
|
||||
static struct monitor_ops dbug_cmds;
|
||||
|
||||
static char *dbug_inits[] =
|
||||
{"\r", NULL};
|
||||
|
||||
|
||||
static void
|
||||
init_dbug_cmds (void)
|
||||
{
|
||||
dbug_cmds.flags = MO_CLR_BREAK_USES_ADDR
|
||||
| MO_GETMEM_NEEDS_RANGE | MO_FILL_USES_ADDR;
|
||||
dbug_cmds.init = dbug_inits; /* Init strings */
|
||||
dbug_cmds.cont = "go\r"; /* continue command */
|
||||
dbug_cmds.step = "trace\r"; /* single step */
|
||||
dbug_cmds.stop = NULL; /* interrupt command */
|
||||
dbug_cmds.set_break = "br %x\r"; /* set a breakpoint */
|
||||
dbug_cmds.clr_break = "br -r %x\r"; /* clear a breakpoint */
|
||||
dbug_cmds.clr_all_break = "br -r\r"; /* clear all breakpoints */
|
||||
dbug_cmds.fill = "bf.b %x %x %x\r"; /* fill (start end val) */
|
||||
dbug_cmds.setmem.cmdb = "mm.b %x %x\r"; /* setmem.cmdb (addr, value) */
|
||||
dbug_cmds.setmem.cmdw = "mm.w %x %x\r"; /* setmem.cmdw (addr, value) */
|
||||
dbug_cmds.setmem.cmdl = "mm.l %x %x\r"; /* setmem.cmdl (addr, value) */
|
||||
dbug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
|
||||
dbug_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
|
||||
dbug_cmds.setmem.term = NULL; /* setmem.term */
|
||||
dbug_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
|
||||
dbug_cmds.getmem.cmdb = "md.b %x %x\r"; /* getmem.cmdb (addr, addr2) */
|
||||
dbug_cmds.getmem.cmdw = "md.w %x %x\r"; /* getmem.cmdw (addr, addr2) */
|
||||
dbug_cmds.getmem.cmdl = "md.l %x %x\r"; /* getmem.cmdl (addr, addr2) */
|
||||
dbug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, addr2) */
|
||||
dbug_cmds.getmem.resp_delim = ":"; /* getmem.resp_delim */
|
||||
dbug_cmds.getmem.term = NULL; /* getmem.term */
|
||||
dbug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
|
||||
dbug_cmds.setreg.cmd = "rm %s %x\r"; /* setreg.cmd (name, value) */
|
||||
dbug_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
|
||||
dbug_cmds.setreg.term = NULL; /* setreg.term */
|
||||
dbug_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
|
||||
dbug_cmds.getreg.cmd = "rd %s\r"; /* getreg.cmd (name) */
|
||||
dbug_cmds.getreg.resp_delim = ":"; /* getreg.resp_delim */
|
||||
dbug_cmds.getreg.term = NULL; /* getreg.term */
|
||||
dbug_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
|
||||
dbug_cmds.dump_registers = "rd\r"; /* dump_registers */
|
||||
/* register_pattern */
|
||||
dbug_cmds.register_pattern = "\\(\\w+\\) +:\\([0-9a-fA-F]+\\b\\)";
|
||||
dbug_cmds.supply_register = dbug_supply_register;
|
||||
dbug_cmds.load = "dl\r"; /* download command */
|
||||
dbug_cmds.loadresp = "\n"; /* load response */
|
||||
dbug_cmds.prompt = "dBUG>"; /* monitor command prompt */
|
||||
dbug_cmds.line_term = "\r"; /* end-of-line terminator */
|
||||
dbug_cmds.cmd_end = NULL; /* optional command terminator */
|
||||
dbug_cmds.target = &dbug_ops; /* target operations */
|
||||
dbug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
||||
dbug_cmds.regnames = NULL; /* registers names */
|
||||
dbug_cmds.regname = dbug_regname;
|
||||
dbug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
|
||||
} /* init_debug_ops */
|
||||
|
||||
static void
|
||||
dbug_open (const char *args, int from_tty)
|
||||
{
|
||||
monitor_open (args, &dbug_cmds, from_tty);
|
||||
}
|
||||
|
||||
extern initialize_file_ftype _initialize_dbug_rom; /* -Wmissing-prototypes */
|
||||
|
||||
void
|
||||
_initialize_dbug_rom (void)
|
||||
{
|
||||
init_dbug_cmds ();
|
||||
init_monitor_ops (&dbug_ops);
|
||||
|
||||
dbug_ops.to_shortname = "dbug";
|
||||
dbug_ops.to_longname = "dBUG monitor";
|
||||
dbug_ops.to_doc = "Debug via the dBUG monitor.\n\
|
||||
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
||||
dbug_ops.to_open = dbug_open;
|
||||
|
||||
add_target (&dbug_ops);
|
||||
}
|
179
gdb/dink32-rom.c
179
gdb/dink32-rom.c
@ -1,179 +0,0 @@
|
||||
/* Remote debugging interface for DINK32 (PowerPC) ROM monitor for
|
||||
GDB, the GNU debugger.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "gdbcore.h"
|
||||
#include "target.h"
|
||||
#include "monitor.h"
|
||||
#include "serial.h"
|
||||
#include "symfile.h" /* For generic_load() */
|
||||
#include "inferior.h"
|
||||
#include "regcache.h"
|
||||
|
||||
static void
|
||||
dink32_supply_register (struct regcache *regcache, char *regname,
|
||||
int regnamelen, char *val, int vallen)
|
||||
{
|
||||
int regno = 0;
|
||||
|
||||
if (regnamelen < 2 || regnamelen > 4)
|
||||
return;
|
||||
|
||||
switch (regname[0])
|
||||
{
|
||||
case 'R':
|
||||
if (regname[1] < '0' || regname[1] > '9')
|
||||
return;
|
||||
if (regnamelen == 2)
|
||||
regno = regname[1] - '0';
|
||||
else if (regnamelen == 3 && regname[2] >= '0' && regname[2] <= '9')
|
||||
regno = (regname[1] - '0') * 10 + (regname[2] - '0');
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case 'F':
|
||||
if (regname[1] != 'R' || regname[2] < '0' || regname[2] > '9')
|
||||
return;
|
||||
if (regnamelen == 3)
|
||||
regno = 32 + regname[2] - '0';
|
||||
else if (regnamelen == 4 && regname[3] >= '0' && regname[3] <= '9')
|
||||
regno = 32 + (regname[2] - '0') * 10 + (regname[3] - '0');
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case 'I':
|
||||
if (regnamelen != 2 || regname[1] != 'P')
|
||||
return;
|
||||
regno = 64;
|
||||
break;
|
||||
case 'M':
|
||||
if (regnamelen != 3 || regname[1] != 'S' || regname[2] != 'R')
|
||||
return;
|
||||
regno = 65;
|
||||
break;
|
||||
case 'C':
|
||||
if (regnamelen != 2 || regname[1] != 'R')
|
||||
return;
|
||||
regno = 66;
|
||||
break;
|
||||
case 'S':
|
||||
if (regnamelen != 4 || regname[1] != 'P' || regname[2] != 'R')
|
||||
return;
|
||||
else if (regname[3] == '8')
|
||||
regno = 67;
|
||||
else if (regname[3] == '9')
|
||||
regno = 68;
|
||||
else if (regname[3] == '1')
|
||||
regno = 69;
|
||||
else if (regname[3] == '0')
|
||||
regno = 70;
|
||||
else
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
monitor_supply_register (regcache, regno, val);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
|
||||
static char *dink32_regnames[] =
|
||||
{
|
||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||||
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
||||
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
|
||||
|
||||
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
|
||||
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
|
||||
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
|
||||
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
|
||||
|
||||
"srr0", "msr", "cr", "lr", "ctr", "xer", "xer"
|
||||
};
|
||||
|
||||
static struct target_ops dink32_ops;
|
||||
|
||||
static char *dink32_inits[] =
|
||||
{"\r", NULL};
|
||||
|
||||
static struct monitor_ops dink32_cmds;
|
||||
|
||||
static void
|
||||
dink32_open (const char *args, int from_tty)
|
||||
{
|
||||
monitor_open (args, &dink32_cmds, from_tty);
|
||||
}
|
||||
|
||||
extern initialize_file_ftype _initialize_dink32_rom; /* -Wmissing-prototypes */
|
||||
|
||||
void
|
||||
_initialize_dink32_rom (void)
|
||||
{
|
||||
dink32_cmds.flags = MO_HEX_PREFIX | MO_GETMEM_NEEDS_RANGE
|
||||
| MO_FILL_USES_ADDR | MO_HANDLE_NL | MO_32_REGS_PAIRED
|
||||
| MO_SETREG_INTERACTIVE | MO_SETMEM_INTERACTIVE
|
||||
| MO_GETMEM_16_BOUNDARY | MO_CLR_BREAK_1_BASED | MO_SREC_ACK
|
||||
| MO_SREC_ACK_ROTATE;
|
||||
dink32_cmds.init = dink32_inits;
|
||||
dink32_cmds.cont = "go +\r";
|
||||
dink32_cmds.step = "tr +\r";
|
||||
dink32_cmds.set_break = "bp 0x%x\r";
|
||||
dink32_cmds.clr_break = "bp %d\r";
|
||||
#if 0 /* Would need to follow strict alignment rules.. */
|
||||
dink32_cmds.fill = "mf %x %x %x\r";
|
||||
#endif
|
||||
dink32_cmds.setmem.cmdb = "mm -b %x\r";
|
||||
dink32_cmds.setmem.cmdw = "mm -w %x\r";
|
||||
dink32_cmds.setmem.cmdl = "mm %x\r";
|
||||
dink32_cmds.setmem.term = " ? ";
|
||||
dink32_cmds.getmem.cmdb = "md %x\r";
|
||||
dink32_cmds.getmem.resp_delim = " ";
|
||||
dink32_cmds.setreg.cmd = "rm %s\r";
|
||||
dink32_cmds.setreg.term = " ? ";
|
||||
dink32_cmds.getreg.cmd = "rd %s\r";
|
||||
dink32_cmds.getreg.resp_delim = ": ";
|
||||
dink32_cmds.dump_registers = "rd r\r";
|
||||
dink32_cmds.register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)";
|
||||
dink32_cmds.supply_register = dink32_supply_register;
|
||||
/* S-record download, via "keyboard port". */
|
||||
dink32_cmds.load = "dl -k\r";
|
||||
dink32_cmds.loadresp = "Set Input Port : set to Keyboard Port\r";
|
||||
dink32_cmds.prompt = "DINK32_603 >>";
|
||||
dink32_cmds.line_term = "\r";
|
||||
dink32_cmds.target = &dink32_ops;
|
||||
dink32_cmds.stopbits = SERIAL_1_STOPBITS;
|
||||
dink32_cmds.regnames = dink32_regnames;
|
||||
dink32_cmds.magic = MONITOR_OPS_MAGIC;
|
||||
|
||||
init_monitor_ops (&dink32_ops);
|
||||
|
||||
dink32_ops.to_shortname = "dink32";
|
||||
dink32_ops.to_longname = "DINK32 monitor";
|
||||
dink32_ops.to_doc = "Debug using the DINK32 monitor.\n\
|
||||
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
||||
dink32_ops.to_open = dink32_open;
|
||||
|
||||
add_target (&dink32_ops);
|
||||
}
|
316
gdb/dsrec.c
316
gdb/dsrec.c
@ -1,316 +0,0 @@
|
||||
/* S-record download support for GDB, the GNU debugger.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "serial.h"
|
||||
#include "srec.h"
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include "gdb_bfd.h"
|
||||
|
||||
extern int remote_debug;
|
||||
|
||||
static int make_srec (char *srec, CORE_ADDR targ_addr, bfd * abfd,
|
||||
asection * sect, int sectoff, int *maxrecsize,
|
||||
int flags);
|
||||
|
||||
/* Download an executable by converting it to S records. DESC is a
|
||||
`struct serial *' to send the data to. FILE is the name of the
|
||||
file to be loaded. LOAD_OFFSET is the offset into memory to load
|
||||
data into. It is usually specified by the user and is useful with
|
||||
the a.out file format. MAXRECSIZE is the length in chars of the
|
||||
largest S-record the host can accomodate. This is measured from
|
||||
the starting `S' to the last char of the checksum. FLAGS is
|
||||
various random flags, and HASHMARK is non-zero to cause a `#' to be
|
||||
printed out for each record loaded. WAITACK, if non-NULL, is a
|
||||
function that waits for an acknowledgement after each S-record, and
|
||||
returns non-zero if the ack is read correctly. */
|
||||
|
||||
void
|
||||
load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
||||
int maxrecsize,
|
||||
int flags, int hashmark, int (*waitack) (void))
|
||||
{
|
||||
bfd *abfd;
|
||||
asection *s;
|
||||
char *srec;
|
||||
int i;
|
||||
int reclen;
|
||||
struct timeval start_time, end_time;
|
||||
unsigned long data_count = 0;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
srec = (char *) alloca (maxrecsize + 1);
|
||||
|
||||
abfd = gdb_bfd_open (file, NULL, -1);
|
||||
if (!abfd)
|
||||
{
|
||||
printf_filtered (_("Unable to open file %s\n"), file);
|
||||
return;
|
||||
}
|
||||
|
||||
cleanup = make_cleanup_bfd_unref (abfd);
|
||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
||||
{
|
||||
printf_filtered (_("File is not an object file\n"));
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
gettimeofday (&start_time, NULL);
|
||||
|
||||
/* Write a type 0 header record. no data for a type 0, and there
|
||||
is no data, so len is 0. */
|
||||
|
||||
reclen = maxrecsize;
|
||||
make_srec (srec, 0, NULL, (asection *) 1, 0, &reclen, flags);
|
||||
if (remote_debug)
|
||||
{
|
||||
srec[reclen] = '\0';
|
||||
puts_debug ("sent -->", srec, "<--");
|
||||
}
|
||||
serial_write (desc, srec, reclen);
|
||||
|
||||
for (s = abfd->sections; s; s = s->next)
|
||||
if (s->flags & SEC_LOAD)
|
||||
{
|
||||
int numbytes;
|
||||
|
||||
bfd_vma addr = bfd_get_section_vma (abfd, s) + load_offset;
|
||||
bfd_size_type size = bfd_get_section_size (s);
|
||||
char *section_name = (char *) bfd_get_section_name (abfd, s);
|
||||
/* Both GDB and BFD have mechanisms for printing addresses.
|
||||
In the below, GDB's is used so that the address is
|
||||
consistent with the rest of GDB. BFD's printf_vma() could
|
||||
have also been used. cagney 1999-09-01 */
|
||||
printf_filtered ("%s\t: %s .. %s ",
|
||||
section_name,
|
||||
paddress (target_gdbarch (), addr),
|
||||
paddress (target_gdbarch (), addr + size));
|
||||
gdb_flush (gdb_stdout);
|
||||
|
||||
data_count += size;
|
||||
|
||||
for (i = 0; i < size; i += numbytes)
|
||||
{
|
||||
reclen = maxrecsize;
|
||||
numbytes = make_srec (srec, (CORE_ADDR) (addr + i), abfd, s,
|
||||
i, &reclen, flags);
|
||||
|
||||
if (remote_debug)
|
||||
{
|
||||
srec[reclen] = '\0';
|
||||
puts_debug ("sent -->", srec, "<--");
|
||||
}
|
||||
|
||||
/* Repeatedly send the S-record until a good
|
||||
acknowledgement is sent back. */
|
||||
do
|
||||
{
|
||||
serial_write (desc, srec, reclen);
|
||||
if (deprecated_ui_load_progress_hook)
|
||||
if (deprecated_ui_load_progress_hook (section_name,
|
||||
(unsigned long) i))
|
||||
error (_("Canceled the download"));
|
||||
}
|
||||
while (waitack != NULL && !waitack ());
|
||||
|
||||
if (hashmark)
|
||||
{
|
||||
putchar_unfiltered ('#');
|
||||
gdb_flush (gdb_stdout);
|
||||
}
|
||||
} /* Per-packet (or S-record) loop. */
|
||||
|
||||
if (deprecated_ui_load_progress_hook)
|
||||
if (deprecated_ui_load_progress_hook (section_name,
|
||||
(unsigned long) i))
|
||||
error (_("Canceled the download"));
|
||||
putchar_unfiltered ('\n');
|
||||
}
|
||||
|
||||
if (hashmark)
|
||||
putchar_unfiltered ('\n');
|
||||
|
||||
gettimeofday (&end_time, NULL);
|
||||
|
||||
/* Write a terminator record. */
|
||||
|
||||
reclen = maxrecsize;
|
||||
make_srec (srec, abfd->start_address, NULL, NULL, 0, &reclen, flags);
|
||||
|
||||
if (remote_debug)
|
||||
{
|
||||
srec[reclen] = '\0';
|
||||
puts_debug ("sent -->", srec, "<--");
|
||||
}
|
||||
|
||||
serial_write (desc, srec, reclen);
|
||||
|
||||
/* Some monitors need these to wake up properly. (Which ones? -sts) */
|
||||
serial_write (desc, "\r\r", 2);
|
||||
if (remote_debug)
|
||||
puts_debug ("sent -->", "\r\r", "<---");
|
||||
|
||||
serial_flush_input (desc);
|
||||
|
||||
print_transfer_performance (gdb_stdout, data_count, 0,
|
||||
&start_time, &end_time);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
/*
|
||||
* make_srec -- make an srecord. This writes each line, one at a
|
||||
* time, each with it's own header and trailer line.
|
||||
* An srecord looks like this:
|
||||
*
|
||||
* byte count-+ address
|
||||
* start ---+ | | data +- checksum
|
||||
* | | | |
|
||||
* S01000006F6B692D746573742E73726563E4
|
||||
* S315000448600000000000000000FC00005900000000E9
|
||||
* S31A0004000023C1400037DE00F023604000377B009020825000348D
|
||||
* S30B0004485A0000000000004E
|
||||
* S70500040000F6
|
||||
*
|
||||
* S<type><length><address><data><checksum>
|
||||
*
|
||||
* Where
|
||||
* - length
|
||||
* is the number of bytes following upto the checksum. Note
|
||||
* that this is not the number of chars following, since it
|
||||
* takes two chars to represent a byte.
|
||||
* - type
|
||||
* is one of:
|
||||
* 0) header record
|
||||
* 1) two byte address data record
|
||||
* 2) three byte address data record
|
||||
* 3) four byte address data record
|
||||
* 7) four byte address termination record
|
||||
* 8) three byte address termination record
|
||||
* 9) two byte address termination record
|
||||
*
|
||||
* - address
|
||||
* is the start address of the data following, or in the case of
|
||||
* a termination record, the start address of the image
|
||||
* - data
|
||||
* is the data.
|
||||
* - checksum
|
||||
* is the sum of all the raw byte data in the record, from the length
|
||||
* upwards, modulo 256 and subtracted from 255.
|
||||
*
|
||||
* This routine returns the length of the S-record.
|
||||
*
|
||||
*/
|
||||
|
||||
static int
|
||||
make_srec (char *srec, CORE_ADDR targ_addr, bfd *abfd, asection *sect,
|
||||
int sectoff, int *maxrecsize, int flags)
|
||||
{
|
||||
unsigned char checksum;
|
||||
int tmp;
|
||||
static const char hextab[] = "0123456789ABCDEF";
|
||||
static const char data_code_table[] = "123";
|
||||
static const char term_code_table[] = "987";
|
||||
static const char header_code_table[] = "000";
|
||||
char const *code_table;
|
||||
int addr_size;
|
||||
int payload_size;
|
||||
char *binbuf;
|
||||
char *p;
|
||||
|
||||
if (sect)
|
||||
{
|
||||
tmp = flags; /* Data or header record */
|
||||
code_table = abfd ? data_code_table : header_code_table;
|
||||
binbuf = alloca (*maxrecsize / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = flags >> SREC_TERM_SHIFT; /* Term record */
|
||||
code_table = term_code_table;
|
||||
binbuf = NULL;
|
||||
}
|
||||
|
||||
if ((tmp & SREC_2_BYTE_ADDR) && (targ_addr <= 0xffff))
|
||||
addr_size = 2;
|
||||
else if ((tmp & SREC_3_BYTE_ADDR) && (targ_addr <= 0xffffff))
|
||||
addr_size = 3;
|
||||
else if (tmp & SREC_4_BYTE_ADDR)
|
||||
addr_size = 4;
|
||||
else
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("make_srec: Bad address (%s), or bad flags (0x%x)."),
|
||||
paddress (target_gdbarch (), targ_addr), flags);
|
||||
|
||||
/* Now that we know the address size, we can figure out how much
|
||||
data this record can hold. */
|
||||
|
||||
if (sect && abfd)
|
||||
{
|
||||
payload_size = (*maxrecsize - (1 + 1 + 2 + addr_size * 2 + 2)) / 2;
|
||||
payload_size = min (payload_size, bfd_get_section_size (sect) - sectoff);
|
||||
|
||||
bfd_get_section_contents (abfd, sect, binbuf, sectoff, payload_size);
|
||||
}
|
||||
else
|
||||
payload_size = 0; /* Term or header packets have no payload. */
|
||||
|
||||
/* Output the header. */
|
||||
snprintf (srec, (*maxrecsize) + 1, "S%c%02X%0*X",
|
||||
code_table[addr_size - 2],
|
||||
addr_size + payload_size + 1,
|
||||
addr_size * 2, (int) targ_addr);
|
||||
|
||||
/* Note that the checksum is calculated on the raw data, not the
|
||||
hexified data. It includes the length, address and the data
|
||||
portions of the packet. */
|
||||
|
||||
checksum = 0;
|
||||
|
||||
checksum += (payload_size + addr_size + 1 /* Packet length */
|
||||
+ (targ_addr & 0xff) /* Address... */
|
||||
+ ((targ_addr >> 8) & 0xff)
|
||||
+ ((targ_addr >> 16) & 0xff)
|
||||
+ ((targ_addr >> 24) & 0xff));
|
||||
|
||||
/* NOTE: cagney/2003-08-10: The equation is old. Check that the
|
||||
recent snprintf changes match that equation. */
|
||||
gdb_assert (strlen (srec) == 1 + 1 + 2 + addr_size * 2);
|
||||
p = srec + 1 + 1 + 2 + addr_size * 2;
|
||||
|
||||
/* Build the Srecord. */
|
||||
for (tmp = 0; tmp < payload_size; tmp++)
|
||||
{
|
||||
unsigned char k;
|
||||
|
||||
k = binbuf[tmp];
|
||||
*p++ = hextab[k >> 4];
|
||||
*p++ = hextab[k & 0xf];
|
||||
checksum += k;
|
||||
}
|
||||
|
||||
checksum = ~checksum;
|
||||
|
||||
*p++ = hextab[checksum >> 4];
|
||||
*p++ = hextab[checksum & 0xf];
|
||||
*p++ = '\r';
|
||||
|
||||
*maxrecsize = p - srec;
|
||||
return payload_size;
|
||||
}
|
634
gdb/m32r-rom.c
634
gdb/m32r-rom.c
@ -1,634 +0,0 @@
|
||||
/* Remote debugging interface to m32r and mon2000 ROM monitors for GDB,
|
||||
the GNU debugger.
|
||||
|
||||
Copyright (C) 1996-2015 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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This module defines communication with the Renesas 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 <sys/time.h>
|
||||
#include <time.h> /* for time_t */
|
||||
#include "objfiles.h" /* for ALL_OBJFILES etc. */
|
||||
#include "inferior.h"
|
||||
#include <ctype.h>
|
||||
#include "regcache.h"
|
||||
#include "gdb_bfd.h"
|
||||
#include "cli/cli-utils.h"
|
||||
|
||||
/*
|
||||
* All this stuff just to get my host computer's IP address!
|
||||
*/
|
||||
#ifdef __MINGW32__
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#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
|
||||
#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 */
|
||||
|
||||
|
||||
/* REGNUM */
|
||||
#define PSW_REGNUM 16
|
||||
#define SPI_REGNUM 18
|
||||
#define SPU_REGNUM 19
|
||||
#define ACCL_REGNUM 22
|
||||
#define ACCH_REGNUM 23
|
||||
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
|
||||
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),
|
||||
(unsigned long) section_size);
|
||||
fputs_filtered (paddress (target_gdbarch (), section_base), gdb_stdout);
|
||||
printf_filtered ("\n");
|
||||
gdb_flush (gdb_stdout);
|
||||
monitor_printf ("%s mw\r", phex_nz (section_base, addr_size));
|
||||
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;
|
||||
unsigned int data_count = 0;
|
||||
struct timeval start_time, end_time;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
if (filename == NULL || filename[0] == 0)
|
||||
filename = get_exec_file (1);
|
||||
|
||||
abfd = gdb_bfd_open (filename, NULL, -1);
|
||||
if (!abfd)
|
||||
error (_("Unable to open file %s."), filename);
|
||||
cleanup = make_cleanup_bfd_unref (abfd);
|
||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
||||
error (_("File is not an object file."));
|
||||
gettimeofday (&start_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);
|
||||
fputs_filtered (paddress (target_gdbarch (), section_base), 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");
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
gettimeofday (&end_time, NULL);
|
||||
printf_filtered ("Start address 0x%lx\n",
|
||||
(unsigned long) bfd_get_start_address (abfd));
|
||||
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
|
||||
&end_time);
|
||||
|
||||
/* Finally, make the PC point at the start address. */
|
||||
if (exec_bfd)
|
||||
regcache_write_pc (get_current_regcache (),
|
||||
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 (0);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
static void
|
||||
m32r_load_gen (struct target_ops *self, const char *filename, int from_tty)
|
||||
{
|
||||
generic_load (filename, 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 (struct regcache *regcache, char *regname,
|
||||
int regnamelen, char *val, int vallen)
|
||||
{
|
||||
int regno;
|
||||
int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
|
||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
|
||||
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 (regcache, ACCH_REGNUM, val);
|
||||
val = strchr (val, ':'); /* Skip past ':' to get 2nd word. */
|
||||
if (val != NULL)
|
||||
monitor_supply_register (regcache, ACCL_REGNUM, val + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
monitor_supply_register (regcache, regno, val);
|
||||
if (regno == PSW_REGNUM)
|
||||
{
|
||||
#if (defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \
|
||||
|| defined BIE_REGNUM || defined COND_REGNUM || defined CBR_REGNUM \
|
||||
|| defined BPC_REGNUM || defined BCARRY_REGNUM)
|
||||
unsigned long psw = strtoul (val, NULL, 16);
|
||||
char *zero = "00000000", *one = "00000001";
|
||||
#endif
|
||||
|
||||
#ifdef SM_REGNUM
|
||||
/* Stack mode bit */
|
||||
monitor_supply_register (regcache, SM_REGNUM,
|
||||
(psw & 0x80) ? one : zero);
|
||||
#endif
|
||||
#ifdef BSM_REGNUM
|
||||
/* Backup stack mode bit */
|
||||
monitor_supply_register (regcache, BSM_REGNUM,
|
||||
(psw & 0x8000) ? one : zero);
|
||||
#endif
|
||||
#ifdef IE_REGNUM
|
||||
/* Interrupt enable bit */
|
||||
monitor_supply_register (regcache, IE_REGNUM,
|
||||
(psw & 0x40) ? one : zero);
|
||||
#endif
|
||||
#ifdef BIE_REGNUM
|
||||
/* Backup interrupt enable bit */
|
||||
monitor_supply_register (regcache, BIE_REGNUM,
|
||||
(psw & 0x4000) ? one : zero);
|
||||
#endif
|
||||
#ifdef COND_REGNUM
|
||||
/* Condition bit (carry etc.) */
|
||||
monitor_supply_register (regcache, COND_REGNUM,
|
||||
(psw & 0x1) ? one : zero);
|
||||
#endif
|
||||
#ifdef CBR_REGNUM
|
||||
monitor_supply_register (regcache, CBR_REGNUM,
|
||||
(psw & 0x1) ? one : zero);
|
||||
#endif
|
||||
#ifdef BPC_REGNUM
|
||||
monitor_supply_register (regcache, BPC_REGNUM,
|
||||
zero); /* KLUDGE: (???????) */
|
||||
#endif
|
||||
#ifdef BCARRY_REGNUM
|
||||
monitor_supply_register (regcache, BCARRY_REGNUM,
|
||||
zero); /* KLUDGE: (??????) */
|
||||
#endif
|
||||
}
|
||||
|
||||
if (regno == SPI_REGNUM || regno == SPU_REGNUM)
|
||||
{ /* special handling for stack pointer (spu or spi). */
|
||||
ULONGEST stackmode, psw;
|
||||
regcache_cooked_read_unsigned (regcache, PSW_REGNUM, &psw);
|
||||
stackmode = psw & 0x80;
|
||||
|
||||
if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
|
||||
monitor_supply_register (regcache,
|
||||
gdbarch_sp_regnum (gdbarch), val);
|
||||
else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
|
||||
monitor_supply_register (regcache,
|
||||
gdbarch_sp_regnum (gdbarch), 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 */
|
||||
/* register_pattern */
|
||||
m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";
|
||||
m32r_cmds.supply_register = m32r_supply_register;
|
||||
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 (const 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 */
|
||||
/* register_pattern */
|
||||
mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";
|
||||
mon2000_cmds.supply_register = m32r_supply_register;
|
||||
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 (const char *args, int from_tty)
|
||||
{
|
||||
monitor_open (args, &mon2000_cmds, from_tty);
|
||||
}
|
||||
|
||||
static void
|
||||
m32r_upload_command (char *args, int from_tty)
|
||||
{
|
||||
bfd *abfd;
|
||||
asection *s;
|
||||
struct timeval start_time, end_time;
|
||||
int resp_len, data_count = 0;
|
||||
char buf[1024];
|
||||
struct hostent *hostent;
|
||||
struct in_addr inet_addr;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
/* 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;
|
||||
|
||||
myIPaddress = skip_spaces (myIPaddress);
|
||||
|
||||
if (startswith (myIPaddress, "0.0.")) /* 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)
|
||||
{
|
||||
#ifdef __MINGW32__
|
||||
WSADATA wd;
|
||||
/* Winsock initialization. */
|
||||
if (WSAStartup (MAKEWORD (1, 1), &wd))
|
||||
error (_("Couldn't initialize WINSOCK."));
|
||||
#endif
|
||||
|
||||
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')"));
|
||||
}
|
||||
|
||||
gettimeofday (&start_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\n"
|
||||
"Check IP addresses and download path."),
|
||||
args);
|
||||
else
|
||||
printf_filtered (" -- Ethernet load complete.\n");
|
||||
|
||||
gettimeofday (&end_time, NULL);
|
||||
abfd = gdb_bfd_open (args, NULL, -1);
|
||||
cleanup = make_cleanup_bfd_unref (abfd);
|
||||
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);
|
||||
|
||||
data_count += section_size;
|
||||
|
||||
printf_filtered ("Loading section %s, size 0x%lx lma ",
|
||||
bfd_section_name (abfd, s),
|
||||
(unsigned long) section_size);
|
||||
fputs_filtered (paddress (target_gdbarch (), section_base),
|
||||
gdb_stdout);
|
||||
printf_filtered ("\n");
|
||||
gdb_flush (gdb_stdout);
|
||||
}
|
||||
/* Finally, make the PC point at the start address. */
|
||||
regcache_write_pc (get_current_regcache (),
|
||||
bfd_get_start_address (abfd));
|
||||
printf_filtered ("Start address 0x%lx\n",
|
||||
(unsigned long) bfd_get_start_address (abfd));
|
||||
print_transfer_performance (gdb_stdout, data_count, 0, &start_time,
|
||||
&end_time);
|
||||
}
|
||||
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 (0);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||
extern initialize_file_ftype _initialize_m32r_rom;
|
||||
|
||||
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_setshow_string_cmd ("download-path", class_obscure, &download_path, _("\
|
||||
Set the default path for downloadable SREC files."), _("\
|
||||
Show the default path for downloadable SREC files."), _("\
|
||||
Determines the default path for downloadable SREC files."),
|
||||
NULL,
|
||||
NULL, /* FIXME: i18n: The default path for
|
||||
downloadable SREC files is %s. */
|
||||
&setlist, &showlist);
|
||||
|
||||
add_setshow_string_cmd ("board-address", class_obscure, &board_addr, _("\
|
||||
Set IP address for M32R-EVA target board."), _("\
|
||||
Show IP address for M32R-EVA target board."), _("\
|
||||
Determine the IP address for M32R-EVA target board."),
|
||||
NULL,
|
||||
NULL, /* FIXME: i18n: IP address for
|
||||
M32R-EVA target board is %s. */
|
||||
&setlist, &showlist);
|
||||
|
||||
add_setshow_string_cmd ("server-address", class_obscure, &server_addr, _("\
|
||||
Set IP address for download server (GDB's host computer)."), _("\
|
||||
Show IP address for download server (GDB's host computer)."), _("\
|
||||
Determine the IP address for download server (GDB's host computer)."),
|
||||
NULL,
|
||||
NULL, /* FIXME: i18n: IP address for
|
||||
download server (GDB's host
|
||||
computer) is %s. */
|
||||
&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."));
|
||||
}
|
@ -1,192 +0,0 @@
|
||||
/* Remote debugging interface to Xilinx MicroBlaze.
|
||||
|
||||
Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "gdbcore.h"
|
||||
#include "target.h"
|
||||
#include "monitor.h"
|
||||
#include "serial.h"
|
||||
#include "regcache.h"
|
||||
|
||||
void _initialize_picobug_rom (void);
|
||||
|
||||
static char *picobug_inits[] =
|
||||
{"\r", NULL};
|
||||
|
||||
static struct target_ops picobug_ops;
|
||||
static struct monitor_ops picobug_cmds;
|
||||
|
||||
/* Picobug only supports a subset of registers from MCore. In reality,
|
||||
it doesn't support ss1, either. */
|
||||
static char *picobug_regnames[] = {
|
||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"psr", "vbr", "epsr", "fpsr", "epc", "fpc", 0, "ss1",
|
||||
"ss2", "ss3", "ss4", 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"pc" };
|
||||
|
||||
|
||||
|
||||
static void
|
||||
picobug_open (const char *args, int from_tty)
|
||||
{
|
||||
monitor_open (args, &picobug_cmds, from_tty);
|
||||
}
|
||||
/* We choose to write our own dumpregs routine, since the output of
|
||||
the register dumping is rather difficult to encapsulate in a
|
||||
regexp:
|
||||
|
||||
picobug> rd
|
||||
pc 2f00031e epc 2f00031e fpc 00000000
|
||||
psr 80000101 epsr 80000101 fpsr 00000000
|
||||
ss0-ss4 bad0beef 00000000 00000000 00000000 00000000 vbr 30005c00
|
||||
r0-r7 2f0fff4c 00000090 00000001 00000002 00000003 00000004 00000005 00000006
|
||||
r8-r15 2f0fff64 00000000 00000000 00000000 00000000 00000000 00000000 2f00031e
|
||||
*/
|
||||
|
||||
static int
|
||||
picobug_dumpregs (struct regcache *regcache)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
char buf[1024];
|
||||
int resp_len;
|
||||
char *p;
|
||||
|
||||
/* Send the dump register command to the monitor and
|
||||
get the reply. */
|
||||
monitor_printf (picobug_cmds.dump_registers);
|
||||
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
||||
|
||||
p = strtok (buf, " \t\r\n");
|
||||
while (p)
|
||||
{
|
||||
if (strchr (p, '-'))
|
||||
{
|
||||
/* Got a range. Either r0-r7, r8-r15 or ss0-ss4. */
|
||||
if (startswith (p, "r0") || startswith (p, "r8"))
|
||||
{
|
||||
int rn = (p[1] == '0' ? 0 : 8);
|
||||
int i = 0;
|
||||
|
||||
/* Get the next 8 values and record them. */
|
||||
while (i < 8)
|
||||
{
|
||||
p = strtok (NULL, " \t\r\n");
|
||||
if (p)
|
||||
monitor_supply_register (regcache, rn + i, p);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else if (startswith (p, "ss"))
|
||||
{
|
||||
/* Get the next five values, ignoring the first. */
|
||||
int rn;
|
||||
p = strtok (NULL, " \t\r\n");
|
||||
for (rn = 39; rn < 43; rn++)
|
||||
{
|
||||
p = strtok (NULL, " \t\r\n");
|
||||
if (p)
|
||||
monitor_supply_register (regcache, rn, p);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Simple register type, paired. */
|
||||
char *name = p;
|
||||
int i;
|
||||
|
||||
/* Get and record value. */
|
||||
p = strtok (NULL, " \t\r\n");
|
||||
if (p)
|
||||
{
|
||||
for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
|
||||
{
|
||||
if (picobug_regnames[i]
|
||||
&& strcmp (picobug_regnames[i], name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i <= gdbarch_num_regs (gdbarch))
|
||||
monitor_supply_register (regcache, i, p);
|
||||
}
|
||||
}
|
||||
p = strtok (NULL, " \t\r\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
init_picobug_cmds (void)
|
||||
{
|
||||
picobug_cmds.flags = MO_GETMEM_NEEDS_RANGE | MO_CLR_BREAK_USES_ADDR
|
||||
| MO_PRINT_PROGRAM_OUTPUT;
|
||||
|
||||
picobug_cmds.init = picobug_inits; /* Init strings */
|
||||
picobug_cmds.cont = "g\n"; /* continue command */
|
||||
picobug_cmds.step = "s\n"; /* single step */
|
||||
picobug_cmds.set_break = "br %x\n"; /* set a breakpoint */
|
||||
picobug_cmds.clr_break = "nobr %x\n"; /* clear a breakpoint */
|
||||
picobug_cmds.clr_all_break = "nobr\n"; /* clear all breakpoints */
|
||||
picobug_cmds.setmem.cmdb = "mm %x %x ;b\n"; /* setmem.cmdb (addr, value) */
|
||||
picobug_cmds.setmem.cmdw = "mm %x %x ;h\n"; /* setmem.cmdw (addr, value) */
|
||||
picobug_cmds.setmem.cmdl = "mm %x %x ;w\n"; /* setmem.cmdl (addr, value) */
|
||||
picobug_cmds.getmem.cmdb = "md %x %x\n"; /* getmem.cmdb (start addr,
|
||||
end addr) */
|
||||
picobug_cmds.getmem.resp_delim = ":"; /* getmem.resp_delim */
|
||||
picobug_cmds.setreg.cmd = "rm %s %x\n"; /* setreg.cmd (name, value) */
|
||||
picobug_cmds.getreg.cmd = "rd %s\n"; /* getreg.cmd (name) */
|
||||
picobug_cmds.getreg.resp_delim = ":"; /* getreg.resp_delim */
|
||||
picobug_cmds.dump_registers = "rd\n"; /* dump_registers */
|
||||
picobug_cmds.dumpregs = picobug_dumpregs; /* dump registers parser */
|
||||
picobug_cmds.load = "lo\n"; /* download command */
|
||||
picobug_cmds.prompt = "picobug> "; /* monitor command prompt */
|
||||
picobug_cmds.line_term = "\n"; /* end-of-line terminator */
|
||||
picobug_cmds.target = &picobug_ops; /* target operations */
|
||||
picobug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
||||
picobug_cmds.regnames = picobug_regnames; /* registers names */
|
||||
picobug_cmds.num_breakpoints = 20; /* number of breakpoints */
|
||||
picobug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_picobug_rom (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Initialize m32r RevC monitor target. */
|
||||
init_picobug_cmds ();
|
||||
init_monitor_ops (&picobug_ops);
|
||||
picobug_ops.to_shortname = "picobug";
|
||||
picobug_ops.to_longname = "picobug monitor";
|
||||
picobug_ops.to_doc = "Debug via the picobug monitor.\n\
|
||||
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
||||
picobug_ops.to_open = picobug_open;
|
||||
|
||||
add_target (&picobug_ops);
|
||||
}
|
2417
gdb/monitor.c
2417
gdb/monitor.c
File diff suppressed because it is too large
Load Diff
261
gdb/monitor.h
261
gdb/monitor.h
@ -1,261 +0,0 @@
|
||||
/* Definitions for remote debugging interface for ROM monitors.
|
||||
Copyright (C) 1990-2015 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef MONITOR_H
|
||||
#define MONITOR_H
|
||||
|
||||
struct target_waitstatus;
|
||||
struct serial;
|
||||
|
||||
/* This structure describes the strings necessary to give small command
|
||||
sequences to the monitor, and parse the response.
|
||||
|
||||
CMD is the actual command typed at the monitor. Usually this has
|
||||
embedded sequences ala printf, which are substituted with the
|
||||
arguments appropriate to that type of command. Ie: to examine a
|
||||
register, we substitute the register name for the first arg. To
|
||||
modify memory, we substitute the memory location and the new
|
||||
contents for the first and second args, etc...
|
||||
|
||||
RESP_DELIM used to home in on the response string, and is used to
|
||||
disambiguate the answer within the pile of text returned by the
|
||||
monitor. This should be a unique string that immediately precedes
|
||||
the answer. Ie: if your monitor prints out `PC: 00000001= ' in
|
||||
response to asking for the PC, you should use `: ' as the
|
||||
RESP_DELIM. RESP_DELIM may be NULL if the res- ponse is going to
|
||||
be ignored, or has no particular leading text.
|
||||
|
||||
TERM is the string that the monitor outputs to indicate that it is
|
||||
idle, and waiting for input. This is usually a prompt of some
|
||||
sort. In the previous example, it would be `= '. It is important
|
||||
that TERM really means that the monitor is idle, otherwise GDB may
|
||||
try to type at it when it isn't ready for input. This is a problem
|
||||
because many monitors cannot deal with type-ahead. TERM may be
|
||||
NULL if the normal prompt is output.
|
||||
|
||||
TERM_CMD is used to quit out of the subcommand mode and get back to
|
||||
the main prompt. TERM_CMD may be NULL if it isn't necessary. It
|
||||
will also be ignored if TERM is NULL. */
|
||||
|
||||
struct memrw_cmd
|
||||
{
|
||||
char *cmdb; /* Command to send for byte read/write */
|
||||
char *cmdw; /* Command for word (16 bit) read/write */
|
||||
char *cmdl; /* Command for long (32 bit) read/write */
|
||||
char *cmdll; /* Command for long long (64 bit) read/write */
|
||||
char *resp_delim; /* String just prior to the desired value */
|
||||
char *term; /* Terminating string to search for */
|
||||
char *term_cmd; /* String to get out of sub-mode (if
|
||||
necessary) */
|
||||
};
|
||||
|
||||
struct regrw_cmd
|
||||
{
|
||||
char *cmd; /* Command to send for reg read/write */
|
||||
char *resp_delim; /* String (actually a regexp if getmem) just
|
||||
prior to the desired value */
|
||||
char *term; /* Terminating string to search for */
|
||||
char *term_cmd; /* String to get out of sub-mode (if
|
||||
necessary) */
|
||||
};
|
||||
|
||||
struct monitor_ops
|
||||
{
|
||||
int flags; /* See below */
|
||||
char **init; /* List of init commands. NULL terminated. */
|
||||
char *cont; /* continue command */
|
||||
char *step; /* single step */
|
||||
char *stop; /* Interrupt program string */
|
||||
char *set_break; /* set a breakpoint. If NULL, monitor
|
||||
implementation sets its own
|
||||
to_insert_breakpoint method. */
|
||||
char *clr_break; /* clear a breakpoint */
|
||||
char *clr_all_break; /* Clear all breakpoints */
|
||||
char *fill; /* Memory fill cmd (addr len val) */
|
||||
struct memrw_cmd setmem; /* set memory to a value */
|
||||
struct memrw_cmd getmem; /* display memory */
|
||||
struct regrw_cmd setreg; /* set a register */
|
||||
struct regrw_cmd getreg; /* get a register */
|
||||
/* Some commands can dump a bunch of registers
|
||||
at once. This comes as a set of REG=VAL
|
||||
pairs. This should be called for each pair
|
||||
of registers that we can parse to supply
|
||||
GDB with the value of a register. */
|
||||
char *dump_registers; /* Command to dump all regs at once */
|
||||
char *register_pattern; /* Pattern that picks out register
|
||||
from reg dump */
|
||||
void (*supply_register) (struct regcache *regcache, char *name,
|
||||
int namelen, char *val, int vallen);
|
||||
int (*dumpregs) (struct regcache *); /* Dump all registers */
|
||||
int (*continue_hook) (void); /* Emit the continue command */
|
||||
int (*wait_filter) (char *buf, /* Maybe contains registers */
|
||||
int bufmax,
|
||||
int *response_length,
|
||||
struct target_waitstatus * status);
|
||||
char *load; /* load command */
|
||||
char *loadresp; /* Response to load command */
|
||||
char *prompt; /* monitor command prompt */
|
||||
char *line_term; /* end-of-command delimitor */
|
||||
char *cmd_end; /* optional command terminator */
|
||||
struct target_ops *target; /* target operations */
|
||||
int stopbits; /* number of stop bits */
|
||||
char **regnames; /* array of register names in ascii */
|
||||
/* deprecated: use regname instead */
|
||||
const char *(*regname) (int index);
|
||||
/* function for dynamic regname array */
|
||||
int num_breakpoints; /* If set_break != NULL, number of supported
|
||||
breakpoints */
|
||||
int magic; /* Check value */
|
||||
};
|
||||
|
||||
/* The monitor ops magic number, used to detect if an ops structure doesn't
|
||||
have the right number of entries filled in. */
|
||||
|
||||
#define MONITOR_OPS_MAGIC 600925
|
||||
|
||||
/* Flag definitions. */
|
||||
|
||||
/* If set, then clear breakpoint command uses address, otherwise it
|
||||
uses an index returned by the monitor. */
|
||||
|
||||
#define MO_CLR_BREAK_USES_ADDR 0x1
|
||||
|
||||
/* If set, then memory fill command uses STARTADDR, ENDADDR+1, VALUE
|
||||
as args, else it uses STARTADDR, LENGTH, VALUE as args. */
|
||||
|
||||
#define MO_FILL_USES_ADDR 0x2
|
||||
|
||||
/* If set, then monitor doesn't automatically supply register dump
|
||||
when coming back after a continue. */
|
||||
|
||||
#define MO_NEED_REGDUMP_AFTER_CONT 0x4
|
||||
|
||||
/* getmem needs start addr and end addr. */
|
||||
|
||||
#define MO_GETMEM_NEEDS_RANGE 0x8
|
||||
|
||||
/* getmem can only read one loc at a time. */
|
||||
|
||||
#define MO_GETMEM_READ_SINGLE 0x10
|
||||
|
||||
/* handle \r\n combinations. */
|
||||
|
||||
#define MO_HANDLE_NL 0x20
|
||||
|
||||
/* don't expect echos in monitor_open. */
|
||||
|
||||
#define MO_NO_ECHO_ON_OPEN 0x40
|
||||
|
||||
/* If set, send break to stop monitor. */
|
||||
|
||||
#define MO_SEND_BREAK_ON_STOP 0x80
|
||||
|
||||
/* If set, target sends an ACK after each S-record. */
|
||||
|
||||
#define MO_SREC_ACK 0x100
|
||||
|
||||
/* Allow 0x prefix on addresses retured from monitor. */
|
||||
|
||||
#define MO_HEX_PREFIX 0x200
|
||||
|
||||
/* Some monitors require a different command when starting a program. */
|
||||
|
||||
#define MO_RUN_FIRST_TIME 0x400
|
||||
|
||||
/* Don't expect echos when getting memory */
|
||||
|
||||
#define MO_NO_ECHO_ON_SETMEM 0x800
|
||||
|
||||
/* If set, then register store command expects value BEFORE regname. */
|
||||
|
||||
#define MO_REGISTER_VALUE_FIRST 0x1000
|
||||
|
||||
/* If set, then the monitor displays registers as pairs. */
|
||||
|
||||
#define MO_32_REGS_PAIRED 0x2000
|
||||
|
||||
/* If set, then register setting happens interactively. */
|
||||
|
||||
#define MO_SETREG_INTERACTIVE 0x4000
|
||||
|
||||
/* If set, then memory setting happens interactively. */
|
||||
|
||||
#define MO_SETMEM_INTERACTIVE 0x8000
|
||||
|
||||
/* If set, then memory dumps are always on 16-byte boundaries, even
|
||||
when less is desired. */
|
||||
|
||||
#define MO_GETMEM_16_BOUNDARY 0x10000
|
||||
|
||||
/* If set, then the monitor numbers its breakpoints starting from 1. */
|
||||
|
||||
#define MO_CLR_BREAK_1_BASED 0x20000
|
||||
|
||||
/* If set, then the monitor acks srecords with a plus sign. */
|
||||
|
||||
#define MO_SREC_ACK_PLUS 0x40000
|
||||
|
||||
/* If set, then the monitor "acks" srecords with rotating lines. */
|
||||
|
||||
#define MO_SREC_ACK_ROTATE 0x80000
|
||||
|
||||
/* If set, then remove useless address bits from memory addresses. */
|
||||
|
||||
#define MO_ADDR_BITS_REMOVE 0x100000
|
||||
|
||||
/* If set, then display target program output if prefixed by ^O. */
|
||||
|
||||
#define MO_PRINT_PROGRAM_OUTPUT 0x200000
|
||||
|
||||
/* Some dump bytes commands align the first data with the preceding
|
||||
16 byte boundary. Some print blanks and start at the exactly the
|
||||
requested boundary. */
|
||||
|
||||
#define MO_EXACT_DUMPADDR 0x400000
|
||||
|
||||
/* Rather entering and exiting the write memory dialog for each word byte,
|
||||
we can save time by transferring the whole block without exiting
|
||||
the memory editing mode. You only need to worry about this
|
||||
if you are doing memory downloading.
|
||||
This engages a new write function registered with dcache. */
|
||||
|
||||
#define MO_HAS_BLOCKWRITES 0x800000
|
||||
|
||||
#define SREC_SIZE 160
|
||||
|
||||
extern void monitor_open (const char *args, struct monitor_ops *ops,
|
||||
int from_tty);
|
||||
extern void monitor_close (struct target_ops *self);
|
||||
extern char *monitor_supply_register (struct regcache *regcache,
|
||||
int regno, char *valstr);
|
||||
extern int monitor_expect (char *prompt, char *buf, int buflen);
|
||||
extern int monitor_expect_prompt (char *buf, int buflen);
|
||||
/* Note: The variable argument functions monitor_printf and
|
||||
monitor_printf_noecho vararg do not take take standard format style
|
||||
arguments. Instead they take custom formats interpretered directly
|
||||
by monitor_vsprintf. */
|
||||
extern void monitor_printf (char *, ...);
|
||||
extern void monitor_printf_noecho (char *, ...);
|
||||
extern void monitor_write (char *buf, int buflen);
|
||||
extern int monitor_readchar (void);
|
||||
extern char *monitor_get_dev_name (void);
|
||||
extern void init_monitor_ops (struct target_ops *);
|
||||
extern int monitor_dump_reg_block (struct regcache *regcache, char *dump_cmd);
|
||||
|
||||
#endif
|
224
gdb/ppcbug-rom.c
224
gdb/ppcbug-rom.c
@ -1,224 +0,0 @@
|
||||
/* Remote debugging interface for PPCbug (PowerPC) Rom monitor
|
||||
for GDB, the GNU debugger.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
|
||||
Written by Stu Grossman 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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "defs.h"
|
||||
#include "gdbcore.h"
|
||||
#include "target.h"
|
||||
#include "monitor.h"
|
||||
#include "serial.h"
|
||||
#include "regcache.h"
|
||||
|
||||
static void
|
||||
ppcbug_supply_register (struct regcache *regcache, char *regname,
|
||||
int regnamelen, char *val, int vallen)
|
||||
{
|
||||
int regno = 0;
|
||||
|
||||
if (regnamelen < 2 || regnamelen > 4)
|
||||
return;
|
||||
|
||||
switch (regname[0])
|
||||
{
|
||||
case 'R':
|
||||
if (regname[1] < '0' || regname[1] > '9')
|
||||
return;
|
||||
if (regnamelen == 2)
|
||||
regno = regname[1] - '0';
|
||||
else if (regnamelen == 3 && regname[2] >= '0' && regname[2] <= '9')
|
||||
regno = (regname[1] - '0') * 10 + (regname[2] - '0');
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case 'F':
|
||||
if (regname[1] != 'R' || regname[2] < '0' || regname[2] > '9')
|
||||
return;
|
||||
if (regnamelen == 3)
|
||||
regno = 32 + regname[2] - '0';
|
||||
else if (regnamelen == 4 && regname[3] >= '0' && regname[3] <= '9')
|
||||
regno = 32 + (regname[2] - '0') * 10 + (regname[3] - '0');
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case 'I':
|
||||
if (regnamelen != 2 || regname[1] != 'P')
|
||||
return;
|
||||
regno = 64;
|
||||
break;
|
||||
case 'M':
|
||||
if (regnamelen != 3 || regname[1] != 'S' || regname[2] != 'R')
|
||||
return;
|
||||
regno = 65;
|
||||
break;
|
||||
case 'C':
|
||||
if (regnamelen != 2 || regname[1] != 'R')
|
||||
return;
|
||||
regno = 66;
|
||||
break;
|
||||
case 'S':
|
||||
if (regnamelen != 4 || regname[1] != 'P' || regname[2] != 'R')
|
||||
return;
|
||||
else if (regname[3] == '8')
|
||||
regno = 67;
|
||||
else if (regname[3] == '9')
|
||||
regno = 68;
|
||||
else if (regname[3] == '1')
|
||||
regno = 69;
|
||||
else if (regname[3] == '0')
|
||||
regno = 70;
|
||||
else
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
monitor_supply_register (regcache, regno, val);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 *ppcbug_regnames[] =
|
||||
{
|
||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||||
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
||||
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
|
||||
|
||||
"fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
|
||||
"fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
|
||||
"fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
|
||||
"fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31",
|
||||
|
||||
/* pc ps cnd lr cnt xer mq */
|
||||
"ip", "msr", "cr", "spr8", "spr9", "spr1", "spr0"
|
||||
};
|
||||
|
||||
/*
|
||||
* Define the monitor command strings. Since these are passed directly
|
||||
* through to a printf style function, we need can include formatting
|
||||
* strings. We also need a CR or LF on the end.
|
||||
*/
|
||||
|
||||
static struct target_ops ppcbug_ops0;
|
||||
static struct target_ops ppcbug_ops1;
|
||||
|
||||
static char *ppcbug_inits[] =
|
||||
{"\r", NULL};
|
||||
|
||||
static void
|
||||
init_ppc_cmds (char *LOAD_CMD,
|
||||
struct monitor_ops *OPS,
|
||||
struct target_ops *targops)
|
||||
{
|
||||
OPS->flags = MO_CLR_BREAK_USES_ADDR | MO_HANDLE_NL;
|
||||
OPS->init = ppcbug_inits; /* Init strings */
|
||||
OPS->cont = "g\r"; /* continue command */
|
||||
OPS->step = "t\r"; /* single step */
|
||||
OPS->stop = NULL; /* interrupt command */
|
||||
OPS->set_break = "br %x\r"; /* set a breakpoint */
|
||||
OPS->clr_break = "nobr %x\r"; /* clear a breakpoint */
|
||||
OPS->clr_all_break = "nobr\r"; /* clear all breakpoints */
|
||||
OPS->fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
|
||||
OPS->setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
|
||||
OPS->setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
|
||||
OPS->setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
|
||||
OPS->setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
|
||||
OPS->setmem.resp_delim = NULL; /* setreg.resp_delim */
|
||||
OPS->setmem.term = NULL; /* setreg.term */
|
||||
OPS->setmem.term_cmd = NULL; /* setreg.term_cmd */
|
||||
OPS->getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
|
||||
OPS->getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
|
||||
OPS->getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
|
||||
OPS->getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
|
||||
OPS->getmem.resp_delim = " "; /* getmem.resp_delim */
|
||||
OPS->getmem.term = NULL; /* getmem.term */
|
||||
OPS->getmem.term_cmd = NULL; /* getmem.term_cmd */
|
||||
OPS->setreg.cmd = "rs %s %x\r"; /* setreg.cmd (name, value) */
|
||||
OPS->setreg.resp_delim = NULL; /* setreg.resp_delim */
|
||||
OPS->setreg.term = NULL; /* setreg.term */
|
||||
OPS->setreg.term_cmd = NULL; /* setreg.term_cmd */
|
||||
OPS->getreg.cmd = "rs %s\r"; /* getreg.cmd (name) */
|
||||
OPS->getreg.resp_delim = "="; /* getreg.resp_delim */
|
||||
OPS->getreg.term = NULL; /* getreg.term */
|
||||
OPS->getreg.term_cmd = NULL; /* getreg.term_cmd */
|
||||
/* register_pattern */
|
||||
OPS->register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)";
|
||||
OPS->supply_register = ppcbug_supply_register;
|
||||
OPS->dump_registers = "rd\r"; /* dump all registers */
|
||||
OPS->load = LOAD_CMD; /* download command */
|
||||
OPS->loadresp = NULL; /* load response */
|
||||
OPS->prompt = "PPC1-Bug>"; /* monitor command prompt */
|
||||
OPS->line_term = "\r"; /* end-of-line terminator */
|
||||
OPS->cmd_end = NULL; /* optional command terminator */
|
||||
OPS->target = targops; /* target operations */
|
||||
OPS->stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
||||
OPS->regnames = ppcbug_regnames; /* registers names */
|
||||
OPS->magic = MONITOR_OPS_MAGIC; /* magic */
|
||||
}
|
||||
|
||||
|
||||
static struct monitor_ops ppcbug_cmds0;
|
||||
static struct monitor_ops ppcbug_cmds1;
|
||||
|
||||
static void
|
||||
ppcbug_open0 (const char *args, int from_tty)
|
||||
{
|
||||
monitor_open (args, &ppcbug_cmds0, from_tty);
|
||||
}
|
||||
|
||||
static void
|
||||
ppcbug_open1 (const char *args, int from_tty)
|
||||
{
|
||||
monitor_open (args, &ppcbug_cmds1, from_tty);
|
||||
}
|
||||
|
||||
extern initialize_file_ftype _initialize_ppcbug_rom; /* -Wmissing-prototypes */
|
||||
|
||||
void
|
||||
_initialize_ppcbug_rom (void)
|
||||
{
|
||||
init_ppc_cmds ("lo 0\r", &ppcbug_cmds0, &ppcbug_ops0);
|
||||
init_ppc_cmds ("lo 1\r", &ppcbug_cmds1, &ppcbug_ops1);
|
||||
init_monitor_ops (&ppcbug_ops0);
|
||||
|
||||
ppcbug_ops0.to_shortname = "ppcbug";
|
||||
ppcbug_ops0.to_longname = "PowerPC PPCBug monitor on port 0";
|
||||
ppcbug_ops0.to_doc = "Debug via the PowerPC PPCBug monitor using port 0.\n\
|
||||
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
||||
ppcbug_ops0.to_open = ppcbug_open0;
|
||||
|
||||
add_target (&ppcbug_ops0);
|
||||
|
||||
init_monitor_ops (&ppcbug_ops1);
|
||||
|
||||
ppcbug_ops1.to_shortname = "ppcbug1";
|
||||
ppcbug_ops1.to_longname = "PowerPC PPCBug monitor on port 1";
|
||||
ppcbug_ops1.to_doc = "Debug via the PowerPC PPCBug monitor using port 1.\n\
|
||||
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
||||
ppcbug_ops1.to_open = ppcbug_open1;
|
||||
|
||||
add_target (&ppcbug_ops1);
|
||||
}
|
35
gdb/srec.h
35
gdb/srec.h
@ -1,35 +0,0 @@
|
||||
/* S-record download support for GDB, the GNU debugger.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
struct serial;
|
||||
|
||||
void load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
||||
int maxrecsize, int flags, int hashmark,
|
||||
int (*waitack) (void));
|
||||
|
||||
/* S-record capability flags */
|
||||
|
||||
/* Which record types are supported */
|
||||
#define SREC_2_BYTE_ADDR 0x00000001
|
||||
#define SREC_3_BYTE_ADDR 0x00000002
|
||||
#define SREC_4_BYTE_ADDR 0x00000004
|
||||
#define SREC_TERM_SHIFT 3
|
||||
|
||||
#define SREC_ALL (SREC_2_BYTE_ADDR | SREC_3_BYTE_ADDR | SREC_4_BYTE_ADDR \
|
||||
| ((SREC_2_BYTE_ADDR | SREC_3_BYTE_ADDR | SREC_4_BYTE_ADDR) \
|
||||
<< SREC_TERM_SHIFT))
|
Loading…
Reference in New Issue
Block a user