* Makefile.in: Add rules for monitor.o and rom68k-rom.o to make

Sun make (with VPATH) work...

	* monitor.c monitor.h rom68k-rom.c:  Serious cleanup to make IDP
	(rom68k) target work right.
	* array-rom.c op50-rom.c w89k-rom.c:  Partial updates to new
	monitor.c interface.  More work needs to be done here.
	* config/m68k/tm-monitor.h:  Change DECR_PC_AFTER_BREAK to 0 to
	match the IDP monitor.  Also, set NUM_REGS to 18 cuz there's no
	floating-point for this card.
This commit is contained in:
Stu Grossman
1995-03-07 09:26:39 +00:00
parent 09374c9863
commit 1265e2d823
8 changed files with 530 additions and 1228 deletions

View File

@ -1,5 +1,16 @@
Tue Mar 7 00:23:47 1995 Stu Grossman (grossman@cygnus.com)
* Makefile.in: Add rules for monitor.o and rom68k-rom.o to make
Sun make (with VPATH) work...
* monitor.c monitor.h rom68k-rom.c: Serious cleanup to make IDP
(rom68k) target work right.
* array-rom.c op50-rom.c w89k-rom.c: Partial updates to new
monitor.c interface. More work needs to be done here.
* config/m68k/tm-monitor.h: Change DECR_PC_AFTER_BREAK to 0 to
match the IDP monitor. Also, set NUM_REGS to 18 cuz there's no
floating-point for this card.
* serial.h ser-go32.c ser-go32-para.c ser-mac.c ser-tcp.c
ser-unix.c: Add SERIAL_SETSTOPBITS to set the number of stopbits
(needed for IDP board?!?!?).

View File

@ -185,7 +185,7 @@ REGEX1 = regex.o
# you can use 'CLIBS=$(INSTALLED_LIBS)' 'CDEPS='
INSTALLED_LIBS=-lbfd -lreadline $(TERMCAP) -lopcodes -lmmalloc \
-liberty $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(ENABLE_CLIBS)
CLIBS = $(BFD) $(READLINE) $(OPCODES) $(MMALLOC) \
CLIBS = $(BFD) $(READLINE) $(OPCODES) $(MMALLOC) $(LIBIBERTY) \
$(ENABLE_CLIBS) $(TERMCAP) $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) \
$(LIBIBERTY)
CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(BFD) $(READLINE) $(OPCODES) \
@ -251,7 +251,7 @@ FLAGS_TO_PASS = \
CC_FOR_TARGET = ` \
if [ -f $${rootme}/../gcc/xgcc ] ; then \
if [ -f $${rootme}/../newlib/Makefile ] ; then \
echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/ -idirafter $${rootme}/newlib/targ-include -idirafter $${rootsrc}/../newlib/libc/include -nostdinc -L$${rootme}/../../newlib -B$${rootme}/../../newlib/; \
echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/ -idirafter $${rootme}/newlib/targ-include -idirafter $${rootsrc}/../newlib/libc/include -nostdinc -L$${rootme}/../newlib -B$${rootme}/../newlib/; \
else \
echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/; \
fi; \
@ -267,7 +267,7 @@ CXX = gcc
CXX_FOR_TARGET = ` \
if [ -f $${rootme}/../gcc/Makefile ] ; then \
if [ -f $${rootme}/../newlib/Makefile ] ; then \
echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/ -idirafter $${rootme}/newlib/targ-include -idirafter $${rootsrc}/../newlib/libc/include -nostdinc -L$${rootme}/../../newlib -B$${rootme}/../../newlib/; \
echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/ -idirafter $${rootme}/newlib/targ-include -idirafter $${rootsrc}/../newlib/libc/include -nostdinc -L$${rootme}/../newlib -B$${rootme}/../newlib/; \
else \
echo $${rootme}/../gcc/xgcc -B$${rootme}/../gcc/; \
fi; \
@ -1254,6 +1254,9 @@ mipsread.o: mipsread.c buildsym.h complaints.h $(bfd_h) $(defs_h) \
mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h
monitor.o: monitor.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h
news-xdep.o: news-xdep.c
Onindy.o: nindy-share/Onindy.c $(wait_h) nindy-share/block_io.h \
@ -1367,6 +1370,9 @@ remote-utils.o: remote-utils.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \
remote.o: remote.c $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
$(inferior_h) $(remote_utils_h) symfile.h terminal.h
rom68k-rom.o: rom68k-rom.c monitor.h $(bfd_h) $(wait_h) $(defs_h) $(gdbcmd_h) \
$(inferior_h) target.h serial.h terminal.h
rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) target.h
rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \

View File

@ -27,7 +27,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int baud_rate;
void array_open();
void monitor_open();
/*
* this array of registers need to match the indexes used by GDB. The
@ -45,14 +44,15 @@ extern int mips_set_processor_type();
* strings. We also need a CR or LF on the end.
*/
struct target_ops array_ops = {
static struct target_ops array_ops =
{
"array",
"Debug using the standard GDB remote protocol for the Array Tech target.",
"Debug using the standard GDB remote protocol for the Array Tech target.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).",
array_open,
monitor_close,
monitor_attach,
NULL,
monitor_detach,
monitor_resume,
monitor_wait,
@ -89,7 +89,11 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
OPS_MAGIC, /* Always the last thing */
};
struct monitor_ops array_cmds = {
static char *array_loadtypes[] = {"none", "srec", "default", NULL};
static char *array_loadprotos[] = {"none", NULL};
static struct monitor_ops array_cmds =
{
0, /* 1 for ASCII, 0 for binary */
"$?#b8+\n", /* monitor init string */
"go %x\n", /* execute or usually GO command */
@ -123,10 +127,10 @@ struct monitor_ops array_cmds = {
"", /* end-of-command delimitor */
"", /* optional command terminator */
&array_ops, /* target operations */
"none,srec,default", /* load types */
"none", /* load protocols */
array_loadtypes, /* loadtypes */
array_loadprotos, /* loadprotos */
"4800", /* supported baud rates */
2, /* number of stop bits */
SERIAL_2_STOPBITS, /* number of stop bits */
array_regnames /* registers names */
};
@ -141,12 +145,7 @@ array_open(args, from_tty)
tmp_mips_processor_type = "lsi33k"; /* change the default from r3051 */
mips_set_processor_type_command ("lsi33k", 0);
baud_rate = 4800; /* this is the only supported baud rate */
target_preopen(from_tty);
push_target (&array_ops);
push_monitor (&array_cmds);
monitor_open (args, "array", from_tty);
monitor_open (args, &array_cmds, from_tty);
}
/*
@ -156,6 +155,7 @@ void
_initialize_array ()
{
add_target (&array_ops);
baud_rate = 4800; /* this is the only supported baud rate */
}

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,41 @@ struct rom_cmd_data {
char *result; /* the result */
};
/* 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 cmd_resp {
char *cmd; /* Command to send */
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 monitor_ops {
int type; /* 1 is ascii, 0 is GDB remote protocol */
char *init; /* initialize to the monitor */
@ -37,17 +72,17 @@ struct monitor_ops {
char *set_break; /* set a breakpoint */
char *clr_break; /* clear a breakpoint */
int clr_type; /* number or address for clearing */
struct rom_cmd_data setmem; /* set memory to a value */
struct rom_cmd_data getmem; /* display memory */
struct rom_cmd_data regset; /* set a register */
struct rom_cmd_data regget; /* read a register */
struct cmd_resp setmem; /* set memory to a value */
struct cmd_resp getmem; /* display memory */
struct cmd_resp setreg; /* set a register */
struct cmd_resp getreg; /* get a register */
char *load; /* load command */
char *prompt; /* monitor command prompt */
char *cmd_delim; /* end-of-command delimitor */
char *cmd_end; /* optional command terminator */
struct target_ops *target; /* target operations */
char *loadtypes; /* the load types that are supported */
char *loadprotos; /* the load protocols that are supported */
char **loadtypes; /* the load types that are supported */
char **loadprotos; /* the load protocols that are supported */
char *baudrates; /* supported baud rates */
int stopbits; /* number of stop bits */
char **regnames; /* array of register names in ascii */
@ -87,19 +122,15 @@ extern struct monitor_ops *current_monitor;
#define SREC_SIZE 160
#define GDBPROTO ((current_monitor->type) ? 0: 1)
extern void debuglogs();
extern void monitor_open();
extern void monitor_close();
extern void monitor_detach();
extern void monitor_attach();
extern void monitor_resume();
extern int monitor_wait();
extern void monitor_fetch_register();
extern void monitor_store_register();
extern void monitor_fetch_registers();
extern void monitor_store_registers();
extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_tty));
extern void monitor_close PARAMS ((int quitting));
extern void monitor_detach PARAMS ((char *args, int from_tty));
extern void monitor_resume PARAMS ((int pid, int step, enum target_signal sig));
extern int monitor_wait PARAMS ((int pid, struct target_waitstatus *status));
extern void monitor_fetch_registers PARAMS ((int regno));
extern void monitor_store_registers PARAMS ((int regno));
extern void monitor_prepare_to_store();
extern int monitor_xfer_inferior_memory();
extern int monitor_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len, int write, struct target_ops *target));
extern void monitor_files_info();
extern int monitor_insert_breakpoint();
extern int monitor_remove_breakpoint();

View File

@ -58,7 +58,8 @@ static char *op50n_regnames[] = {
* strings. We also need a CR or LF on the end.
*/
struct target_ops op50n_ops = {
static struct target_ops op50n_ops =
{
"op50n",
"Oki's debug monitor for the Op50n Eval board",
@ -66,7 +67,7 @@ struct target_ops op50n_ops = {
Specify the serial device it is connected to (e.g. /dev/ttya).",
op50n_open,
monitor_close,
monitor_attach,
NULL,
monitor_detach,
monitor_resume,
monitor_wait,
@ -102,7 +103,11 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
OPS_MAGIC, /* Always the last thing */
};
struct monitor_ops op50n_cmds = {
static char *op50n_loadtype[] = {"none", "srec", "default", NULL};
static char *op50n_loadprotos[] = {"none", NULL};
static struct monitor_ops op50n_cmds =
{
1, /* 1 for ASCII, 0 for binary */
"\003.\n", /* monitor init string */
"g %x\n", /* execute or usually GO command */
@ -136,10 +141,10 @@ struct monitor_ops op50n_cmds = {
" ", /* end-of-command delimitor */
".\n", /* optional command terminator */
&op50n_ops, /* target operations */
"none,srec,default", /* load types */
"none", /* load types */
op50n_loadtypes, /* loadtypes */
op50n_loadprotos, /* loadprotos */
"2400,4800,9600,19200,exta,38400,extb", /* supported baud rates */
1, /* number of stop bits */
SERIAL_1_STOPBITS, /* number of stop bits */
op50n_regnames
};
@ -148,10 +153,7 @@ op50n_open(args, from_tty)
char *args;
int from_tty;
{
target_preopen(from_tty);
push_target(&op50n_ops);
push_monitor (&op50n_cmds);
monitor_open (args, "op50n", from_tty);
monitor_open (args, &op50n_cmds, from_tty);
}
void

View File

@ -23,11 +23,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "target.h"
#include "monitor.h"
extern int baud_rate;
#include "serial.h"
void rom68k_open();
void monitor_open();
/*
* this array of registers need to match the indexes used by GDB. The
@ -35,23 +33,10 @@ void monitor_open();
* different strings than GDB does, and doesn't support all the
* registers either. So, typing "info reg sp" becomes a "r30".
*/
static char *rom68k_regnames[] = {
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a0", "a1",
"a2", "a3", "a4", "a5", "a6", "usp", "ssp","pc", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", ""
};
static char *rom68k_regnames[NUM_REGS] = {
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
"SR", "PC" };
/*
* Define the monitor command strings. Since these are passed directly
@ -59,21 +44,22 @@ static char *rom68k_regnames[] = {
* strings. We also need a CR or LF on the end.
*/
struct target_ops rom68k_ops = {
static struct target_ops rom68k_ops =
{
"rom68k",
"Rom68k debug monitor for the IDP Eval board",
"Debug on a Motorola IDP eval board running the ROM68K monitor.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).",
rom68k_open,
monitor_close,
monitor_attach,
NULL,
monitor_detach,
monitor_resume,
monitor_wait,
monitor_fetch_register,
monitor_store_register,
monitor_fetch_registers,
monitor_store_registers,
monitor_prepare_to_store,
monitor_xfer_inferior_memory,
monitor_xfer_memory,
monitor_files_info,
monitor_insert_breakpoint,
monitor_remove_breakpoint, /* Breakpoints */
@ -102,56 +88,61 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
OPS_MAGIC /* Always the last thing */
};
struct monitor_ops rom68k_cmds = {
1, /* 1 for ASCII, 0 for binary */
"\n", /* monitor init string */
"go \n", /* execute or usually GO command */
"go \n", /* continue command */
"st \n", /* single step */
"db %x\n", /* set a breakpoint */
"cb %x\r", /* clear a breakpoint */
0, /* 0 for number, 1 for address */
static char *rom68k_loadtypes[] = {"none", "srec", "default", NULL};
static char *rom68k_loadprotos[] = {"none", NULL};
static struct monitor_ops rom68k_cmds =
{
1, /* 1 for ASCII, 0 for binary */
".\r\r", /* monitor init string */
"go \r", /* execute or usually GO command */
"go \r", /* continue command */
"st \r", /* single step */
"db %x\r", /* set a breakpoint */
"cb %x\r", /* clear a breakpoint */
0, /* 0 for number, 1 for address */
{
"pm %x %x\r", /* set memory */
"=", /* delimiter */
"", /* the result */
"pm %x %x\r", /* setmem.cmd (addr, value) */
NULL, /* setreg.resp_delim */
NULL, /* setreg.term */
NULL, /* setreg.term_cmd */
},
{
"dm %x 1\r", /* get memory */
"", /* delimiter */
"", /* the result */
"dm %x 1\r", /* getmem.cmd (addr) */
" ", /* getmem.resp_delim */
NULL, /* getmem.term */
NULL, /* getmem.term_cmd */
},
{
"pr %s %x\r", /* set a register */
"", /* delimiter between registers */
"", /* the result */
"pr %s %x\r", /* setreg.cmd (name, value) */
NULL, /* setreg.resp_delim */
NULL, /* setreg.term */
NULL /* setreg.term_cmd */
},
{
"pr %s\n", /* get a register */
":", /* delimiter between registers */
"", /* the result */
"pr %s\r", /* getreg.cmd (name) */
": ", /* getreg.resp_delim */
"= ", /* getreg.term */
".\r" /* getreg.term_cmd */
},
"dc\n", /* download command */
"ROM68K :->", /* monitor command prompt */
"=", /* end-of-command delimitor */
".\n", /* optional command terminator */
&rom68k_ops, /* target operations */
"none,srec,default", /* load types */
"none", /* load protocols */
"9600", /* supported baud rates */
1, /* number of stop bits */
rom68k_regnames /* registers names */
};
"dc\r", /* download command */
"ROM68K :->", /* monitor command prompt */
"=", /* end-of-command delimitor */
".\r", /* optional command terminator */
&rom68k_ops, /* target operations */
rom68k_loadtypes, /* loadtypes */
rom68k_loadprotos, /* loadprotos */
"9600", /* supported baud rates */
SERIAL_1_STOPBITS, /* number of stop bits */
rom68k_regnames /* registers names */
};
void
rom68k_open(args, from_tty)
char *args;
int from_tty;
{
target_preopen(from_tty);
push_target (&rom68k_ops);
push_monitor (&rom68k_cmds);
monitor_open (args, "rom68k", from_tty);
monitor_open (args, &rom68k_cmds, from_tty);
}
void

View File

@ -59,14 +59,15 @@ static char *w89k_regnames[] = {
* strings. We also need a CR or LF on the end.
*/
struct target_ops w89k_ops = {
static struct target_ops w89k_ops =
{
"w89k",
"WinBond's debug monitor for the W89k Eval board",
"Debug on a WinBond W89K eval board.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).",
w89k_open,
monitor_close,
monitor_attach,
NULL,
monitor_detach,
monitor_resume,
monitor_wait,
@ -102,7 +103,11 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
OPS_MAGIC, /* Always the last thing */
};
struct monitor_ops w89k_cmds = {
static char *loadtypes[] = {"none", "srec", "default", NULL};
static char *loadprotos[] = {"none", "xmodem", NULL};
static struct monitor_ops w89k_cmds =
{
1, /* 1 for ASCII, 0 for binary */
"\n", /* monitor init string */
"g = %x\n", /* execute or usually GO command */
@ -136,10 +141,10 @@ struct monitor_ops w89k_cmds = {
"", /* end-of-command delimitor */
"", /* optional command terminator */
&w89k_ops, /* target operations */
"none,srec,default", /* load types */
"none,xmodem", /* load protocols */
w89k_loadtypes, /* loadtypes */
w89k_loadprotos, /* loadprotos */
"9600", /* supported baud rates */
1, /* number of stop bits */
SERIAL_1_STOPBITS, /* number of stop bits */
w89k_regnames /* registers names */
};
@ -148,10 +153,7 @@ w89k_open(args, from_tty)
char *args;
int from_tty;
{
target_preopen(from_tty);
push_target (&w89k_ops);
push_monitor (&w89k_cmds);
monitor_open (args, "w89k", from_tty);
monitor_open (args, &w89k_cmds, from_tty);
}
void