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