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.
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.
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]
21 /* Copyright (c) 1988 AT&T */
22 /* All Rights Reserved */
25 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
33 * symintHdr.h -- symbol information interface, Header file.
35 * these headers are the definitions used by the set of
36 * routines which provide an interface to access symbol
37 * information stored in the object file.
40 /* protect against multiple inclusion */
52 * PROF_DEBUG - compilation-time debug flag
54 * if this is defined, we include debugging code.
56 * there are three levels: none, 1, and 2.
58 * none -- (PROF_DEBUG is undefined.)
59 * no debugging code is generated.
61 * 1 -- (PROF_DEBUG == 1.)
62 * assertion code is generated, only.
64 * 2 -- (PROF_DEBUG == anything else.)
65 * both assertion code and debug() code
73 #else /* == 2, anything else */
82 * - caCOVWORD is used for all entries in the coverage structure. This
83 * includes the number of basic blocks, each line number in the line
84 * number array, and each execution count in the count array. The size
85 * (number of bytes) of the coverage structure may be found in the symbol
88 typedef unsigned char BYTES_1
;
89 typedef unsigned short BYTES_2
;
90 typedef unsigned int BYTES_4
;
91 typedef unsigned long BYTES_LONG
; /* ``long'' is 4 bytes, too */
92 typedef BYTES_LONG caCOVWORD
;
93 typedef unsigned char BOOLEAN
;
96 * Type of base address - used in dump.c and soqueue.c.
98 typedef unsigned long TYPE_BASEAD
;
103 #define SYMBOL_IS_FUNC(sym_p) \
104 (((sym_p)->ps_dbg.pd_symtag == TAG_subroutine) || \
105 ((sym_p)->ps_dbg.pd_symtag == TAG_global_subroutine))
106 #define SYMBOL_NAME(sym_p) (sym_p)->ps_dbg.pd_name
107 #define SYMBOL_LINES_P(sym_p) (sym_p)->ps_dbg.pd_line_p
108 #define SYMBOL_LASTLN_P(sym_p) (sym_p)->ps_dbg.pd_lali_p
110 #define ISYMBOL_IS_FUNC(sym_p, index) SYMBOL_IS_FUNC(&((sym_p)[(index)]))
111 #define ISYMBOL_NAME(sym_p, index) SYMBOL_NAME(&((sym_p)[(index)]))
112 #define ISYMBOL_LINES(sym_p, index) SYMBOL_LINES(&((sym_p)[(index)]))
113 #define ISYMBOL_LASTLN(sym_p, index) SYMBOL_LASTLN(&((sym_p)[(index)]))
116 unsigned char pe_ident
[EI_NIDENT
];
120 #define PROF_MAGIC_FAKE_STRING "fake prof magic"
123 #define COV_PREFIX "__coverage."
127 * ``primitive'' definitions used in
128 * subsequent structures.
131 typedef unsigned char LEN1
;
133 typedef unsigned short LEN2
;
135 typedef unsigned long int LEN4
;
137 typedef unsigned long int ADDR
;
139 typedef LEN2 DBG_TAG
;
142 * object ``replacing'' a symbol table entry - PROF_SYMBOL.
144 * a PROF_SYMBOL will contain or direct us to all the information
145 * needed by the profilers, for a given symbol.
147 typedef struct symint_prof_symbol
150 struct symint_prof_symbol
{
151 Elf32_Sym ps_sym
; /* normal symbol entry */
156 * structure to replace LDFILE - PROF_FILE.
158 typedef struct symint_prof_file
163 * symint_prof_file contains a primary and an (optional) auxiliary
164 * symbol table, which we wish to treat as a single logical symbol table.
165 * In this logical table, the data from the auxiliary table preceeds that
166 * from the primary. Symbol indices start at [0], which is the first item
167 * in the auxiliary table if there is one. The sole purpose for this is so
168 * that we can treat the combination of .SUNW_ldynsym and .dynsym sections
169 * as a logically single entity.
171 * Both tables must share the same string table section.
173 struct symint_prof_file
{
174 int pf_fildes
; /* file descriptor */
175 Elf
*pf_elf_p
; /* elf descriptor */
176 Elf32_Ehdr
*pf_elfhd_p
; /* elf header */
177 Elf_Data
*pf_snmdat_p
; /* section names data */
178 Elf_Data
*pf_symdat_pri_p
; /* primary symbol table data */
179 Elf_Data
*pf_symdat_aux_p
; /* auxiliary symbol table data */
180 Elf32_Word pf_symstr_ndx
; /* Section index of string table */
181 int pf_nstsyms
; /* total # symbols in both tables */
182 int pf_nstsyms_aux
; /* # symbols in auxiliary table */
184 Elf32_Shdr
*pf_shdarr_p
; /* complete array of section hdrs */
186 PROF_SYMBOL
*pf_symarr_p
; /* P_S array w/symbols of interest */
187 int pf_nsyms
; /* number of symbols of interest */
190 #endif /* _SYMINTHDR_H */