xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_frame.h (revision 8a6a72fd51dfee674c6daa8a222f68b1532516ab)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*8a6a72fdSaf  * Common Development and Distribution License (the "License").
6*8a6a72fdSaf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*8a6a72fdSaf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_MDB_FRAME_H
277c478bd9Sstevel@tonic-gate #define	_MDB_FRAME_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <mdb/mdb_module.h>
327c478bd9Sstevel@tonic-gate #include <mdb/mdb_addrvec.h>
337c478bd9Sstevel@tonic-gate #include <mdb/mdb_list.h>
347c478bd9Sstevel@tonic-gate #include <mdb/mdb_umem.h>
357c478bd9Sstevel@tonic-gate #include <mdb/mdb_vcb.h>
367c478bd9Sstevel@tonic-gate #include <mdb/mdb_lex.h>
377c478bd9Sstevel@tonic-gate #include <mdb/mdb_wcb.h>
387c478bd9Sstevel@tonic-gate #include <mdb/mdb.h>
397c478bd9Sstevel@tonic-gate #include <setjmp.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate typedef struct mdb_cmd {
467c478bd9Sstevel@tonic-gate 	mdb_list_t c_list;		/* List forward/back pointers */
477c478bd9Sstevel@tonic-gate 	mdb_idcmd_t *c_dcmd;		/* Dcmd to invoke */
487c478bd9Sstevel@tonic-gate 	mdb_argvec_t c_argv;		/* Arguments for this command */
497c478bd9Sstevel@tonic-gate 	mdb_addrvec_t c_addrv;		/* Addresses for this command */
507c478bd9Sstevel@tonic-gate 	mdb_vcb_t *c_vcbs;		/* Variable control block list */
517c478bd9Sstevel@tonic-gate } mdb_cmd_t;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate typedef struct mdb_frame {
547c478bd9Sstevel@tonic-gate 	mdb_list_t f_list;		/* Frame stack forward/back pointers */
557c478bd9Sstevel@tonic-gate 	mdb_list_t f_cmds;		/* List of commands to execute */
567c478bd9Sstevel@tonic-gate 	mdb_wcb_t *f_wcbs;		/* Walk control blocks for GC */
577c478bd9Sstevel@tonic-gate 	mdb_mblk_t *f_mblks;		/* Memory blocks for GC */
587c478bd9Sstevel@tonic-gate 	mdb_cmd_t *f_pcmd;		/* Next cmd in pipe (if pipe active) */
597c478bd9Sstevel@tonic-gate 	mdb_cmd_t *f_cp;		/* Pointer to executing command */
607c478bd9Sstevel@tonic-gate 	mdb_iob_stack_t f_istk;		/* Stack of input i/o buffers */
617c478bd9Sstevel@tonic-gate 	mdb_iob_stack_t f_ostk;		/* Stack of output i/o buffers */
627c478bd9Sstevel@tonic-gate 	jmp_buf f_pcb;			/* Control block for longjmp */
637c478bd9Sstevel@tonic-gate 	uint_t f_flags;			/* Volatile flags to save/restore */
647c478bd9Sstevel@tonic-gate 	uint_t f_id;			/* ID for debugging purposes */
657c478bd9Sstevel@tonic-gate 	mdb_argvec_t f_argvec;		/* Command arguments */
667c478bd9Sstevel@tonic-gate 	int f_oldstate;			/* Last lex state */
677c478bd9Sstevel@tonic-gate 	struct mdb_lex_state *f_lstate;	/* Current lex state */
687c478bd9Sstevel@tonic-gate 	uintmax_t f_dot;		/* Value of '.' */
69*8a6a72fdSaf 	mdb_bool_t pipe;		/* frame has pipe context */
707c478bd9Sstevel@tonic-gate } mdb_frame_t;
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #ifdef _MDB
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate extern mdb_cmd_t *mdb_cmd_create(mdb_idcmd_t *, mdb_argvec_t *);
757c478bd9Sstevel@tonic-gate extern void mdb_cmd_destroy(mdb_cmd_t *);
767c478bd9Sstevel@tonic-gate extern void mdb_cmd_reset(mdb_cmd_t *);
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate extern void mdb_frame_reset(mdb_frame_t *);
797c478bd9Sstevel@tonic-gate extern void mdb_frame_push(mdb_frame_t *);
807c478bd9Sstevel@tonic-gate extern void mdb_frame_pop(mdb_frame_t *, int);
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate extern void mdb_frame_switch(mdb_frame_t *);
837c478bd9Sstevel@tonic-gate 
84*8a6a72fdSaf extern void mdb_frame_set_pipe(mdb_frame_t *);
85*8a6a72fdSaf extern void mdb_frame_clear_pipe(mdb_frame_t *);
86*8a6a72fdSaf extern mdb_frame_t *mdb_frame_pipe(void);
87*8a6a72fdSaf 
887c478bd9Sstevel@tonic-gate #endif	/* _MDB */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
917c478bd9Sstevel@tonic-gate }
927c478bd9Sstevel@tonic-gate #endif
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #endif	/* _MDB_FRAME_H */
95