diff options
author | Stan Shebs <shebs@codesourcery.com> | 1997-08-12 02:34:14 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1997-08-12 02:34:14 +0000 |
commit | 339cddf717d3db8d865fba90584cb0e1110a6b60 (patch) | |
tree | 272fbf7d90e13c4267689e1b4383248c6f031fab /gdb | |
parent | 2549d2b38572740e9ce0ec4f517f5b8357ea51e0 (diff) | |
download | gdb-339cddf717d3db8d865fba90584cb0e1110a6b60.zip gdb-339cddf717d3db8d865fba90584cb0e1110a6b60.tar.gz gdb-339cddf717d3db8d865fba90584cb0e1110a6b60.tar.bz2 |
* dink32-rom.c: New file, support for DINK32 monitor.
* Makefile.in (dink32-rom.o): Add build rule.
* config/powerpc/ppc-eabi.mt, config/powerpc/ppc-sim.mt
(TDEPFILES): Add dink32-rom.o.
* monitor.h (MO_32_REGS_PAIRED, MO_SETREG_INTERACTIVE,
MO_SETMEM_INTERACTIVE, MO_GETMEM_16_BOUNDARY,
MO_CLR_BREAK_1_BASED): New monitor interface flags.
* monitor.c: Use them.
(monitor_store_register): Use setreg.term if defined.
(monitor_insert_breakpoint, monitor_remove_breakpoint): Notice
if set_break and clr_break fields are empty.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 32 | ||||
-rw-r--r-- | gdb/Makefile.in | 28 | ||||
-rw-r--r-- | gdb/config/powerpc/ppc-eabi.mt | 2 | ||||
-rw-r--r-- | gdb/config/powerpc/ppc-sim.mt | 4 | ||||
-rw-r--r-- | gdb/dink32-rom.c | 192 | ||||
-rw-r--r-- | gdb/monitor.h | 21 |
6 files changed, 258 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 77821a6..36c1c53 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,20 +1,34 @@ +Mon Aug 11 19:16:04 1997 Stan Shebs <shebs@andros.cygnus.com> + + * dink32-rom.c: New file, support for DINK32 monitor. + * Makefile.in (dink32-rom.o): Add build rule. + * config/powerpc/ppc-eabi.mt, config/powerpc/ppc-sim.mt + (TDEPFILES): Add dink32-rom.o. + * monitor.h (MO_32_REGS_PAIRED, MO_SETREG_INTERACTIVE, + MO_SETMEM_INTERACTIVE, MO_GETMEM_16_BOUNDARY, + MO_CLR_BREAK_1_BASED): New monitor interface flags. + * monitor.c: Use them. + (monitor_store_register): Use setreg.term if defined. + (monitor_insert_breakpoint, monitor_remove_breakpoint): Notice + if set_break and clr_break fields are empty. + Mon Aug 11 16:22:36 1997 Geoffrey Noer <noer@cygnus.com> - * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): macro + * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Macro BDM_BREAKPOINT already has braces around it, remove erroneous ones. - * ser-ocd.c (ocd_write): conditionalize on _WIN32 instead of - __CYGWIN32__ - * config/powerpc/tm-ppc-eabi.h: remove BDM_NUM_REGS, BDM_REGMAP + * ser-ocd.c (ocd_write): Conditionalize on _WIN32 instead of + __CYGWIN32__. + * config/powerpc/tm-ppc-eabi.h: Remove BDM_NUM_REGS, BDM_REGMAP * ppc-bdm.c: move BDM_NUM_REGS, BDM_REGMAP here from tm.h file, fill in doc fields of bdm_ppc_ops. - (bdm_ppc_fetch_registers): don't ask for invalid registers such - as the MQ or floating point regs not present on ppc 8xx boards - (bdm_ppc_store_registers): don't write those same invalid registers - * config/i386/cygwin32.mh: stop including ocd.o ser-ocd.o + (bdm_ppc_fetch_registers): Don't ask for invalid registers such + as the MQ or floating point regs not present on ppc 8xx boards. + (bdm_ppc_store_registers): Don't write those same invalid registers. + * config/i386/cygwin32.mh: Stop including ocd.o ser-ocd.o. * config/powerpc/ppc-eabi.mt: * config/powerpc/ppcle-eabi.mt: * config/powerpc/ppc-sim.mt: - * config/powerpc/ppcle-sim.mt: include ser-ocd.o + * config/powerpc/ppcle-sim.mt: Include ser-ocd.o. Mon Aug 11 16:08:52 1997 Fred Fish <fnf@cygnus.com> diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 99309c1..0949812 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -575,16 +575,23 @@ install-only: $(INSTALL_DATA) $(srcdir)/gdb.1 $(man1dir)/$$transformed_name.1 # start-sanitize-gdbtk if [ x"$(ENABLE_GDBTK)" != x ] ; then \ - if [ ! -d $(datadir)/gdbtcl ]; then \ - echo "Making directory gdbtcl"; \ - mkdir $(datadir)/gdbtcl; \ - chmod 755 $(datadir)/gdbtcl; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl ; \ + if [ x"$(ENABLE_IDE)" = x ]; then \ + cd $(srcdir)/gdbtcl ; \ + for i in asm.tcl break.xbm breakpoint.tcl command.tcl copyright.tcl expr.tcl file.tcl main.tcl register.tcl source.tcl stop2.gif tclIndex ; \ + do \ + $(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \ + done ; \ + else \ + $(SHELL) $(srcdir)/../mkinstalldirs \ + $(datadir)/gdbtcl/images \ + $(datadir)/gdbtcl/images2 ; \ + cd $(srcdir)/gdbtcl2 ; \ + for i in *.tcl images/*.gif images2/*.gif; \ + do \ + $(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \ + done ; \ fi ; \ - cd $(srcdir)/gdbtcl ; \ - for i in asm.tcl break.xbm breakpoint.tcl command.tcl copyright.tcl expr.tcl file.tcl main.tcl register.tcl source.tcl stop2.gif tclIndex ; \ - do \ - $(INSTALL_DATA) $$i $(datadir)/gdbtcl/$$i ; \ - done ; \ else \ true ; \ fi @@ -1152,6 +1159,9 @@ delta68-nat.o: delta68-nat.c $(defs_h) demangle.o: demangle.c $(defs_h) $(gdbcmd_h) gdb_string.h +dink32-rom.o: dink32-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \ + $(inferior_h) target.h serial.h terminal.h + dpx2-nat.o: dpx2-nat.c $(defs_h) $(gdbcore_h) gdb_string.h dstread.o: dstread.c gdb_string.h diff --git a/gdb/config/powerpc/ppc-eabi.mt b/gdb/config/powerpc/ppc-eabi.mt index f106d24..ba68196 100644 --- a/gdb/config/powerpc/ppc-eabi.mt +++ b/gdb/config/powerpc/ppc-eabi.mt @@ -1,3 +1,3 @@ # Target: PowerPC running eabi -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ser-ocd.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o ser-ocd.o TM_FILE= tm-ppc-eabi.h diff --git a/gdb/config/powerpc/ppc-sim.mt b/gdb/config/powerpc/ppc-sim.mt index f659e77..43628c1 100644 --- a/gdb/config/powerpc/ppc-sim.mt +++ b/gdb/config/powerpc/ppc-sim.mt @@ -1,5 +1,5 @@ -# Target: PowerPC running eabi under the simulator -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ser-ocd.o +# Target: PowerPC running eabi and including the simulator +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o ser-ocd.o TM_FILE= tm-ppc-eabi.h SIM_OBS = remote-sim.o diff --git a/gdb/dink32-rom.c b/gdb/dink32-rom.c new file mode 100644 index 0000000..a2d0326 --- /dev/null +++ b/gdb/dink32-rom.c @@ -0,0 +1,192 @@ +/* Remote debugging interface for DINK32 (PowerPC) ROM monitor for + GDB, the GNU debugger. + Copyright 1997 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 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. */ + +#include "defs.h" +#include "gdbcore.h" +#include "target.h" +#include "monitor.h" +#include "serial.h" + +static void dink32_open PARAMS ((char *args, int from_tty)); + +static void +dink32_supply_register (regname, regnamelen, val, vallen) + char *regname; + int regnamelen; + char *val; + int vallen; +{ + int regno = 0, base = 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 (regno, val); +} + +static void +dink32_load (monops, filename, from_tty) + struct monitor_ops *monops; + char *filename; + int from_tty; +{ + extern int inferior_pid; + + generic_load (filename, from_tty); + + /* Finally, make the PC point at the start address */ + if (exec_bfd) + write_pc (bfd_get_start_address (exec_bfd)); + + inferior_pid = 0; /* No process now */ +} + + +/* 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[NUM_REGS] = +{ + "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", + + "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 (args, from_tty) + char *args; + int from_tty; +{ + monitor_open (args, &dink32_cmds, from_tty); +} + +void +_initialize_dink32_rom () +{ + 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; + 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"; + dink32_cmds.fill = "mf %x %x %x\r"; + 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; + dink32_cmds.load = "dl -k\r"; + dink32_cmds.load_routine = dink32_load; + 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); +} diff --git a/gdb/monitor.h b/gdb/monitor.h index 7847174..33ef9a9 100644 --- a/gdb/monitor.h +++ b/gdb/monitor.h @@ -168,6 +168,27 @@ struct monitor_ops #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 + #define SREC_SIZE 160 extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, |