xref: /freebsd/sys/gdb/gdb.h (revision 9b188af13cfbcdc32c880c5110c23855b02acb3c)
1fa521b03SWarner Losh /*-
272d44f31SMarcel Moolenaar  * Copyright (c) 2004 Marcel Moolenaar
372d44f31SMarcel Moolenaar  * All rights reserved.
472d44f31SMarcel Moolenaar  *
572d44f31SMarcel Moolenaar  * Redistribution and use in source and binary forms, with or without
672d44f31SMarcel Moolenaar  * modification, are permitted provided that the following conditions
772d44f31SMarcel Moolenaar  * are met:
872d44f31SMarcel Moolenaar  *
972d44f31SMarcel Moolenaar  * 1. Redistributions of source code must retain the above copyright
1072d44f31SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer.
1172d44f31SMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
1272d44f31SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
1372d44f31SMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
1472d44f31SMarcel Moolenaar  *
1572d44f31SMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1672d44f31SMarcel Moolenaar  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1772d44f31SMarcel Moolenaar  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1872d44f31SMarcel Moolenaar  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1972d44f31SMarcel Moolenaar  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2072d44f31SMarcel Moolenaar  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2172d44f31SMarcel Moolenaar  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2272d44f31SMarcel Moolenaar  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2372d44f31SMarcel Moolenaar  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2472d44f31SMarcel Moolenaar  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2572d44f31SMarcel Moolenaar  *
2672d44f31SMarcel Moolenaar  * $FreeBSD$
2772d44f31SMarcel Moolenaar  */
2872d44f31SMarcel Moolenaar 
2972d44f31SMarcel Moolenaar #ifndef _GDB_GDB_H_
3072d44f31SMarcel Moolenaar #define	_GDB_GDB_H_
3172d44f31SMarcel Moolenaar 
3272d44f31SMarcel Moolenaar typedef int gdb_checkc_f(void);
3372d44f31SMarcel Moolenaar typedef int gdb_getc_f(void);
3472d44f31SMarcel Moolenaar typedef void gdb_init_f(void);
3572d44f31SMarcel Moolenaar typedef int gdb_probe_f(void);
3672d44f31SMarcel Moolenaar typedef void gdb_putc_f(int);
3772d44f31SMarcel Moolenaar typedef void gdb_term_f(void);
3872d44f31SMarcel Moolenaar 
3972d44f31SMarcel Moolenaar struct gdb_dbgport {
4072d44f31SMarcel Moolenaar 	const char	*gdb_name;
4172d44f31SMarcel Moolenaar 	gdb_getc_f	*gdb_getc;
4272d44f31SMarcel Moolenaar 	gdb_init_f	*gdb_init;
4372d44f31SMarcel Moolenaar 	gdb_probe_f	*gdb_probe;
4472d44f31SMarcel Moolenaar 	gdb_putc_f	*gdb_putc;
4572d44f31SMarcel Moolenaar 	gdb_term_f	*gdb_term;
4672d44f31SMarcel Moolenaar 	int		gdb_active;
4772d44f31SMarcel Moolenaar };
4872d44f31SMarcel Moolenaar 
499b188af1SPoul-Henning Kamp #define	GDB_DBGPORT(name, probe, init, term, getc, putc)		\
5072d44f31SMarcel Moolenaar 	static struct gdb_dbgport name##_gdb_dbgport = {		\
5172d44f31SMarcel Moolenaar 		.gdb_name = #name,					\
5272d44f31SMarcel Moolenaar 		.gdb_probe = probe,					\
539b188af1SPoul-Henning Kamp 		.gdb_init = init,					\
549b188af1SPoul-Henning Kamp 		.gdb_term = term,					\
559b188af1SPoul-Henning Kamp 		.gdb_getc = getc,					\
5672d44f31SMarcel Moolenaar 		.gdb_putc = putc,					\
5772d44f31SMarcel Moolenaar 	};								\
5872d44f31SMarcel Moolenaar 	DATA_SET(gdb_dbgport_set, name##_gdb_dbgport)
5972d44f31SMarcel Moolenaar 
6072d44f31SMarcel Moolenaar #endif /* !_GDB_GDB_H_ */
61