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