Remove now unnecessary messing with PCI command register.
[dragonfly.git] / sys / ddb / ddb.h
1 /*-
2  * Copyright (c) 1993, Garrett A. Wollman.
3  * Copyright (c) 1993, University of Vermont and State Agricultural College.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the University nor the names of its contributors
15  *    may be used to endorse or promote products derived from this software
16  *    without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * $FreeBSD: src/sys/ddb/ddb.h,v 1.24.2.2 2002/08/30 22:27:49 gibbs Exp $
31  * $DragonFly: src/sys/ddb/ddb.h,v 1.7 2004/09/03 08:50:47 eirikn Exp $
32  */
33
34 /*
35  * Necessary declarations for the `ddb' kernel debugger.
36  */
37
38 #ifndef _DDB_DDB_H_
39 #define _DDB_DDB_H_
40
41 #include <sys/queue.h>
42 #include <machine/db_machdep.h>         /* type definitions */
43
44 typedef void db_cmdfcn_t (db_expr_t addr, boolean_t have_addr,
45                               db_expr_t count, char *modif);
46
47 #define DB_COMMAND(cmd_name, func_name) \
48         DB_SET(cmd_name, func_name, db_cmd_set, 0, NULL)
49 #define DB_SHOW_COMMAND(cmd_name, func_name) \
50         DB_SET(cmd_name, func_name, db_show_cmd_set, 0, NULL)
51
52 #define DB_SET(cmd_name, func_name, set, flag, more)            \
53 static db_cmdfcn_t      func_name;                              \
54                                                                 \
55 static const struct command __CONCAT(func_name,_cmd) = {        \
56         __STRING(cmd_name),                                     \
57         func_name,                                              \
58         flag,                                                   \
59         more                                                    \
60 };                                                              \
61 TEXT_SET(set, __CONCAT(func_name,_cmd));                        \
62                                                                 \
63 static void                                                     \
64 func_name(addr, have_addr, count, modif)                        \
65         db_expr_t addr;                                         \
66         boolean_t have_addr;                                    \
67         db_expr_t count;                                        \
68         char *modif;
69
70 extern char *esym;
71 extern db_expr_t db_maxoff;
72 extern int db_active;
73 extern int db_indent;
74 extern int db_inst_count;
75 extern int db_load_count;
76 extern int debugger_on_panic;
77 extern int db_store_count;
78 extern db_expr_t db_radix;
79 extern db_expr_t db_max_width;
80 extern db_expr_t db_tab_stop_width;
81
82 struct vm_map;
83
84 int             db_more(int *nl);
85 void            db_check_interrupt (void);
86 void            db_clear_watchpoints (void);
87 db_addr_t       db_disasm (db_addr_t loc, boolean_t altfmt, db_regs_t *regs);
88                                 /* instruction disassembler */
89 void            db_error (char *s);
90 int             db_expression (db_expr_t *valuep);
91 int             db_get_variable (db_expr_t *valuep);
92 void            db_iprintf (const char *,...) __printflike(1, 2);
93 struct vm_map   *db_map_addr (vm_offset_t);
94 boolean_t       db_map_current (struct vm_map *);
95 boolean_t       db_map_equal (struct vm_map *, struct vm_map *);
96 void            db_print_loc_and_inst (db_addr_t loc, db_regs_t *regs);
97 void            db_printf (const char *fmt, ...) __printflike(1, 2);
98 void            db_read_bytes (vm_offset_t addr, size_t size, char *data);
99                                 /* machine-dependent */
100 int             db_readline (char *lstart, int lsize);
101 void            db_restart_at_pc (boolean_t watchpt);
102 void            db_set_watchpoints (void);
103 void            db_skip_to_eol (void);
104 boolean_t       db_stop_at_pc (boolean_t *is_breakpoint);
105 #define         db_strcpy       strcpy
106 void            db_trap (int type, int code);
107 int             db_value_of_name (const char *name, db_expr_t *valuep);
108 void            db_write_bytes (vm_offset_t addr, size_t size, char *data);
109                                 /* machine-dependent */
110 void            kdb_init (void);
111
112 db_cmdfcn_t     db_breakpoint_cmd;
113 db_cmdfcn_t     db_continue_cmd;
114 db_cmdfcn_t     db_delete_cmd;
115 db_cmdfcn_t     db_deletehwatch_cmd;
116 db_cmdfcn_t     db_deletewatch_cmd;
117 db_cmdfcn_t     db_examine_cmd;
118 db_cmdfcn_t     db_hwatchpoint_cmd;
119 db_cmdfcn_t     db_listbreak_cmd;
120 db_cmdfcn_t     db_print_cmd;
121 db_cmdfcn_t     db_ps;
122 db_cmdfcn_t     db_search_cmd;
123 db_cmdfcn_t     db_set_cmd;
124 db_cmdfcn_t     db_show_regs;
125 db_cmdfcn_t     db_single_step_cmd;
126 db_cmdfcn_t     db_stack_trace_cmd;
127 db_cmdfcn_t     db_trace_until_call_cmd;
128 db_cmdfcn_t     db_trace_until_matching_cmd;
129 db_cmdfcn_t     db_watchpoint_cmd;
130 db_cmdfcn_t     db_write_cmd;
131
132 #if 0
133 db_cmdfcn_t     db_help_cmd;
134 db_cmdfcn_t     db_show_all_threads;
135 db_cmdfcn_t     db_show_one_thread;
136 db_cmdfcn_t     ipc_port_print;
137 db_cmdfcn_t     vm_page_print;
138 #endif
139
140 /*
141  * Print backtrace. (Machine-Dependant)
142  */
143 void            db_print_backtrace(void);
144
145 /*
146  * Command table.
147  */
148 struct command {
149         char *  name;           /* command name */
150         db_cmdfcn_t *fcn;       /* function to call */
151         int     flag;           /* extra info: */
152 #define CS_OWN          0x1     /* non-standard syntax */
153 #define CS_MORE         0x2     /* standard syntax, but may have other words
154                                  * at end */
155 #define CS_SET_DOT      0x100   /* set dot after command */
156         struct command *more;   /* another level of command */
157 };
158
159 /* XXX: UGLY hack */
160 #ifdef CN_DEAD
161 /*
162  * Routines to support GDB on an sio port.
163  */
164 extern dev_t       gdbdev;
165 extern cn_getc_t *gdb_getc;
166 extern cn_putc_t *gdb_putc;
167 #endif
168
169 #endif /* !_DDB_DDB_H_ */