]> Git Repo - binutils.git/blame - gdb/buildsym.h
HP host support
[binutils.git] / gdb / buildsym.h
CommitLineData
c0302457
JG
1/* Build symbol tables in GDB's internal format.
2 Copyright (C) 1986-1991 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
1ab3bf1b
JG
20#if !defined (BUILDSYM_H)
21#define BUILDSYM_H 1
22
c0302457
JG
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
c0302457
JG
39/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */
40
41#ifndef STAB_REG_TO_REGNUM
42#define STAB_REG_TO_REGNUM(VALUE) (VALUE)
43#endif
44\f
45/* Name of source file whose symbol data we are now processing.
46 This comes from a symbol of type N_SO. */
47
48EXTERN char *last_source_file;
49
50/* Core address of start of text of current source file.
51 This too comes from the N_SO symbol. */
52
53EXTERN CORE_ADDR last_source_start_addr;
54
55/* The list of sub-source-files within the current individual compilation.
56 Each file gets its own symtab with its own linetable and associated info,
57 but they all share one blockvector. */
58
59struct subfile
60{
61 struct subfile *next;
62 char *name;
63 char *dirname;
64 struct linetable *line_vector;
65 int line_vector_length;
c0302457
JG
66};
67
68EXTERN struct subfile *subfiles;
69
70EXTERN struct subfile *current_subfile;
71
72/* Global variable which, when set, indicates that we are processing a
73 .o file compiled with gcc */
74
75EXTERN unsigned char processing_gcc_compilation;
76
93297ea0
JG
77/* When set, we are processing a .o file compiled by sun acc */
78EXTERN unsigned char processing_acc_compilation;
79
c0302457
JG
80/* Count symbols as they are processed, for error messages. */
81
82EXTERN unsigned int symnum;
83
84/* Vector of types defined so far, indexed by their dbx type numbers.
85 (In newer sun systems, dbx uses a pair of numbers in parens,
86 as in "(SUBFILENUM,NUMWITHINSUBFILE)". Then these numbers must be
87 translated through the type_translations hash table to get
88 the index into the type vector.) */
89
90EXTERN struct type **type_vector;
91
92/* Number of elements allocated for type_vector currently. */
93
94EXTERN int type_vector_length;
95
c0302457
JG
96/* Hash table of global symbols whose values are not known yet.
97 They are chained thru the SYMBOL_VALUE_CHAIN, since we don't
98 have the correct data for that slot yet. */
99/* The use of the LOC_BLOCK code in this chain is nonstandard--
100 it refers to a FORTRAN common block rather than the usual meaning. */
101
102#define HASHSIZE 127
103EXTERN struct symbol *global_sym_chain[HASHSIZE];
104
105/* Record the symbols defined for each context in a list.
106 We don't create a struct block for the context until we
107 know how long to make it. */
108
109#define PENDINGSIZE 100
110
111struct pending
112{
113 struct pending *next;
114 int nsyms;
115 struct symbol *symbol[PENDINGSIZE];
116};
117
118/* List of free `struct pending' structures for reuse. */
119EXTERN struct pending *free_pendings;
120
121/* Here are the three lists that symbols are put on. */
122
123EXTERN struct pending *file_symbols; /* static at top level, and types */
124
125EXTERN struct pending *global_symbols; /* global functions and variables */
126
4137c5fc
JG
127EXTERN struct pending *local_symbols; /* everything local to lexic context */
128
129/* Kludge for xcoffread.c */
130struct pending_stabs {
131 int count, length;
132 char *stab[1];
133};
134
135EXTERN struct pending_stabs *global_stabs;
c0302457
JG
136
137/* List of symbols declared since the last BCOMM. This list is a tail
138 of local_symbols. When ECOMM is seen, the symbols on the list
139 are noted so their proper addresses can be filled in later,
140 using the common block base address gotten from the assembler
141 stabs. */
142
143EXTERN struct pending *common_block;
144EXTERN int common_block_i;
145
146/* Stack representing unclosed lexical contexts
147 (that will become blocks, eventually). */
148
149struct context_stack
150{
a048c8f5
JG
151 struct pending *locals; /* Outer locals at the time we entered */
152 struct pending_block *old_blocks; /* Pointer into blocklist as of entry */
153 struct symbol *name; /* Name of function, if any, defining context*/
154 CORE_ADDR start_addr; /* PC where this context starts */
c0302457 155 CORE_ADDR end_addr; /* Temp slot for exception handling. */
a048c8f5 156 int depth; /* For error-checking matching push/pop */
c0302457
JG
157};
158
159EXTERN struct context_stack *context_stack;
160
161/* Index of first unused entry in context stack. */
162EXTERN int context_stack_depth;
163
164/* Currently allocated size of context stack. */
165
166EXTERN int context_stack_size;
167
a048c8f5
JG
168/* Macro "function" for popping contexts from the stack. Pushing is done
169 by a real function, push_context. This returns a pointer to a struct
170 context_stack. */
171
172#define pop_context() \
173 (&context_stack[--context_stack_depth]);
174
c0302457
JG
175/* Nonzero if within a function (so symbols should be local,
176 if nothing says specifically). */
177
178EXTERN int within_function;
179
180/* List of blocks already made (lexical contexts already closed).
181 This is used at the end to make the blockvector. */
182
183struct pending_block
184{
185 struct pending_block *next;
186 struct block *block;
187};
188
189EXTERN struct pending_block *pending_blocks;
190
c0302457
JG
191/* Global variable which, when set, indicates that we are processing a
192 .o file compiled with gcc */
193
194EXTERN unsigned char processing_gcc_compilation;
195
7e258d18
PB
196/* The type code that process_one_symbol saw on its previous invocation.
197 Used to detect pairs of N_SO symbols. */
198
199EXTERN int previous_stab_code;
200
c0302457
JG
201/* Setup a define to deal cleanly with the underscore problem */
202
203#ifdef NAMES_HAVE_UNDERSCORE
204#define HASH_OFFSET 1
205#else
206#define HASH_OFFSET 0
207#endif
208\f
209/* Support for Sun changes to dbx symbol format */
210
211/* For each identified header file, we have a table of types defined
212 in that header file.
213
214 header_files maps header file names to their type tables.
215 It is a vector of n_header_files elements.
216 Each element describes one header file.
217 It contains a vector of types.
218
219 Sometimes it can happen that the same header file produces
220 different results when included in different places.
221 This can result from conditionals or from different
222 things done before including the file.
223 When this happens, there are multiple entries for the file in this table,
224 one entry for each distinct set of results.
225 The entries are distinguished by the INSTANCE field.
226 The INSTANCE field appears in the N_BINCL and N_EXCL symbol table and is
227 used to match header-file references to their corresponding data. */
228
229struct header_file
230{
231 char *name; /* Name of header file */
232 int instance; /* Numeric code distinguishing instances
233 of one header file that produced
234 different results when included.
235 It comes from the N_BINCL or N_EXCL. */
236 struct type **vector; /* Pointer to vector of types */
237 int length; /* Allocated length (# elts) of that vector */
238};
239
240EXTERN struct header_file *header_files;
241
242EXTERN int n_header_files;
243
244EXTERN int n_allocated_header_files;
245
246/* Within each object file, various header files are assigned numbers.
247 A type is defined or referred to with a pair of numbers
248 (FILENUM,TYPENUM) where FILENUM is the number of the header file
249 and TYPENUM is the number within that header file.
250 TYPENUM is the index within the vector of types for that header file.
251
252 FILENUM == 1 is special; it refers to the main source of the object file,
253 and not to any header file. FILENUM != 1 is interpreted by looking it up
254 in the following table, which contains indices in header_files. */
255
256EXTERN int *this_object_header_files;
257
258EXTERN int n_this_object_header_files;
259
260EXTERN int n_allocated_this_object_header_files;
a048c8f5 261
a048c8f5
JG
262struct subfile_stack
263{
264 struct subfile_stack *next;
265 char *name;
a048c8f5
JG
266};
267
268EXTERN struct subfile_stack *subfile_stack;
aab77d5f
PB
269
270extern struct complaint unknown_symtype_complaint;
271
272#define next_symbol_text() (*next_symbol_text_func)()
273
274/* Function to invoke get the next symbol. Return the symbol name. */
275
1ab3bf1b
JG
276EXTERN char *(*next_symbol_text_func) PARAMS ((void));
277
278extern void
279add_symbol_to_list PARAMS ((struct symbol *, struct pending **));
280
281extern struct symbol *
282find_symbol_in_list PARAMS ((struct pending *, char *, int));
283
284extern void
285read_type_number PARAMS ((char **, int *));
286
287extern struct type *
288read_type PARAMS ((char **, struct objfile *));
289
290extern struct type **
291dbx_lookup_type PARAMS ((int [2]));
292
293extern long
294read_number PARAMS ((char **, int));
295
296extern void
297finish_block PARAMS ((struct symbol *, struct pending **,
298 struct pending_block *, CORE_ADDR, CORE_ADDR,
299 struct objfile *));
300
301extern void
302add_undefined_type PARAMS ((struct type *));
303
304extern void
305really_free_pendings PARAMS ((int foo));
306
307extern void
308start_subfile PARAMS ((char *, char *));
309
310extern void
311push_subfile PARAMS ((void));
312
313extern char *
314pop_subfile PARAMS ((void));
315
316extern struct symtab *
317end_symtab PARAMS ((CORE_ADDR, int, int,struct objfile *));
318
319extern void
320scan_file_globals PARAMS ((struct objfile *));
321
322extern void
323buildsym_new_init PARAMS ((void));
324
325extern void
326buildsym_init PARAMS ((void));
327
328extern struct context_stack *
329push_context PARAMS ((int, CORE_ADDR));
330
331extern void
332record_line PARAMS ((struct subfile *, int, CORE_ADDR));
333
334extern void
335start_symtab PARAMS ((char *, char *, CORE_ADDR));
336
337extern struct symbol *
338define_symbol PARAMS ((unsigned int, char *, int, int, struct objfile *));
339
340extern struct partial_symtab *
2670f34d
JG
341start_psymtab PARAMS ((struct objfile *, struct section_offsets *, char *,
342 CORE_ADDR, int,
1ab3bf1b
JG
343 struct partial_symbol *, struct partial_symbol *));
344
345extern void
346end_psymtab PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
347 struct partial_symtab **, int));
348
349extern void
2670f34d
JG
350process_one_symbol PARAMS ((int, int, CORE_ADDR, char *,
351 struct section_offsets *, struct objfile *));
1ab3bf1b
JG
352extern int
353hashname PARAMS ((char *));
354
355#endif /* defined (BUILDSYM_H) */
This page took 0.105748 seconds and 4 git commands to generate.