Remove CYGNUS LOCAL markers for mn10200.
[deliverable/binutils-gdb.git] / gdb / buildsym.h
1 /* Build symbol tables in GDB's internal format.
2 Copyright (C) 1986-1996 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20 #if !defined (BUILDSYM_H)
21 #define BUILDSYM_H 1
22
23 /* This module provides definitions used for creating and adding to
24 the symbol table. These routines are called from various symbol-
25 file-reading routines.
26
27 They originated in dbxread.c of gdb-4.2, and were split out to
28 make xcoffread.c more maintainable by sharing code.
29
30 Variables declared in this file can be defined by #define-ing
31 the name EXTERN to null. It is used to declare variables that
32 are normally extern, but which get defined in a single module
33 using this technique. */
34
35 #ifndef EXTERN
36 #define EXTERN extern
37 #endif
38
39 #define HASHSIZE 127 /* Size of things hashed via hashname() */
40
41 /* Name of source file whose symbol data we are now processing.
42 This comes from a symbol of type N_SO. */
43
44 EXTERN char *last_source_file;
45
46 /* Core address of start of text of current source file.
47 This too comes from the N_SO symbol. */
48
49 EXTERN CORE_ADDR last_source_start_addr;
50
51 /* The list of sub-source-files within the current individual compilation.
52 Each file gets its own symtab with its own linetable and associated info,
53 but they all share one blockvector. */
54
55 struct subfile
56 {
57 struct subfile *next;
58 char *name;
59 char *dirname;
60 struct linetable *line_vector;
61 int line_vector_length;
62 enum language language;
63 };
64
65 EXTERN struct subfile *subfiles;
66
67 EXTERN struct subfile *current_subfile;
68
69 /* Global variable which, when set, indicates that we are processing a
70 .o file compiled with gcc */
71
72 EXTERN unsigned char processing_gcc_compilation;
73
74 /* When set, we are processing a .o file compiled by sun acc. This is
75 misnamed; it refers to all stabs-in-elf implementations which use
76 N_UNDF the way Sun does, including Solaris gcc. Hopefully all
77 stabs-in-elf implementations ever invented will choose to be
78 compatible. */
79
80 EXTERN unsigned char processing_acc_compilation;
81
82 /* Count symbols as they are processed, for error messages. */
83
84 EXTERN unsigned int symnum;
85
86 /* Record the symbols defined for each context in a list.
87 We don't create a struct block for the context until we
88 know how long to make it. */
89
90 #define PENDINGSIZE 100
91
92 struct pending
93 {
94 struct pending *next;
95 int nsyms;
96 struct symbol *symbol[PENDINGSIZE];
97 };
98
99 /* Here are the three lists that symbols are put on. */
100
101 EXTERN struct pending *file_symbols; /* static at top level, and types */
102
103 EXTERN struct pending *global_symbols; /* global functions and variables */
104
105 EXTERN struct pending *local_symbols; /* everything local to lexic context */
106
107 /* Stack representing unclosed lexical contexts
108 (that will become blocks, eventually). */
109
110 struct context_stack
111 {
112 /* Outer locals at the time we entered */
113
114 struct pending *locals;
115
116 /* Pointer into blocklist as of entry */
117
118 struct pending_block *old_blocks;
119
120 /* Name of function, if any, defining context*/
121
122 struct symbol *name;
123
124 /* PC where this context starts */
125
126 CORE_ADDR start_addr;
127
128 /* Temp slot for exception handling. */
129
130 CORE_ADDR end_addr;
131
132 /* For error-checking matching push/pop */
133
134 int depth;
135
136 };
137
138 EXTERN struct context_stack *context_stack;
139
140 /* Index of first unused entry in context stack. */
141
142 EXTERN int context_stack_depth;
143
144 /* Currently allocated size of context stack. */
145
146 EXTERN int context_stack_size;
147
148 /* Macro "function" for popping contexts from the stack. Pushing is done
149 by a real function, push_context. This returns a pointer to a struct
150 context_stack. */
151
152 #define pop_context() (&context_stack[--context_stack_depth]);
153
154 /* Nonzero if within a function (so symbols should be local,
155 if nothing says specifically). */
156
157 EXTERN int within_function;
158
159 /* List of blocks already made (lexical contexts already closed).
160 This is used at the end to make the blockvector. */
161
162 struct pending_block
163 {
164 struct pending_block *next;
165 struct block *block;
166 };
167
168 \f
169 struct subfile_stack
170 {
171 struct subfile_stack *next;
172 char *name;
173 };
174
175 EXTERN struct subfile_stack *subfile_stack;
176
177 #define next_symbol_text(objfile) (*next_symbol_text_func)(objfile)
178
179 /* Function to invoke get the next symbol. Return the symbol name. */
180
181 EXTERN char *(*next_symbol_text_func) PARAMS ((struct objfile *));
182
183 /* Vector of types defined so far, indexed by their type numbers.
184 Used for both stabs and coff.
185 (In newer sun systems, dbx uses a pair of numbers in parens,
186 as in "(SUBFILENUM,NUMWITHINSUBFILE)". Then these numbers must be
187 translated through the type_translations hash table to get
188 the index into the type vector.) */
189
190 EXTERN struct type **type_vector;
191
192 /* Number of elements allocated for type_vector currently. */
193
194 EXTERN int type_vector_length;
195
196 /* Initial size of type vector. Is realloc'd larger if needed,
197 and realloc'd down to the size actually used, when completed. */
198
199 #define INITIAL_TYPE_VECTOR_LENGTH 160
200
201 extern void
202 add_symbol_to_list PARAMS ((struct symbol *, struct pending **));
203
204 extern struct symbol *
205 find_symbol_in_list PARAMS ((struct pending *, char *, int));
206
207 extern void
208 finish_block PARAMS ((struct symbol *, struct pending **,
209 struct pending_block *, CORE_ADDR, CORE_ADDR,
210 struct objfile *));
211
212 extern void
213 really_free_pendings PARAMS ((int foo));
214
215 extern void
216 start_subfile PARAMS ((char *, char *));
217
218 extern void
219 patch_subfile_names PARAMS ((struct subfile *subfile, char *name));
220
221 extern void
222 push_subfile PARAMS ((void));
223
224 extern char *
225 pop_subfile PARAMS ((void));
226
227 extern struct symtab *
228 end_symtab PARAMS ((CORE_ADDR, struct objfile *, int));
229
230 extern void
231 scan_file_globals PARAMS ((struct objfile *));
232
233 extern void
234 buildsym_new_init PARAMS ((void));
235
236 extern void
237 buildsym_init PARAMS ((void));
238
239 extern struct context_stack *
240 push_context PARAMS ((int, CORE_ADDR));
241
242 extern void
243 record_line PARAMS ((struct subfile *, int, CORE_ADDR));
244
245 extern void
246 start_symtab PARAMS ((char *, char *, CORE_ADDR));
247
248 extern int
249 hashname PARAMS ((char *));
250
251 extern void
252 free_pending_blocks PARAMS ((void));
253
254 /* FIXME: Note that this is used only in buildsym.c and dstread.c,
255 which should be fixed to not need direct access to make_blockvector. */
256
257 extern struct blockvector *
258 make_blockvector PARAMS ((struct objfile *));
259
260 /* FIXME: Note that this is used only in buildsym.c and dstread.c,
261 which should be fixed to not need direct access to record_pending_block. */
262
263 extern void
264 record_pending_block PARAMS ((struct objfile *, struct block *,
265 struct pending_block *));
266
267 #undef EXTERN
268
269 #endif /* defined (BUILDSYM_H) */
This page took 0.042926 seconds and 4 git commands to generate.