Allow PPC users to select which PPC/RS6000 variant they're debugging
[deliverable/binutils-gdb.git] / gdb / dbug-rom.c
CommitLineData
4db54939
SS
1/* Remote debugging interface to dBUG ROM monitor for GDB, the GNU debugger.
2 Copyright 1996 Free Software Foundation, Inc.
3
4 Written by Stan Shebs of Cygnus Support.
5
6This file is part of GDB.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21
22/* dBUG is a monitor supplied on various Motorola boards, including
23 m68k, ColdFire, and PowerPC-based designs. The code here assumes
24 the ColdFire, and (as of 9/25/96) has only been tested with a
25 ColdFire IDP board. */
26
27#include "defs.h"
28#include "gdbcore.h"
29#include "target.h"
30#include "monitor.h"
31#include "serial.h"
32
33static void dbug_open PARAMS ((char *args, int from_tty));
34
35static void
36dbug_supply_register (regname, regnamelen, val, vallen)
37 char *regname;
38 int regnamelen;
39 char *val;
40 int vallen;
41{
42 int regno;
43
44 if (regnamelen != 2)
45 return;
46
47 switch (regname[0])
48 {
49 case 'S':
50 if (regname[1] != 'R')
51 return;
52 regno = PS_REGNUM;
53 break;
54 case 'P':
55 if (regname[1] != 'C')
56 return;
57 regno = PC_REGNUM;
58 break;
59 case 'D':
60 if (regname[1] < '0' || regname[1] > '7')
61 return;
62 regno = regname[1] - '0' + D0_REGNUM;
63 break;
64 case 'A':
65 if (regname[1] < '0' || regname[1] > '7')
66 return;
67 regno = regname[1] - '0' + A0_REGNUM;
68 break;
69 default:
70 return;
71 }
72
73 monitor_supply_register (regno, val);
74}
75
76/* This array of registers needs to match the indexes used by GDB. The
77 whole reason this exists is because the various ROM monitors use
78 different names than GDB does, and don't support all the registers
79 either. So, typing "info reg sp" becomes an "A7". */
80
81static char *dbug_regnames[NUM_REGS] =
82{
83 "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
84 "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
85 "SR", "PC"
86 /* no float registers */
87};
4db54939 88static struct target_ops dbug_ops;
5d460ad9 89static struct monitor_ops dbug_cmds ;
4db54939
SS
90
91static char *dbug_inits[] = {"\r", NULL};
92
5d460ad9 93
ba4d67c2
FN
94static void
95init_dbug_cmds(void)
4db54939 96{
5d460ad9
JM
97 dbug_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_GETMEM_NEEDS_RANGE | MO_FILL_USES_ADDR;
98 dbug_cmds.init = dbug_inits; /* Init strings */
99 dbug_cmds.cont = "go\r"; /* continue command */
100 dbug_cmds.step = "step\r"; /* single step */
101 dbug_cmds.stop = NULL; /* interrupt command */
102 dbug_cmds.set_break = "br %x\r"; /* set a breakpoint */
103 dbug_cmds.clr_break = "br -c %x\r"; /* clear a breakpoint */
104 dbug_cmds.clr_all_break = "br -c\r"; /* clear all breakpoints */
105 dbug_cmds.fill = "bf.b %x %x %x"; /* fill (start end val) */
106 dbug_cmds.setmem.cmdb = "mm.b %x %x\r"; /* setmem.cmdb (addr, value) */
107 dbug_cmds.setmem.cmdw = "mm.w %x %x\r"; /* setmem.cmdw (addr, value) */
108 dbug_cmds.setmem.cmdl = "mm.l %x %x\r"; /* setmem.cmdl (addr, value) */
109 dbug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
110 dbug_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
111 dbug_cmds.setmem.term = NULL; /* setmem.term */
112 dbug_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
113 dbug_cmds.getmem.cmdb = "md.b %x %x\r"; /* getmem.cmdb (addr, addr2) */
114 dbug_cmds.getmem.cmdw = "md.w %x %x\r"; /* getmem.cmdw (addr, addr2) */
115 dbug_cmds.getmem.cmdl = "md.l %x %x\r"; /* getmem.cmdl (addr, addr2) */
116 dbug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, addr2) */
117 dbug_cmds.getmem.resp_delim = ":"; /* getmem.resp_delim */
118 dbug_cmds.getmem.term = NULL; /* getmem.term */
119 dbug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
120 dbug_cmds.setreg.cmd = "rm %s %x\r"; /* setreg.cmd (name, value) */
121 dbug_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
122 dbug_cmds.setreg.term = NULL; /* setreg.term */
123 dbug_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
124 dbug_cmds.getreg.cmd = "rd %s\r"; /* getreg.cmd (name) */
125 dbug_cmds.getreg.resp_delim = ":"; /* getreg.resp_delim */
126 dbug_cmds.getreg.term = NULL; /* getreg.term */
127 dbug_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
128 dbug_cmds.dump_registers = "rd\r"; /* dump_registers */
129 dbug_cmds.register_pattern = "\\(\\w+\\) +:\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
130 dbug_cmds.supply_register = dbug_supply_register; /* supply_register */
131 dbug_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
132 dbug_cmds.load = "dl\r"; /* download command */
133 dbug_cmds.loadresp = "\n"; /* load response */
134 dbug_cmds.prompt = "dBUG>"; /* monitor command prompt */
135 dbug_cmds.line_term = "\r"; /* end-of-line terminator */
136 dbug_cmds.cmd_end = NULL; /* optional command terminator */
137 dbug_cmds.target = &dbug_ops ; /* target operations */
138 dbug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
139 dbug_cmds.regnames = dbug_regnames; /* registers names */
140 dbug_cmds.magic = MONITOR_OPS_MAGIC ; /* magic */
141} /* init_debug_ops */
4db54939
SS
142
143static void
144dbug_open(args, from_tty)
145 char *args;
146 int from_tty;
147{
148 monitor_open (args, &dbug_cmds, from_tty);
149}
150
151void
152_initialize_dbug_rom ()
153{
5d460ad9 154 init_dbug_cmds() ;
4db54939
SS
155 init_monitor_ops (&dbug_ops);
156
157 dbug_ops.to_shortname = "dbug";
158 dbug_ops.to_longname = "dBUG monitor";
159 dbug_ops.to_doc = "Debug via the dBUG monitor.\n\
160Specify the serial device it is connected to (e.g. /dev/ttya).";
161 dbug_ops.to_open = dbug_open;
162
163 add_target (&dbug_ops);
164}
This page took 0.150601 seconds and 4 git commands to generate.