xref: /illumos-gate/usr/src/tools/stabs/stabs.h (revision 7c478bd9)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1994-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_STABS_H
28 #define	_SYS_STABS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <stdio.h>
33 #include <setjmp.h>
34 #include <string.h>
35 #include <ctype.h>
36 #include <stdlib.h>
37 #include <unistd.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #define	MAXLINE	8192
44 
45 #define	BUCKETS	128
46 
47 struct node {
48 	char *name;
49 	char *format;
50 	char *format2;
51 	struct child *child;
52 };
53 
54 struct	child {
55 	char *name;
56 	char *format;
57 	struct child *next;
58 };
59 
60 #define	HASH(NUM)		((int)(NUM & (BUCKETS - 1)))
61 
62 enum type {
63 	INTRINSIC,
64 	POINTER,
65 	ARRAY,
66 	FUNCTION,
67 	STRUCT,
68 	UNION,
69 	ENUM,
70 	FORWARD,
71 	TYPEOF,
72 	VOLATILE,
73 	CONST
74 };
75 
76 struct tdesc {
77 	char	*name;
78 	struct	tdesc *next;
79 	enum	type type;
80 	int	size;
81 	union {
82 		struct	tdesc *tdesc;		/* *, f , to */
83 		struct	ardef *ardef;		/* ar */
84 		struct members {		/* s, u */
85 			struct	mlist *forw;
86 			struct	mlist *back;
87 		} members;
88 		struct  elist *emem; 		/* e */
89 	} data;
90 	int	id;
91 	struct tdesc *hash;
92 };
93 
94 struct elist {
95 	char	*name;
96 	int	number;
97 	struct elist *next;
98 };
99 
100 struct element {
101 	struct tdesc *index_type;
102 	int	range_start;
103 	int	range_end;
104 };
105 
106 struct ardef {
107 	struct tdesc	*contents;
108 	struct element	*indices;
109 };
110 
111 struct mlist {
112 	int	offset;
113 	int	size;
114 	char	*name;
115 	struct	mlist *next;
116 	struct	mlist *prev;
117 	struct	tdesc *fdesc;		/* s, u */
118 };
119 
120 struct model_info {
121 	char *name;
122 	size_t pointersize;
123 	size_t charsize;
124 	size_t shortsize;
125 	size_t intsize;
126 	size_t longsize;
127 };
128 
129 extern struct tdesc *lookupname(char *);
130 extern void parse_input(void);
131 extern char *convert_format(char *format, char *dfault);
132 extern struct child *find_child(struct node *np, char *w);
133 extern char *uc(const char *s);
134 
135 extern boolean_t error;
136 extern struct model_info *model;
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif	/* _SYS_STABS_H */
143