Memory_reads_inferior() and monitor_fetch_registers() now work good on
[external/binutils.git] / gdb / monitor.h
1 /* Remote debugging interface ROM monitors.
2  *  Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
3  *  Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
4  *
5  *  Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
6  *  Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
7  *
8  * This file is part of GDB.
9  * 
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24
25 struct rom_cmd_data {
26   char *cmd;                    /* command to send */
27   char *delim;                  /* the delimiter */
28   char *result;                 /* the result */
29 };
30
31 struct monitor_ops {
32   int   type;                   /* 1 is ascii, 0 is binary */
33   char  *init;                  /* initialize to the monitor */
34   char  *execute;               /* execute or usually GO command */
35   char  *resume;                /* continue command */
36   char  *step;                  /* single step */
37   char  *set_break;             /* set a breakpoint */
38   char  *clr_break;             /* clear a breakpoint */
39   struct rom_cmd_data setmem;   /* set memory to a value */
40   struct rom_cmd_data getmem;   /* display memory */
41   struct rom_cmd_data regset;   /* set a register */
42   struct rom_cmd_data regget;   /* read a register */
43   char  *load;                  /* load command */
44   char  *prompt;                /* monitor command prompt */
45   char  *cmd_delim;             /* end-of-command delimitor */
46   char  *cmd_end;               /* optional command terminator */
47   struct target_ops *target;    /* target operations */
48   char  *loadtypes;             /* the load types that are supported */
49   char  **regnames;             /* array of register names in ascii */
50 };
51
52 extern struct monitor_ops        *current_monitor;
53
54 #define PROTO_TYPE              (current_monitor->type)
55 #define LOADTYPES               (current_monitor->loadtypes)
56 #define INIT_CMD                (current_monitor->init)
57 #define GO_CMD                  (current_monitor->execute)
58 #define CONT_CMD                (current_monitor->resume)
59 #define STEP_CMD                (current_monitor->step)
60 #define SET_BREAK_CMD           (current_monitor->set_break)
61 #define CLR_BREAK_CMD           (current_monitor->clr_break)
62 #define SET_MEM                 (current_monitor->setmem)
63 #define GET_MEM                 (current_monitor->getmem)
64 #define LOAD_CMD                (current_monitor->load)
65 #define GET_REG                 (current_monitor->regget)
66 #define SET_REG                 (current_monitor->regset)
67 #define CMD_END                 (current_monitor->cmd_end)
68 #define CMD_DELIM               (current_monitor->cmd_delim)
69 #define PROMPT                  (current_monitor->prompt)
70 #define TARGET_OPS              (current_monitor->target)
71 #define TARGET_NAME             (current_monitor->target->to_shortname)
72 #define REGNAMES(x)             (current_monitor->regnames[x])
73 #define ROMCMD(x)               (x.cmd)
74 #define ROMDELIM(x)             (x.delim)
75 #define ROMRES(x)               (x.result)
76
77 #define push_monitor(x)         current_monitor = x;
78
79 extern void monitor_open();
80 extern void monitor_close();
81 extern void monitor_detach();
82 extern void monitor_resume();
83 extern int  monitor_wait();
84 extern void monitor_fetch_register();
85 extern void monitor_store_register();
86 extern void monitor_prepare_to_store();
87 extern int  monitor_xfer_inferior_memory();
88 extern void monitor_files_info();
89 extern int  monitor_insert_breakpoint();
90 extern int  monitor_remove_breakpoint();
91 extern void monitor_kill();
92 extern void monitor_load();
93 extern void monitor_create_inferior();
94 extern void monitor_mourn_inferior();