1178479Sjb/* 2178479Sjb * CDDL HEADER START 3178479Sjb * 4178479Sjb * The contents of this file are subject to the terms of the 5178479Sjb * Common Development and Distribution License, Version 1.0 only 6178479Sjb * (the "License"). You may not use this file except in compliance 7178479Sjb * with the License. 8178479Sjb * 9178479Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10178479Sjb * or http://www.opensolaris.org/os/licensing. 11178479Sjb * See the License for the specific language governing permissions 12178479Sjb * and limitations under the License. 13178479Sjb * 14178479Sjb * When distributing Covered Code, include this CDDL HEADER in each 15178479Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16178479Sjb * If applicable, add the following below this CDDL HEADER, with the 17178479Sjb * fields enclosed by brackets "[]" replaced with your own identifying 18178479Sjb * information: Portions Copyright [yyyy] [name of copyright owner] 19178479Sjb * 20178479Sjb * CDDL HEADER END 21178479Sjb */ 22178479Sjb/* 23178479Sjb * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24178479Sjb * Use is subject to license terms. 25178479Sjb */ 26178479Sjb 27178479Sjb#ifndef _DT_PCB_H 28178479Sjb#define _DT_PCB_H 29178479Sjb 30178479Sjb#pragma ident "%Z%%M% %I% %E% SMI" 31178479Sjb 32178479Sjb#include <dtrace.h> 33178479Sjb#include <setjmp.h> 34178479Sjb#include <stdio.h> 35178479Sjb 36178479Sjb#ifdef __cplusplus 37178479Sjbextern "C" { 38178479Sjb#endif 39178479Sjb 40178479Sjb#include <dt_parser.h> 41178479Sjb#include <dt_regset.h> 42178479Sjb#include <dt_inttab.h> 43178479Sjb#include <dt_strtab.h> 44178479Sjb#include <dt_decl.h> 45178479Sjb#include <dt_as.h> 46178479Sjb 47178479Sjbtypedef struct dt_pcb { 48178479Sjb dtrace_hdl_t *pcb_hdl; /* pointer to library handle */ 49178479Sjb struct dt_pcb *pcb_prev; /* pointer to previous pcb in stack */ 50178479Sjb FILE *pcb_fileptr; /* pointer to input file (or NULL) */ 51178479Sjb char *pcb_filetag; /* optional file name string (or NULL) */ 52178479Sjb const char *pcb_string; /* pointer to input string (or NULL) */ 53178479Sjb const char *pcb_strptr; /* pointer to input position */ 54178479Sjb size_t pcb_strlen; /* length of pcb_string */ 55178479Sjb int pcb_sargc; /* number of script arguments (if any) */ 56178479Sjb char *const *pcb_sargv; /* script argument strings (if any) */ 57178479Sjb ushort_t *pcb_sflagv; /* script argument flags (DT_IDFLG_* bits) */ 58178479Sjb dt_scope_t pcb_dstack; /* declaration processing stack */ 59178479Sjb dt_node_t *pcb_list; /* list of allocated parse tree nodes */ 60178479Sjb dt_node_t *pcb_hold; /* parse tree nodes on hold until end of defn */ 61178479Sjb dt_node_t *pcb_root; /* root of current parse tree */ 62178479Sjb dt_idstack_t pcb_globals; /* stack of global identifier hash tables */ 63178479Sjb dt_idhash_t *pcb_locals; /* current hash table of local identifiers */ 64178479Sjb dt_idhash_t *pcb_idents; /* current hash table of ambiguous idents */ 65178479Sjb dt_idhash_t *pcb_pragmas; /* current hash table of pending pragmas */ 66178479Sjb dt_inttab_t *pcb_inttab; /* integer table for constant references */ 67178479Sjb dt_strtab_t *pcb_strtab; /* string table for string references */ 68178479Sjb dt_regset_t *pcb_regs; /* register set for code generation */ 69178479Sjb dt_irlist_t pcb_ir; /* list of unrelocated IR instructions */ 70178479Sjb uint_t pcb_asvidx; /* assembler vartab index (see dt_as.c) */ 71178479Sjb ulong_t **pcb_asxrefs; /* assembler imported xlators (see dt_as.c) */ 72178479Sjb uint_t pcb_asxreflen; /* assembler xlator map length (see dt_as.c) */ 73178479Sjb const dtrace_probedesc_t *pcb_pdesc; /* probedesc for current context */ 74178479Sjb struct dt_probe *pcb_probe; /* probe associated with current context */ 75178479Sjb dtrace_probeinfo_t pcb_pinfo; /* info associated with current context */ 76178479Sjb dtrace_attribute_t pcb_amin; /* stability minimum for compilation */ 77178479Sjb dt_node_t *pcb_dret; /* node containing return type for assembler */ 78178479Sjb dtrace_difo_t *pcb_difo; /* intermediate DIF object made by assembler */ 79178479Sjb dtrace_prog_t *pcb_prog; /* intermediate program made by compiler */ 80178479Sjb dtrace_stmtdesc_t *pcb_stmt; /* intermediate stmt made by compiler */ 81178479Sjb dtrace_ecbdesc_t *pcb_ecbdesc; /* intermediate ecbdesc made by cmplr */ 82178479Sjb jmp_buf pcb_jmpbuf; /* setjmp(3C) buffer for error return */ 83178479Sjb const char *pcb_region; /* optional region name for yyerror() suffix */ 84178479Sjb dtrace_probespec_t pcb_pspec; /* probe description evaluation context */ 85178479Sjb uint_t pcb_cflags; /* optional compilation flags (see dtrace.h) */ 86178479Sjb uint_t pcb_idepth; /* preprocessor #include nesting depth */ 87178479Sjb yystate_t pcb_yystate; /* lex/yacc parsing state (see yybegin()) */ 88178479Sjb int pcb_context; /* yyparse() rules context (DT_CTX_* value) */ 89178479Sjb int pcb_token; /* token to be returned by yylex() (if != 0) */ 90178479Sjb int pcb_cstate; /* state to be restored by lexer at state end */ 91178479Sjb int pcb_braces; /* number of open curly braces in lexer */ 92178479Sjb int pcb_brackets; /* number of open square brackets in lexer */ 93178479Sjb int pcb_parens; /* number of open parentheses in lexer */ 94178479Sjb} dt_pcb_t; 95178479Sjb 96178479Sjbextern void dt_pcb_push(dtrace_hdl_t *, dt_pcb_t *); 97178479Sjbextern void dt_pcb_pop(dtrace_hdl_t *, int); 98178479Sjb 99178479Sjb#ifdef __cplusplus 100178479Sjb} 101178479Sjb#endif 102178479Sjb 103178479Sjb#endif /* _DT_PCB_H */ 104