dt_pcb.h revision 178479
150477Speter/* 2139749Simp * CDDL HEADER START 3196008Smjacob * 4167403Smjacob * The contents of this file are subject to the terms of the 5167403Smjacob * Common Development and Distribution License, Version 1.0 only 6167403Smjacob * (the "License"). You may not use this file except in compliance 7167403Smjacob * with the License. 8167403Smjacob * 9167403Smjacob * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10167403Smjacob * or http://www.opensolaris.org/os/licensing. 11167403Smjacob * See the License for the specific language governing permissions 12167403Smjacob * and limitations under the License. 13167403Smjacob * 14167403Smjacob * When distributing Covered Code, include this CDDL HEADER in each 15167403Smjacob * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16167403Smjacob * If applicable, add the following below this CDDL HEADER, with the 17167403Smjacob * fields enclosed by brackets "[]" replaced with your own identifying 18167403Smjacob * information: Portions Copyright [yyyy] [name of copyright owner] 19167403Smjacob * 20167403Smjacob * CDDL HEADER END 21167403Smjacob */ 22167403Smjacob/* 23167403Smjacob * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24167403Smjacob * Use is subject to license terms. 25167403Smjacob */ 26167403Smjacob 27196008Smjacob#ifndef _DT_PCB_H 28167403Smjacob#define _DT_PCB_H 29167403Smjacob 3035388Smjacob#pragma ident "%Z%%M% %I% %E% SMI" 3135388Smjacob 3235388Smjacob#include <dtrace.h> 3335388Smjacob#include <setjmp.h> 3435388Smjacob#include <stdio.h> 3535388Smjacob 3635388Smjacob#ifdef __cplusplus 3735388Smjacobextern "C" { 3835388Smjacob#endif 3935388Smjacob 4035388Smjacob#include <dt_parser.h> 4135388Smjacob#include <dt_regset.h> 4235388Smjacob#include <dt_inttab.h> 4335388Smjacob#include <dt_strtab.h> 4435388Smjacob#include <dt_decl.h> 4535388Smjacob#include <dt_as.h> 4635388Smjacob 4735388Smjacobtypedef struct dt_pcb { 4835388Smjacob dtrace_hdl_t *pcb_hdl; /* pointer to library handle */ 4935388Smjacob struct dt_pcb *pcb_prev; /* pointer to previous pcb in stack */ 5035388Smjacob FILE *pcb_fileptr; /* pointer to input file (or NULL) */ 5135388Smjacob char *pcb_filetag; /* optional file name string (or NULL) */ 5235388Smjacob const char *pcb_string; /* pointer to input string (or NULL) */ 5335388Smjacob const char *pcb_strptr; /* pointer to input position */ 5435388Smjacob size_t pcb_strlen; /* length of pcb_string */ 5546967Smjacob int pcb_sargc; /* number of script arguments (if any) */ 5646967Smjacob char *const *pcb_sargv; /* script argument strings (if any) */ 5746967Smjacob ushort_t *pcb_sflagv; /* script argument flags (DT_IDFLG_* bits) */ 5846967Smjacob dt_scope_t pcb_dstack; /* declaration processing stack */ 5946967Smjacob dt_node_t *pcb_list; /* list of allocated parse tree nodes */ 6046967Smjacob dt_node_t *pcb_hold; /* parse tree nodes on hold until end of defn */ 6146967Smjacob dt_node_t *pcb_root; /* root of current parse tree */ 6246967Smjacob dt_idstack_t pcb_globals; /* stack of global identifier hash tables */ 6335388Smjacob dt_idhash_t *pcb_locals; /* current hash table of local identifiers */ 6435388Smjacob dt_idhash_t *pcb_idents; /* current hash table of ambiguous idents */ 6544819Smjacob dt_idhash_t *pcb_pragmas; /* current hash table of pending pragmas */ 6635388Smjacob dt_inttab_t *pcb_inttab; /* integer table for constant references */ 6744819Smjacob dt_strtab_t *pcb_strtab; /* string table for string references */ 6844819Smjacob dt_regset_t *pcb_regs; /* register set for code generation */ 6982689Smjacob dt_irlist_t pcb_ir; /* list of unrelocated IR instructions */ 70163899Smjacob uint_t pcb_asvidx; /* assembler vartab index (see dt_as.c) */ 7135388Smjacob ulong_t **pcb_asxrefs; /* assembler imported xlators (see dt_as.c) */ 7235388Smjacob uint_t pcb_asxreflen; /* assembler xlator map length (see dt_as.c) */ 7344819Smjacob const dtrace_probedesc_t *pcb_pdesc; /* probedesc for current context */ 7435388Smjacob struct dt_probe *pcb_probe; /* probe associated with current context */ 7535388Smjacob dtrace_probeinfo_t pcb_pinfo; /* info associated with current context */ 7644819Smjacob dtrace_attribute_t pcb_amin; /* stability minimum for compilation */ 7735388Smjacob dt_node_t *pcb_dret; /* node containing return type for assembler */ 7835388Smjacob dtrace_difo_t *pcb_difo; /* intermediate DIF object made by assembler */ 7944819Smjacob dtrace_prog_t *pcb_prog; /* intermediate program made by compiler */ 8044819Smjacob dtrace_stmtdesc_t *pcb_stmt; /* intermediate stmt made by compiler */ 8144819Smjacob dtrace_ecbdesc_t *pcb_ecbdesc; /* intermediate ecbdesc made by cmplr */ 8244819Smjacob jmp_buf pcb_jmpbuf; /* setjmp(3C) buffer for error return */ 8364088Smjacob const char *pcb_region; /* optional region name for yyerror() suffix */ 8464088Smjacob dtrace_probespec_t pcb_pspec; /* probe description evaluation context */ 8564088Smjacob uint_t pcb_cflags; /* optional compilation flags (see dtrace.h) */ 8635388Smjacob uint_t pcb_idepth; /* preprocessor #include nesting depth */ 8735388Smjacob yystate_t pcb_yystate; /* lex/yacc parsing state (see yybegin()) */ 8835388Smjacob int pcb_context; /* yyparse() rules context (DT_CTX_* value) */ 8935388Smjacob int pcb_token; /* token to be returned by yylex() (if != 0) */ 9035388Smjacob int pcb_cstate; /* state to be restored by lexer at state end */ 9144819Smjacob int pcb_braces; /* number of open curly braces in lexer */ 9244819Smjacob int pcb_brackets; /* number of open square brackets in lexer */ 9344819Smjacob int pcb_parens; /* number of open parentheses in lexer */ 9444819Smjacob} dt_pcb_t; 9544819Smjacob 9644819Smjacobextern void dt_pcb_push(dtrace_hdl_t *, dt_pcb_t *); 9744819Smjacobextern void dt_pcb_pop(dtrace_hdl_t *, int); 9844819Smjacob 9935388Smjacob#ifdef __cplusplus 10035388Smjacob} 10135388Smjacob#endif 10235388Smjacob 10344819Smjacob#endif /* _DT_PCB_H */ 10454671Smjacob