Change the kernel dev_t, representing a pointer to a specinfo structure,
[dragonfly.git] / sys / ddb / ddb.h
CommitLineData
984263bc
MD
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 $
b13267a5 31 * $DragonFly: src/sys/ddb/ddb.h,v 1.10 2006/09/10 01:26:33 dillon Exp $
984263bc
MD
32 */
33
34/*
35 * Necessary declarations for the `ddb' kernel debugger.
36 */
37
38#ifndef _DDB_DDB_H_
39#define _DDB_DDB_H_
40
1bd40720 41#ifndef _SYS_QUEUE_H_
96728c05 42#include <sys/queue.h>
1bd40720
MD
43#endif
44
45#ifndef _MACHINE_DB_MACHDEP_H_
984263bc 46#include <machine/db_machdep.h> /* type definitions */
1bd40720 47#endif
984263bc 48
43c0ece6
RG
49typedef void db_cmdfcn_t (db_expr_t addr, boolean_t have_addr,
50 db_expr_t count, char *modif);
984263bc
MD
51
52#define DB_COMMAND(cmd_name, func_name) \
53 DB_SET(cmd_name, func_name, db_cmd_set, 0, NULL)
54#define DB_SHOW_COMMAND(cmd_name, func_name) \
55 DB_SET(cmd_name, func_name, db_show_cmd_set, 0, NULL)
56
57#define DB_SET(cmd_name, func_name, set, flag, more) \
58static db_cmdfcn_t func_name; \
59 \
60static const struct command __CONCAT(func_name,_cmd) = { \
61 __STRING(cmd_name), \
62 func_name, \
63 flag, \
64 more \
65}; \
66TEXT_SET(set, __CONCAT(func_name,_cmd)); \
67 \
68static void \
2c9702b2
SW
69func_name(db_expr_t addr, boolean_t have_addr, db_expr_t count, \
70 char *modif)
984263bc
MD
71
72extern char *esym;
73extern db_expr_t db_maxoff;
74extern int db_active;
75extern int db_indent;
76extern int db_inst_count;
77extern int db_load_count;
78extern int debugger_on_panic;
79extern int db_store_count;
80extern db_expr_t db_radix;
81extern db_expr_t db_max_width;
82extern db_expr_t db_tab_stop_width;
83
84struct vm_map;
85
fcb52d8a 86int db_more(int *nl);
43c0ece6
RG
87void db_check_interrupt (void);
88void db_clear_watchpoints (void);
2729d8bd 89db_addr_t db_disasm (db_addr_t loc, boolean_t altfmt, db_regs_t *regs);
984263bc 90 /* instruction disassembler */
43c0ece6
RG
91void db_error (char *s);
92int db_expression (db_expr_t *valuep);
93int db_get_variable (db_expr_t *valuep);
94void db_iprintf (const char *,...) __printflike(1, 2);
95struct vm_map *db_map_addr (vm_offset_t);
96boolean_t db_map_current (struct vm_map *);
97boolean_t db_map_equal (struct vm_map *, struct vm_map *);
2729d8bd 98void db_print_loc_and_inst (db_addr_t loc, db_regs_t *regs);
43c0ece6
RG
99void db_printf (const char *fmt, ...) __printflike(1, 2);
100void db_read_bytes (vm_offset_t addr, size_t size, char *data);
984263bc 101 /* machine-dependent */
43c0ece6
RG
102int db_readline (char *lstart, int lsize);
103void db_restart_at_pc (boolean_t watchpt);
104void db_set_watchpoints (void);
105void db_skip_to_eol (void);
106boolean_t db_stop_at_pc (boolean_t *is_breakpoint);
984263bc 107#define db_strcpy strcpy
43c0ece6
RG
108void db_trap (int type, int code);
109int db_value_of_name (const char *name, db_expr_t *valuep);
110void db_write_bytes (vm_offset_t addr, size_t size, char *data);
984263bc 111 /* machine-dependent */
43c0ece6 112void kdb_init (void);
984263bc
MD
113
114db_cmdfcn_t db_breakpoint_cmd;
115db_cmdfcn_t db_continue_cmd;
116db_cmdfcn_t db_delete_cmd;
117db_cmdfcn_t db_deletehwatch_cmd;
118db_cmdfcn_t db_deletewatch_cmd;
119db_cmdfcn_t db_examine_cmd;
120db_cmdfcn_t db_hwatchpoint_cmd;
121db_cmdfcn_t db_listbreak_cmd;
122db_cmdfcn_t db_print_cmd;
123db_cmdfcn_t db_ps;
124db_cmdfcn_t db_search_cmd;
125db_cmdfcn_t db_set_cmd;
126db_cmdfcn_t db_show_regs;
127db_cmdfcn_t db_single_step_cmd;
128db_cmdfcn_t db_stack_trace_cmd;
129db_cmdfcn_t db_trace_until_call_cmd;
130db_cmdfcn_t db_trace_until_matching_cmd;
131db_cmdfcn_t db_watchpoint_cmd;
132db_cmdfcn_t db_write_cmd;
133
134#if 0
135db_cmdfcn_t db_help_cmd;
136db_cmdfcn_t db_show_all_threads;
137db_cmdfcn_t db_show_one_thread;
138db_cmdfcn_t ipc_port_print;
139db_cmdfcn_t vm_page_print;
140#endif
141
6bd9bbba
HP
142/*
143 * Print backtrace. (Machine-Dependant)
144 */
145void db_print_backtrace(void);
146
984263bc
MD
147/*
148 * Command table.
149 */
150struct command {
151 char * name; /* command name */
152 db_cmdfcn_t *fcn; /* function to call */
153 int flag; /* extra info: */
154#define CS_OWN 0x1 /* non-standard syntax */
155#define CS_MORE 0x2 /* standard syntax, but may have other words
156 * at end */
157#define CS_SET_DOT 0x100 /* set dot after command */
158 struct command *more; /* another level of command */
159};
160
161/* XXX: UGLY hack */
162#ifdef CN_DEAD
163/*
164 * Routines to support GDB on an sio port.
165 */
b13267a5 166extern cdev_t gdbdev;
984263bc
MD
167extern cn_getc_t *gdb_getc;
168extern cn_putc_t *gdb_putc;
169#endif
170
171#endif /* !_DDB_DDB_H_ */