Home | History | Annotate | Line # | Download | only in ddb
db_command.h revision 1.24.2.4
      1  1.24.2.4      yamt /*	$NetBSD: db_command.h,v 1.24.2.4 2007/10/27 11:29:54 yamt Exp $	*/
      2  1.24.2.4      yamt 
      3  1.24.2.4      yamt /*-
      4  1.24.2.4      yamt  * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
      5  1.24.2.4      yamt  * All rights reserved.
      6  1.24.2.4      yamt  *
      7  1.24.2.4      yamt  * This code is derived from software contributed to The NetBSD Foundation
      8  1.24.2.4      yamt  * by Adam Hamsik.
      9  1.24.2.4      yamt  *
     10  1.24.2.4      yamt  * Redistribution and use in source and binary forms, with or without
     11  1.24.2.4      yamt  * modification, are permitted provided that the following conditions
     12  1.24.2.4      yamt  * are met:
     13  1.24.2.4      yamt  * 1. Redistributions of source code must retain the above copyright
     14  1.24.2.4      yamt  *    notice, this list of conditions and the following disclaimer.
     15  1.24.2.4      yamt  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.24.2.4      yamt  *    notice, this list of conditions and the following disclaimer in the
     17  1.24.2.4      yamt  *    documentation and/or other materials provided with the distribution.
     18  1.24.2.4      yamt  * 3. All advertising materials mentioning features or use of this software
     19  1.24.2.4      yamt  *    must display the following acknowledgement:
     20  1.24.2.4      yamt  *        This product includes software developed by the NetBSD
     21  1.24.2.4      yamt  *        Foundation, Inc. and its contributors.
     22  1.24.2.4      yamt  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.24.2.4      yamt  *    contributors may be used to endorse or promote products derived
     24  1.24.2.4      yamt  *    from this software without specific prior written permission.
     25  1.24.2.4      yamt  *
     26  1.24.2.4      yamt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.24.2.4      yamt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.24.2.4      yamt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.24.2.4      yamt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.24.2.4      yamt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.24.2.4      yamt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.24.2.4      yamt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.24.2.4      yamt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.24.2.4      yamt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.24.2.4      yamt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.24.2.4      yamt  * POSSIBILITY OF SUCH DAMAGE.
     37  1.24.2.4      yamt  */
     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.24.2.4      yamt #ifndef _DDB_COMMAND_
     69  1.24.2.4      yamt #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.24.2.2      yamt 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.24.2.1      yamt extern char db_cmd_on_enter[];
     83  1.24.2.1      yamt 
     84  1.24.2.4      yamt struct db_command;
     85  1.24.2.4      yamt 
     86  1.24.2.4      yamt 
     87  1.24.2.4      yamt 
     88  1.24.2.4      yamt /*
     89  1.24.2.4      yamt  * Macro include help when DDB_VERBOSE_HELP option(9) is used
     90  1.24.2.4      yamt  */
     91  1.24.2.4      yamt #ifdef DDB_VERBOSE_HELP
     92  1.24.2.4      yamt #define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
     93  1.24.2.4      yamt  name,funct,type,cmd_descr,cmd_arg,arg_desc
     94  1.24.2.4      yamt #else
     95  1.24.2.4      yamt #define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
     96  1.24.2.4      yamt  name,funct,type
     97  1.24.2.4      yamt #endif
     98  1.24.2.4      yamt 
     99  1.24.2.4      yamt 
    100  1.24.2.4      yamt 
    101  1.24.2.4      yamt /*
    102  1.24.2.4      yamt  * we have two types of lists one for base commands like reboot
    103  1.24.2.4      yamt  * and another list for show subcommands.
    104  1.24.2.4      yamt  */
    105  1.24.2.4      yamt 
    106  1.24.2.4      yamt #define DDB_BASE_CMD 0
    107  1.24.2.4      yamt #define DDB_SHOW_CMD 1
    108  1.24.2.4      yamt #define DDB_MACH_CMD 2
    109  1.24.2.4      yamt 
    110  1.24.2.4      yamt 
    111  1.24.2.4      yamt int db_register_tbl(uint8_t, const struct db_command *);
    112  1.24.2.4      yamt int db_unregister_tbl(uint8_t, const struct db_command *);
    113  1.24.2.4      yamt 
    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.24.2.4      yamt 
    120       1.8  christos 	/* function to call */
    121  1.24.2.3      yamt 	void		(*fcn)(db_expr_t, bool, db_expr_t, const char *);
    122  1.24.2.4      yamt 	/*
    123  1.24.2.4      yamt 	 *Flag is used for modifing command behaviour.
    124  1.24.2.4      yamt 	 *CS_OWN && CS_MORE are specify type of command arguments.
    125  1.24.2.4      yamt 	 *CS_OWN commandmanage arguments in own way.
    126  1.24.2.4      yamt 	 *CS_MORE db_command() prepare argument list.
    127  1.24.2.4      yamt 	 *
    128  1.24.2.4      yamt 	 *CS_COMPAT is set for all level 2 commands with level 3 childs (show all pages)
    129  1.24.2.4      yamt 	 *
    130  1.24.2.4      yamt 	 *CS_SHOW identify show command in BASE command list
    131  1.24.2.4      yamt 	 *CS_MACH identify mach command in BASE command list
    132  1.24.2.4      yamt 	 *
    133  1.24.2.4      yamt 	 *CS_SET_DOT specify if this command is put to last added command memory.
    134  1.24.2.4      yamt 	 *CS_NOREPEAT this command does not repeat
    135  1.24.2.4      yamt 	 */
    136  1.24.2.4      yamt 	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.24.2.4      yamt #define CS_COMPAT	0x4		/*is set for compatibilty with old ddb versions*/
    141  1.24.2.4      yamt 
    142  1.24.2.4      yamt #define CS_SHOW		0x8		/*select show list*/
    143  1.24.2.4      yamt #define CS_MACH		0x16		/*select machine dependent list*/
    144  1.24.2.4      yamt 
    145       1.4        pk #define	CS_SET_DOT	0x100		/* set dot after command */
    146  1.24.2.4      yamt #define	CS_NOREPEAT	0x200		/* don't set last_command */
    147  1.24.2.4      yamt #ifdef DDB_VERBOSE_HELP
    148  1.24.2.4      yamt 	const char *cmd_descr; /*description of command*/
    149  1.24.2.4      yamt 	const char *cmd_arg;   /*command arguments*/
    150  1.24.2.4      yamt 	const char *cmd_arg_help;	/* arguments description */
    151  1.24.2.4      yamt #endif
    152       1.4        pk };
    153  1.24.2.4      yamt 
    154  1.24.2.4      yamt #endif /*_DDB_COMMAND_*/
    155  1.24.2.4      yamt 
    156