]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/buildsym.h
* buildsym.h: Remove declaration of dbxread.c functions.
[thirdparty/binutils-gdb.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
d07734e3 36#define EXTERN extern
c0302457
JG
37#endif
38
d07734e3 39#define HASHSIZE 127 /* Size of things hashed via hashname() */
c0302457 40
c0302457 41/* Name of source file whose symbol data we are now processing.
d07734e3 42 This comes from a symbol of type N_SO. */
c0302457
JG
43
44EXTERN char *last_source_file;
45
46/* Core address of start of text of current source file.
d07734e3 47 This too comes from the N_SO symbol. */
c0302457
JG
48
49EXTERN 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
55struct subfile
56{
57 struct subfile *next;
58 char *name;
59 char *dirname;
60 struct linetable *line_vector;
61 int line_vector_length;
2e4964ad 62 enum language language;
c0302457
JG
63};
64
65EXTERN struct subfile *subfiles;
66
67EXTERN struct subfile *current_subfile;
68
69/* Global variable which, when set, indicates that we are processing a
70 .o file compiled with gcc */
71
72EXTERN unsigned char processing_gcc_compilation;
73
e64ec645
JK
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. */
d07734e3 79
93297ea0
JG
80EXTERN unsigned char processing_acc_compilation;
81
c0302457
JG
82/* Count symbols as they are processed, for error messages. */
83
84EXTERN unsigned int symnum;
85
c0302457
JG
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
92struct pending
93{
94 struct pending *next;
95 int nsyms;
96 struct symbol *symbol[PENDINGSIZE];
97};
98
99/* List of free `struct pending' structures for reuse. */
d07734e3 100
c0302457
JG
101EXTERN struct pending *free_pendings;
102
103/* Here are the three lists that symbols are put on. */
104
105EXTERN struct pending *file_symbols; /* static at top level, and types */
106
107EXTERN struct pending *global_symbols; /* global functions and variables */
108
4137c5fc
JG
109EXTERN struct pending *local_symbols; /* everything local to lexic context */
110
c0302457
JG
111/* Stack representing unclosed lexical contexts
112 (that will become blocks, eventually). */
113
114struct context_stack
115{
d07734e3
FF
116 /* Outer locals at the time we entered */
117
118 struct pending *locals;
119
120 /* Pointer into blocklist as of entry */
121
122 struct pending_block *old_blocks;
123
124 /* Name of function, if any, defining context*/
125
126 struct symbol *name;
127
128 /* PC where this context starts */
129
130 CORE_ADDR start_addr;
131
132 /* Temp slot for exception handling. */
133
134 CORE_ADDR end_addr;
135
136 /* For error-checking matching push/pop */
137
138 int depth;
139
c0302457
JG
140};
141
142EXTERN struct context_stack *context_stack;
143
144/* Index of first unused entry in context stack. */
d07734e3 145
c0302457
JG
146EXTERN int context_stack_depth;
147
148/* Currently allocated size of context stack. */
149
150EXTERN int context_stack_size;
151
a048c8f5
JG
152/* Macro "function" for popping contexts from the stack. Pushing is done
153 by a real function, push_context. This returns a pointer to a struct
154 context_stack. */
155
d07734e3 156#define pop_context() (&context_stack[--context_stack_depth]);
a048c8f5 157
c0302457
JG
158/* Nonzero if within a function (so symbols should be local,
159 if nothing says specifically). */
160
161EXTERN int within_function;
162
163/* List of blocks already made (lexical contexts already closed).
164 This is used at the end to make the blockvector. */
165
166struct pending_block
167{
168 struct pending_block *next;
169 struct block *block;
170};
171
172EXTERN struct pending_block *pending_blocks;
173
c0302457 174\f
a048c8f5
JG
175struct subfile_stack
176{
177 struct subfile_stack *next;
178 char *name;
a048c8f5
JG
179};
180
181EXTERN struct subfile_stack *subfile_stack;
aab77d5f 182
aab77d5f
PB
183#define next_symbol_text() (*next_symbol_text_func)()
184
185/* Function to invoke get the next symbol. Return the symbol name. */
186
1ab3bf1b
JG
187EXTERN char *(*next_symbol_text_func) PARAMS ((void));
188
d07734e3
FF
189/* Vector of types defined so far, indexed by their type numbers.
190 Used for both stabs and coff.
191 (In newer sun systems, dbx uses a pair of numbers in parens,
192 as in "(SUBFILENUM,NUMWITHINSUBFILE)". Then these numbers must be
193 translated through the type_translations hash table to get
194 the index into the type vector.) */
1ab3bf1b 195
d07734e3 196EXTERN struct type **type_vector;
1ab3bf1b 197
d07734e3 198/* Number of elements allocated for type_vector currently. */
1ab3bf1b 199
d07734e3 200EXTERN int type_vector_length;
1ab3bf1b 201
d07734e3
FF
202/* Initial size of type vector. Is realloc'd larger if needed,
203 and realloc'd down to the size actually used, when completed. */
1ab3bf1b 204
d07734e3
FF
205#define INITIAL_TYPE_VECTOR_LENGTH 160
206
207extern void
208add_symbol_to_list PARAMS ((struct symbol *, struct pending **));
209
210extern struct symbol *
211find_symbol_in_list PARAMS ((struct pending *, char *, int));
1ab3bf1b
JG
212
213extern void
214finish_block PARAMS ((struct symbol *, struct pending **,
215 struct pending_block *, CORE_ADDR, CORE_ADDR,
216 struct objfile *));
217
1ab3bf1b
JG
218extern void
219really_free_pendings PARAMS ((int foo));
220
221extern void
222start_subfile PARAMS ((char *, char *));
223
3416d90b
FF
224extern void
225patch_subfile_names PARAMS ((struct subfile *subfile, char *name));
226
1ab3bf1b
JG
227extern void
228push_subfile PARAMS ((void));
229
230extern char *
231pop_subfile PARAMS ((void));
232
233extern struct symtab *
3c02636b 234end_symtab PARAMS ((CORE_ADDR, int, int, struct objfile *, int));
1ab3bf1b
JG
235
236extern void
237scan_file_globals PARAMS ((struct objfile *));
238
239extern void
240buildsym_new_init PARAMS ((void));
241
242extern void
243buildsym_init PARAMS ((void));
244
245extern struct context_stack *
246push_context PARAMS ((int, CORE_ADDR));
247
248extern void
249record_line PARAMS ((struct subfile *, int, CORE_ADDR));
250
251extern void
252start_symtab PARAMS ((char *, char *, CORE_ADDR));
253
1ab3bf1b
JG
254extern int
255hashname PARAMS ((char *));
256
d07734e3
FF
257#undef EXTERN
258
1ab3bf1b 259#endif /* defined (BUILDSYM_H) */