xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_frame.h (revision 28e4da25)
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
58a6a72fdSaf  * Common Development and Distribution License (the "License").
68a6a72fdSaf  * 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 /*
228a6a72fdSaf  * 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 #include <mdb/mdb_module.h>
307c478bd9Sstevel@tonic-gate #include <mdb/mdb_addrvec.h>
317c478bd9Sstevel@tonic-gate #include <mdb/mdb_list.h>
327c478bd9Sstevel@tonic-gate #include <mdb/mdb_umem.h>
337c478bd9Sstevel@tonic-gate #include <mdb/mdb_vcb.h>
347c478bd9Sstevel@tonic-gate #include <mdb/mdb_lex.h>
357c478bd9Sstevel@tonic-gate #include <mdb/mdb_wcb.h>
367c478bd9Sstevel@tonic-gate #include <mdb/mdb.h>
377c478bd9Sstevel@tonic-gate #include <setjmp.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate typedef struct mdb_cmd {
447c478bd9Sstevel@tonic-gate 	mdb_list_t c_list;		/* List forward/back pointers */
457c478bd9Sstevel@tonic-gate 	mdb_idcmd_t *c_dcmd;		/* Dcmd to invoke */
467c478bd9Sstevel@tonic-gate 	mdb_argvec_t c_argv;		/* Arguments for this command */
477c478bd9Sstevel@tonic-gate 	mdb_addrvec_t c_addrv;		/* Addresses for this command */
487c478bd9Sstevel@tonic-gate 	mdb_vcb_t *c_vcbs;		/* Variable control block list */
497c478bd9Sstevel@tonic-gate } mdb_cmd_t;
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate typedef struct mdb_frame {
527c478bd9Sstevel@tonic-gate 	mdb_list_t f_list;		/* Frame stack forward/back pointers */
537c478bd9Sstevel@tonic-gate 	mdb_list_t f_cmds;		/* List of commands to execute */
547c478bd9Sstevel@tonic-gate 	mdb_wcb_t *f_wcbs;		/* Walk control blocks for GC */
557c478bd9Sstevel@tonic-gate 	mdb_mblk_t *f_mblks;		/* Memory blocks for GC */
567c478bd9Sstevel@tonic-gate 	mdb_cmd_t *f_pcmd;		/* Next cmd in pipe (if pipe active) */
577c478bd9Sstevel@tonic-gate 	mdb_cmd_t *f_cp;		/* Pointer to executing command */
587c478bd9Sstevel@tonic-gate 	mdb_iob_stack_t f_istk;		/* Stack of input i/o buffers */
597c478bd9Sstevel@tonic-gate 	mdb_iob_stack_t f_ostk;		/* Stack of output i/o buffers */
607c478bd9Sstevel@tonic-gate 	jmp_buf f_pcb;			/* Control block for longjmp */
617c478bd9Sstevel@tonic-gate 	uint_t f_flags;			/* Volatile flags to save/restore */
627c478bd9Sstevel@tonic-gate 	uint_t f_id;			/* ID for debugging purposes */
637c478bd9Sstevel@tonic-gate 	mdb_argvec_t f_argvec;		/* Command arguments */
647c478bd9Sstevel@tonic-gate 	int f_oldstate;			/* Last lex state */
657c478bd9Sstevel@tonic-gate 	struct mdb_lex_state *f_lstate;	/* Current lex state */
667c478bd9Sstevel@tonic-gate 	uintmax_t f_dot;		/* Value of '.' */
678a6a72fdSaf 	mdb_bool_t pipe;		/* frame has pipe context */
68*28e4da25SMatthew Ahrens 	uint_t f_cbactive;		/* true iff a callback is active */
697c478bd9Sstevel@tonic-gate } mdb_frame_t;
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #ifdef _MDB
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate extern mdb_cmd_t *mdb_cmd_create(mdb_idcmd_t *, mdb_argvec_t *);
747c478bd9Sstevel@tonic-gate extern void mdb_cmd_destroy(mdb_cmd_t *);
757c478bd9Sstevel@tonic-gate extern void mdb_cmd_reset(mdb_cmd_t *);
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate extern void mdb_frame_reset(mdb_frame_t *);
787c478bd9Sstevel@tonic-gate extern void mdb_frame_push(mdb_frame_t *);
797c478bd9Sstevel@tonic-gate extern void mdb_frame_pop(mdb_frame_t *, int);
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate extern void mdb_frame_switch(mdb_frame_t *);
827c478bd9Sstevel@tonic-gate 
838a6a72fdSaf extern void mdb_frame_set_pipe(mdb_frame_t *);
848a6a72fdSaf extern void mdb_frame_clear_pipe(mdb_frame_t *);
858a6a72fdSaf extern mdb_frame_t *mdb_frame_pipe(void);
868a6a72fdSaf 
877c478bd9Sstevel@tonic-gate #endif	/* _MDB */
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
907c478bd9Sstevel@tonic-gate }
917c478bd9Sstevel@tonic-gate #endif
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #endif	/* _MDB_FRAME_H */
94