1 /* $OpenBSD: kgdb.h,v 1.5 2005/11/13 17:50:45 fgsch Exp $ */
2 /* $NetBSD: kgdb.h,v 1.5 1998/09/13 14:46:24 christos Exp $ */
3
4 /*
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This software was developed by the Computer Systems Engineering group
9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10 * contributed to Berkeley.
11 *
12 * All advertising materials mentioning features or use of this software
13 * must display the following acknowledgement:
14 * This product includes software developed by the University of
15 * California, Lawrence Berkeley Laboratories.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 * 3. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * @(#)remote-sl.h 8.1 (Berkeley) 6/11/93
42 */
43
44 #ifndef _SYS_KGDB_H_
45 #define _SYS_KGDB_H_
46
47 /*
48 * Protocol definition for KGDB
49 * (gdb over remote serial line)
50 */
51
52 #include <machine/db_machdep.h>
53
54 /*
55 * Message types.
56 */
57 #define KGDB_MEM_R 'm'
58 #define KGDB_MEM_W 'M'
59 #define KGDB_REG_R 'g'
60 #define KGDB_REG_W 'G'
61 #define KGDB_CONT 'c'
62 #define KGDB_STEP 's'
63 #define KGDB_KILL 'k'
64 #define KGDB_SIGNAL '?'
65 #define KGDB_DEBUG 'd'
66 #define KGDB_DETACH 'D'
67
68 /*
69 * start of frame/end of frame
70 */
71 #define KGDB_START '$'
72 #define KGDB_END '#'
73 #define KGDB_GOODP '+'
74 #define KGDB_BADP '-'
75
76 #ifdef _KERNEL
77
78 #include <ddb/db_run.h>
79 #include <ddb/db_access.h>
80
81 #ifndef KGDB_PREPARE
82 #define KGDB_PREPARE
83 #endif
84
85 #ifndef KGDB_ENTER
86 #define KGDB_ENTER
87 #endif
88
89 /*
90 * Functions and variables exported from kgdb_stub.c
91 */
92 extern int kgdb_dev, kgdb_rate, kgdb_active;
93 extern int kgdb_debug_init, kgdb_debug_panic;
94 extern label_t *kgdb_recover;
95
96 void kgdb_attach(int (*)(void *), void (*)(void *, int), void *ioarg);
97 void kgdb_connect(int);
98 void kgdb_panic(void);
99 int kgdb_trap(int, db_regs_t *);
100
101 /*
102 * Machine dependent functions needed by kgdb_stub.c
103 */
104 int kgdb_signal(int);
105 int kgdb_acc(vaddr_t, size_t);
106 void kgdb_getregs(db_regs_t *, kgdb_reg_t *);
107 void kgdb_setregs(db_regs_t *, kgdb_reg_t *);
108
109 #endif /* _KERNEL */
110 #endif /* !_SYS_KGDB_H_ */