Home | History | Annotate | Line # | Download | only in ddb
db_command.h revision 1.31.6.2
      1  1.31.6.1       mjf /*	$NetBSD: db_command.h,v 1.31.6.2 2008/06/02 13:23:10 mjf Exp $	*/
      2      1.28    martin 
      3      1.28    martin /*-
      4      1.28    martin  * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
      5      1.28    martin  * All rights reserved.
      6      1.28    martin  *
      7      1.28    martin  * This code is derived from software contributed to The NetBSD Foundation
      8      1.28    martin  * by Adam Hamsik.
      9      1.28    martin  *
     10      1.28    martin  * Redistribution and use in source and binary forms, with or without
     11      1.28    martin  * modification, are permitted provided that the following conditions
     12      1.28    martin  * are met:
     13      1.28    martin  * 1. Redistributions of source code must retain the above copyright
     14      1.28    martin  *    notice, this list of conditions and the following disclaimer.
     15      1.28    martin  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.28    martin  *    notice, this list of conditions and the following disclaimer in the
     17      1.28    martin  *    documentation and/or other materials provided with the distribution.
     18      1.28    martin  *
     19      1.28    martin  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20      1.28    martin  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21      1.28    martin  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22      1.28    martin  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23      1.28    martin  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24      1.28    martin  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25      1.28    martin  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26      1.28    martin  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27      1.28    martin  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28      1.28    martin  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29      1.28    martin  * POSSIBILITY OF SUCH DAMAGE.
     30      1.28    martin  */
     31       1.5       cgd 
     32      1.22    simonb /*
     33       1.1       cgd  * Mach Operating System
     34       1.1       cgd  * Copyright (c) 1991,1990 Carnegie Mellon University
     35       1.1       cgd  * All Rights Reserved.
     36      1.22    simonb  *
     37       1.1       cgd  * Permission to use, copy, modify and distribute this software and its
     38       1.1       cgd  * documentation is hereby granted, provided that both the copyright
     39       1.1       cgd  * notice and this permission notice appear in all copies of the
     40       1.1       cgd  * software, derivative works or modified versions, and any portions
     41       1.1       cgd  * thereof, and that both notices appear in supporting documentation.
     42      1.22    simonb  *
     43      1.12        pk  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     44       1.1       cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     45       1.1       cgd  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     46      1.22    simonb  *
     47       1.1       cgd  * Carnegie Mellon requests users of this software to return to
     48      1.22    simonb  *
     49       1.1       cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     50       1.1       cgd  *  School of Computer Science
     51       1.1       cgd  *  Carnegie Mellon University
     52       1.1       cgd  *  Pittsburgh PA 15213-3890
     53      1.22    simonb  *
     54       1.1       cgd  * any improvements or extensions that they make and grant Carnegie the
     55       1.1       cgd  * rights to redistribute these changes.
     56       1.1       cgd  *
     57       1.1       cgd  *	Author: David B. Golub, Carnegie Mellon University
     58       1.1       cgd  *	Date:	7/90
     59       1.1       cgd  */
     60       1.3   mycroft 
     61      1.28    martin #ifndef _DDB_COMMAND_
     62      1.28    martin #define _DDB_COMMAND_
     63       1.1       cgd 
     64      1.22    simonb void	db_skip_to_eol(void);
     65      1.22    simonb void	db_command_loop(void);
     66      1.31     perry void	db_error(const char *) __dead;
     67      1.22    simonb 
     68      1.22    simonb extern db_addr_t db_dot;	/* current location */
     69      1.22    simonb extern db_addr_t db_last_addr;	/* last explicit address typed */
     70      1.22    simonb extern db_addr_t db_prev;	/* last address examined
     71       1.7   mycroft 				   or written */
     72      1.22    simonb extern db_addr_t db_next;	/* next address to be examined
     73       1.7   mycroft 				   or written */
     74       1.1       cgd 
     75      1.25      yamt extern char db_cmd_on_enter[];
     76      1.25      yamt 
     77      1.28    martin struct db_command;
     78      1.28    martin 
     79      1.28    martin 
     80      1.28    martin 
     81      1.28    martin /*
     82      1.28    martin  * Macro include help when DDB_VERBOSE_HELP option(9) is used
     83      1.28    martin  */
     84      1.28    martin #ifdef DDB_VERBOSE_HELP
     85      1.28    martin #define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
     86      1.28    martin  name,funct,type,cmd_descr,cmd_arg,arg_desc
     87      1.28    martin #else
     88      1.28    martin #define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
     89      1.28    martin  name,funct,type
     90      1.28    martin #endif
     91      1.28    martin 
     92      1.28    martin 
     93      1.28    martin 
     94      1.28    martin /*
     95      1.28    martin  * we have two types of lists one for base commands like reboot
     96      1.28    martin  * and another list for show subcommands.
     97      1.28    martin  */
     98      1.28    martin 
     99      1.28    martin #define DDB_BASE_CMD 0
    100      1.28    martin #define DDB_SHOW_CMD 1
    101      1.28    martin #define DDB_MACH_CMD 2
    102      1.28    martin 
    103      1.28    martin 
    104      1.28    martin int db_register_tbl(uint8_t, const struct db_command *);
    105      1.28    martin int db_unregister_tbl(uint8_t, const struct db_command *);
    106      1.28    martin 
    107       1.4        pk /*
    108       1.4        pk  * Command table
    109       1.4        pk  */
    110       1.4        pk struct db_command {
    111      1.19  jdolecek 	const char	*name;		/* command name */
    112      1.28    martin 
    113       1.8  christos 	/* function to call */
    114      1.27      matt 	void		(*fcn)(db_expr_t, bool, db_expr_t, const char *);
    115      1.28    martin 	/*
    116      1.28    martin 	 *Flag is used for modifing command behaviour.
    117      1.28    martin 	 *CS_OWN && CS_MORE are specify type of command arguments.
    118      1.28    martin 	 *CS_OWN commandmanage arguments in own way.
    119      1.28    martin 	 *CS_MORE db_command() prepare argument list.
    120      1.28    martin 	 *
    121      1.28    martin 	 *CS_COMPAT is set for all level 2 commands with level 3 childs (show all pages)
    122      1.28    martin 	 *
    123      1.28    martin 	 *CS_SHOW identify show command in BASE command list
    124      1.28    martin 	 *CS_MACH identify mach command in BASE command list
    125      1.28    martin 	 *
    126      1.28    martin 	 *CS_SET_DOT specify if this command is put to last added command memory.
    127      1.28    martin 	 *CS_NOREPEAT this command does not repeat
    128      1.28    martin 	 */
    129      1.28    martin 	uint16_t		flag;		/* extra info: */
    130       1.4        pk #define	CS_OWN		0x1		/* non-standard syntax */
    131       1.4        pk #define	CS_MORE		0x2		/* standard syntax, but may have other
    132       1.4        pk 					   words at end */
    133      1.28    martin #define CS_COMPAT	0x4		/*is set for compatibilty with old ddb versions*/
    134      1.28    martin 
    135      1.28    martin #define CS_SHOW		0x8		/*select show list*/
    136  1.31.6.1       mjf #define CS_MACH		0x10		/*select machine dependent list*/
    137      1.28    martin 
    138       1.4        pk #define	CS_SET_DOT	0x100		/* set dot after command */
    139      1.28    martin #define	CS_NOREPEAT	0x200		/* don't set last_command */
    140      1.28    martin #ifdef DDB_VERBOSE_HELP
    141      1.28    martin 	const char *cmd_descr; /*description of command*/
    142      1.28    martin 	const char *cmd_arg;   /*command arguments*/
    143      1.28    martin 	const char *cmd_arg_help;	/* arguments description */
    144      1.28    martin #endif
    145       1.4        pk };
    146      1.28    martin 
    147      1.28    martin #endif /*_DDB_COMMAND_*/
    148      1.28    martin 
    149