xref: /titanic_44/usr/src/cmd/mdb/common/mdb/mdb_frame.h (revision 99ebb4ca412cb0a19d77a3899a87c055b9c30fa8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_FRAME_H
28 #define	_MDB_FRAME_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <mdb/mdb_module.h>
33 #include <mdb/mdb_addrvec.h>
34 #include <mdb/mdb_list.h>
35 #include <mdb/mdb_umem.h>
36 #include <mdb/mdb_vcb.h>
37 #include <mdb/mdb_lex.h>
38 #include <mdb/mdb_wcb.h>
39 #include <mdb/mdb.h>
40 #include <setjmp.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct mdb_cmd {
47 	mdb_list_t c_list;		/* List forward/back pointers */
48 	mdb_idcmd_t *c_dcmd;		/* Dcmd to invoke */
49 	mdb_argvec_t c_argv;		/* Arguments for this command */
50 	mdb_addrvec_t c_addrv;		/* Addresses for this command */
51 	mdb_vcb_t *c_vcbs;		/* Variable control block list */
52 } mdb_cmd_t;
53 
54 typedef struct mdb_frame {
55 	mdb_list_t f_list;		/* Frame stack forward/back pointers */
56 	mdb_list_t f_cmds;		/* List of commands to execute */
57 	mdb_wcb_t *f_wcbs;		/* Walk control blocks for GC */
58 	mdb_mblk_t *f_mblks;		/* Memory blocks for GC */
59 	mdb_cmd_t *f_pcmd;		/* Next cmd in pipe (if pipe active) */
60 	mdb_cmd_t *f_cp;		/* Pointer to executing command */
61 	mdb_iob_stack_t f_istk;		/* Stack of input i/o buffers */
62 	mdb_iob_stack_t f_ostk;		/* Stack of output i/o buffers */
63 	jmp_buf f_pcb;			/* Control block for longjmp */
64 	uint_t f_flags;			/* Volatile flags to save/restore */
65 	uint_t f_id;			/* ID for debugging purposes */
66 	mdb_argvec_t f_argvec;		/* Command arguments */
67 	int f_oldstate;			/* Last lex state */
68 	struct mdb_lex_state *f_lstate;	/* Current lex state */
69 	uintmax_t f_dot;		/* Value of '.' */
70 } mdb_frame_t;
71 
72 #ifdef _MDB
73 
74 extern mdb_cmd_t *mdb_cmd_create(mdb_idcmd_t *, mdb_argvec_t *);
75 extern void mdb_cmd_destroy(mdb_cmd_t *);
76 extern void mdb_cmd_reset(mdb_cmd_t *);
77 
78 extern void mdb_frame_reset(mdb_frame_t *);
79 extern void mdb_frame_push(mdb_frame_t *);
80 extern void mdb_frame_pop(mdb_frame_t *, int);
81 
82 extern void mdb_frame_switch(mdb_frame_t *);
83 
84 #endif	/* _MDB */
85 
86 #ifdef	__cplusplus
87 }
88 #endif
89 
90 #endif	/* _MDB_FRAME_H */
91