Commit | Line | Data |
---|---|---|
7e258d18 | 1 | /* Shared code to pre-read a stab (dbx-style), when building a psymtab. |
c2e4669f JG |
2 | Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, |
3 | Inc. | |
7e258d18 PB |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
21 | /* The following need to be defined: | |
22 | SET_NAMESTRING() --Set namestring to name of symbol. | |
23 | CUR_SYMBOL_TYPE --Type code of current symbol. | |
24 | CUR_SYMBOL_VALUE --Value field of current symbol. May be adjusted here. | |
25 | */ | |
26 | ||
7e258d18 PB |
27 | /* End of macro definitions, now let's handle them symbols! */ |
28 | ||
29 | switch (CUR_SYMBOL_TYPE) | |
30 | { | |
31 | char *p; | |
32 | /* | |
33 | * Standard, external, non-debugger, symbols | |
34 | */ | |
35 | ||
7e258d18 PB |
36 | case N_TEXT | N_EXT: |
37 | case N_NBTEXT | N_EXT: | |
38 | case N_NBDATA | N_EXT: | |
39 | case N_NBBSS | N_EXT: | |
40 | case N_SETV | N_EXT: | |
41 | case N_ABS | N_EXT: | |
42 | case N_DATA | N_EXT: | |
43 | case N_BSS | N_EXT: | |
aab77d5f | 44 | #ifdef DBXREAD_ONLY |
7e258d18 PB |
45 | |
46 | CUR_SYMBOL_VALUE += addr; /* Relocate */ | |
47 | ||
48 | SET_NAMESTRING(); | |
49 | ||
50 | bss_ext_symbol: | |
1ab3bf1b JG |
51 | record_minimal_symbol (namestring, CUR_SYMBOL_VALUE, |
52 | CUR_SYMBOL_TYPE, objfile); /* Always */ | |
aab77d5f | 53 | #endif /* DBXREAD_ONLY */ |
7e258d18 PB |
54 | continue; |
55 | ||
56 | /* Standard, local, non-debugger, symbols */ | |
57 | ||
58 | case N_NBTEXT: | |
59 | ||
60 | /* We need to be able to deal with both N_FN or N_TEXT, | |
61 | because we have no way of knowing whether the sys-supplied ld | |
62 | or GNU ld was used to make the executable. Sequents throw | |
63 | in another wrinkle -- they renumbered N_FN. */ | |
64 | ||
65 | case N_FN: | |
66 | case N_FN_SEQ: | |
67 | case N_TEXT: | |
aab77d5f | 68 | #ifdef DBXREAD_ONLY |
7e258d18 PB |
69 | CUR_SYMBOL_VALUE += addr; /* Relocate */ |
70 | SET_NAMESTRING(); | |
71 | if ((namestring[0] == '-' && namestring[1] == 'l') | |
72 | || (namestring [(nsl = strlen (namestring)) - 1] == 'o' | |
73 | && namestring [nsl - 2] == '.')) | |
74 | { | |
5e2e79f8 FF |
75 | if (objfile -> ei.entry_point < CUR_SYMBOL_VALUE && |
76 | objfile -> ei.entry_point >= last_o_file_start && | |
77 | addr == 0) /* FIXME nogood nomore */ | |
7e258d18 | 78 | { |
5e2e79f8 FF |
79 | objfile -> ei.entry_file_lowpc = last_o_file_start; |
80 | objfile -> ei.entry_file_highpc = CUR_SYMBOL_VALUE; | |
7e258d18 PB |
81 | } |
82 | if (past_first_source_file && pst | |
83 | /* The gould NP1 uses low values for .o and -l symbols | |
84 | which are not the address. */ | |
85 | && CUR_SYMBOL_VALUE > pst->textlow) | |
86 | { | |
87 | END_PSYMTAB (pst, psymtab_include_list, includes_used, | |
88 | symnum * symbol_size, CUR_SYMBOL_VALUE, | |
89 | dependency_list, dependencies_used); | |
90 | pst = (struct partial_symtab *) 0; | |
91 | includes_used = 0; | |
92 | dependencies_used = 0; | |
93 | } | |
94 | else | |
95 | past_first_source_file = 1; | |
96 | last_o_file_start = CUR_SYMBOL_VALUE; | |
97 | } | |
aab77d5f | 98 | #endif /* DBXREAD_ONLY */ |
7e258d18 PB |
99 | continue; |
100 | ||
101 | case N_DATA: | |
aab77d5f | 102 | #ifdef DBXREAD_ONLY |
7e258d18 PB |
103 | CUR_SYMBOL_VALUE += addr; /* Relocate */ |
104 | SET_NAMESTRING (); | |
105 | /* Check for __DYNAMIC, which is used by Sun shared libraries. | |
106 | Record it even if it's local, not global, so we can find it. | |
107 | Same with virtual function tables, both global and static. */ | |
108 | if ((namestring[8] == 'C' && (strcmp ("__DYNAMIC", namestring) == 0)) | |
109 | || VTBL_PREFIX_P ((namestring+HASH_OFFSET))) | |
110 | { | |
111 | /* Not really a function here, but... */ | |
1ab3bf1b JG |
112 | record_minimal_symbol (namestring, CUR_SYMBOL_VALUE, |
113 | CUR_SYMBOL_TYPE, objfile); /* Always */ | |
7e258d18 | 114 | } |
aab77d5f | 115 | #endif /* DBXREAD_ONLY */ |
7e258d18 PB |
116 | continue; |
117 | ||
118 | case N_UNDF | N_EXT: | |
aab77d5f | 119 | #ifdef DBXREAD_ONLY |
7e258d18 PB |
120 | if (CUR_SYMBOL_VALUE != 0) { |
121 | /* This is a "Fortran COMMON" symbol. See if the target | |
122 | environment knows where it has been relocated to. */ | |
123 | ||
124 | CORE_ADDR reladdr; | |
125 | ||
126 | SET_NAMESTRING(); | |
127 | if (target_lookup_symbol (namestring, &reladdr)) { | |
128 | continue; /* Error in lookup; ignore symbol for now. */ | |
129 | } | |
130 | CUR_SYMBOL_TYPE ^= (N_BSS^N_UNDF); /* Define it as a bss-symbol */ | |
131 | CUR_SYMBOL_VALUE = reladdr; | |
132 | goto bss_ext_symbol; | |
133 | } | |
aab77d5f | 134 | #endif /* DBXREAD_ONLY */ |
7e258d18 | 135 | continue; /* Just undefined, not COMMON */ |
7e258d18 | 136 | |
9342ecb9 JG |
137 | case N_UNDF: |
138 | #ifdef DBXREAD_ONLY | |
139 | if (processing_acc_compilation && bufp->n_strx == 1) { | |
bcbf9559 JG |
140 | /* Deal with relative offsets in the string table |
141 | used in ELF+STAB under Solaris. If we want to use the | |
142 | n_strx field, which contains the name of the file, | |
143 | we must adjust file_string_table_offset *before* calling | |
144 | SET_NAMESTRING(). */ | |
9342ecb9 JG |
145 | past_first_source_file = 1; |
146 | file_string_table_offset = next_file_string_table_offset; | |
147 | next_file_string_table_offset = | |
148 | file_string_table_offset + bufp->n_value; | |
149 | if (next_file_string_table_offset < file_string_table_offset) | |
150 | error ("string table offset backs up at %d", symnum); | |
151 | /* FIXME -- replace error() with complaint. */ | |
152 | continue; | |
153 | } | |
154 | #endif /* DBXREAD_ONLY */ | |
155 | continue; | |
156 | ||
7e258d18 PB |
157 | /* Lots of symbol types we can just ignore. */ |
158 | ||
7e258d18 PB |
159 | case N_ABS: |
160 | case N_BSS: | |
161 | case N_NBDATA: | |
162 | case N_NBBSS: | |
163 | continue; | |
164 | ||
165 | /* Keep going . . .*/ | |
166 | ||
167 | /* | |
168 | * Special symbol types for GNU | |
169 | */ | |
170 | case N_INDR: | |
171 | case N_INDR | N_EXT: | |
172 | case N_SETA: | |
173 | case N_SETA | N_EXT: | |
174 | case N_SETT: | |
175 | case N_SETT | N_EXT: | |
176 | case N_SETD: | |
177 | case N_SETD | N_EXT: | |
178 | case N_SETB: | |
179 | case N_SETB | N_EXT: | |
180 | case N_SETV: | |
181 | continue; | |
182 | ||
183 | /* | |
184 | * Debugger symbols | |
185 | */ | |
186 | ||
187 | case N_SO: { | |
188 | unsigned long valu = CUR_SYMBOL_VALUE; | |
189 | /* Symbol number of the first symbol of this file (i.e. the N_SO | |
190 | if there is just one, or the first if we have a pair). */ | |
191 | int first_symnum = symnum; | |
192 | ||
193 | /* End the current partial symtab and start a new one */ | |
194 | ||
195 | SET_NAMESTRING(); | |
196 | ||
7e258d18 PB |
197 | valu += addr; /* Relocate */ |
198 | ||
199 | if (pst && past_first_source_file) | |
200 | { | |
aab77d5f PB |
201 | /* Some compilers (including gcc) emit a pair of initial N_SOs. |
202 | The first one is a directory name; the second the file name. | |
203 | If pst exists, is empty, and has a filename ending in '/', | |
204 | we assume the previous N_SO was a directory name. */ | |
1ab3bf1b JG |
205 | if (pst -> objfile -> global_psymbols.next |
206 | == (pst -> objfile -> global_psymbols.list + pst->globals_offset) | |
207 | && pst -> objfile -> static_psymbols.next | |
208 | == (pst -> objfile -> static_psymbols.list + pst->statics_offset) | |
aab77d5f PB |
209 | && pst->filename && pst->filename[0] |
210 | && pst->filename[strlen(pst->filename)-1] == '/') { | |
211 | /* Just replace the directory name with the real filename. */ | |
212 | pst->filename = | |
1ab3bf1b | 213 | (char *) obstack_alloc (&pst->objfile->psymbol_obstack, |
aab77d5f PB |
214 | strlen (namestring) + 1); |
215 | strcpy (pst->filename, namestring); | |
216 | continue; | |
217 | } | |
7e258d18 PB |
218 | END_PSYMTAB (pst, psymtab_include_list, includes_used, |
219 | first_symnum * symbol_size, valu, | |
220 | dependency_list, dependencies_used); | |
221 | pst = (struct partial_symtab *) 0; | |
222 | includes_used = 0; | |
223 | dependencies_used = 0; | |
224 | } | |
225 | else | |
226 | past_first_source_file = 1; | |
227 | ||
228 | pst = START_PSYMTAB (objfile, addr, | |
229 | namestring, valu, | |
230 | first_symnum * symbol_size, | |
1ab3bf1b JG |
231 | objfile -> global_psymbols.next, |
232 | objfile -> static_psymbols.next); | |
7e258d18 PB |
233 | continue; |
234 | } | |
235 | ||
7e258d18 | 236 | case N_BINCL: |
aab77d5f | 237 | #ifdef DBXREAD_ONLY |
7e258d18 PB |
238 | /* Add this bincl to the bincl_list for future EXCLs. No |
239 | need to save the string; it'll be around until | |
240 | read_dbx_symtab function returns */ | |
241 | ||
242 | SET_NAMESTRING(); | |
243 | ||
244 | add_bincl_to_list (pst, namestring, CUR_SYMBOL_VALUE); | |
245 | ||
246 | /* Mark down an include file in the current psymtab */ | |
247 | ||
248 | psymtab_include_list[includes_used++] = namestring; | |
249 | if (includes_used >= includes_allocated) | |
250 | { | |
251 | char **orig = psymtab_include_list; | |
252 | ||
253 | psymtab_include_list = (char **) | |
254 | alloca ((includes_allocated *= 2) * | |
255 | sizeof (char *)); | |
be772100 JG |
256 | memcpy ((PTR)psymtab_include_list, (PTR)orig, |
257 | includes_used * sizeof (char *)); | |
7e258d18 PB |
258 | } |
259 | ||
aab77d5f | 260 | #endif /* DBXREAD_ONLY */ |
7e258d18 | 261 | continue; |
7e258d18 PB |
262 | |
263 | case N_SOL: | |
264 | /* Mark down an include file in the current psymtab */ | |
265 | ||
266 | SET_NAMESTRING(); | |
267 | ||
268 | /* In C++, one may expect the same filename to come round many | |
269 | times, when code is coming alternately from the main file | |
270 | and from inline functions in other files. So I check to see | |
271 | if this is a file we've seen before -- either the main | |
272 | source file, or a previously included file. | |
273 | ||
274 | This seems to be a lot of time to be spending on N_SOL, but | |
275 | things like "break c-exp.y:435" need to work (I | |
276 | suppose the psymtab_include_list could be hashed or put | |
277 | in a binary tree, if profiling shows this is a major hog). */ | |
278 | if (pst && !strcmp (namestring, pst->filename)) | |
279 | continue; | |
280 | { | |
281 | register int i; | |
282 | for (i = 0; i < includes_used; i++) | |
283 | if (!strcmp (namestring, psymtab_include_list[i])) | |
284 | { | |
285 | i = -1; | |
286 | break; | |
287 | } | |
288 | if (i == -1) | |
289 | continue; | |
290 | } | |
291 | ||
292 | psymtab_include_list[includes_used++] = namestring; | |
293 | if (includes_used >= includes_allocated) | |
294 | { | |
295 | char **orig = psymtab_include_list; | |
296 | ||
297 | psymtab_include_list = (char **) | |
298 | alloca ((includes_allocated *= 2) * | |
299 | sizeof (char *)); | |
be772100 JG |
300 | memcpy ((PTR)psymtab_include_list, (PTR)orig, |
301 | includes_used * sizeof (char *)); | |
7e258d18 PB |
302 | } |
303 | continue; | |
aab77d5f | 304 | |
7e258d18 PB |
305 | case N_LSYM: /* Typedef or automatic variable. */ |
306 | case N_STSYM: /* Data seg var -- static */ | |
307 | case N_LCSYM: /* BSS " */ | |
308 | case N_NBSTS: /* Gould nobase. */ | |
309 | case N_NBLCS: /* symbols. */ | |
310 | ||
311 | SET_NAMESTRING(); | |
312 | ||
313 | p = (char *) strchr (namestring, ':'); | |
314 | ||
315 | /* Skip if there is no :. */ | |
316 | if (!p) continue; | |
317 | ||
318 | switch (p[1]) | |
319 | { | |
320 | case 'T': | |
bcbf9559 | 321 | if (p != namestring) /* a name is there, not just :T... */ |
7e258d18 | 322 | { |
7e258d18 | 323 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, |
bcbf9559 | 324 | STRUCT_NAMESPACE, LOC_TYPEDEF, |
1ab3bf1b | 325 | objfile->static_psymbols, CUR_SYMBOL_VALUE); |
bcbf9559 JG |
326 | if (p[2] == 't') |
327 | { | |
328 | /* Also a typedef with the same name. */ | |
329 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, | |
330 | VAR_NAMESPACE, LOC_TYPEDEF, | |
331 | objfile->static_psymbols, CUR_SYMBOL_VALUE); | |
332 | p += 1; | |
333 | } | |
7e258d18 PB |
334 | } |
335 | goto check_enum; | |
336 | case 't': | |
bcbf9559 JG |
337 | if (p != namestring) /* a name is there, not just :T... */ |
338 | { | |
339 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, | |
340 | VAR_NAMESPACE, LOC_TYPEDEF, | |
341 | objfile->static_psymbols, CUR_SYMBOL_VALUE); | |
342 | } | |
7e258d18 | 343 | check_enum: |
7e258d18 PB |
344 | /* If this is an enumerated type, we need to |
345 | add all the enum constants to the partial symbol | |
346 | table. This does not cover enums without names, e.g. | |
347 | "enum {a, b} c;" in C, but fortunately those are | |
348 | rare. There is no way for GDB to find those from the | |
349 | enum type without spending too much time on it. Thus | |
350 | to solve this problem, the compiler needs to put out separate | |
351 | constant symbols ('c' N_LSYMS) for enum constants in | |
352 | enums without names, or put out a dummy type. */ | |
353 | ||
354 | /* We are looking for something of the form | |
355 | <name> ":" ("t" | "T") [<number> "="] "e" | |
356 | {<constant> ":" <value> ","} ";". */ | |
357 | ||
358 | /* Skip over the colon and the 't' or 'T'. */ | |
359 | p += 2; | |
360 | /* This type may be given a number. Also, numbers can come | |
361 | in pairs like (0,26). Skip over it. */ | |
362 | while ((*p >= '0' && *p <= '9') | |
363 | || *p == '(' || *p == ',' || *p == ')' | |
364 | || *p == '=') | |
365 | p++; | |
366 | ||
367 | if (*p++ == 'e') | |
368 | { | |
369 | /* We have found an enumerated type. */ | |
370 | /* According to comments in read_enum_type | |
371 | a comma could end it instead of a semicolon. | |
372 | I don't know where that happens. | |
373 | Accept either. */ | |
374 | while (*p && *p != ';' && *p != ',') | |
375 | { | |
376 | char *q; | |
377 | ||
378 | /* Check for and handle cretinous dbx symbol name | |
379 | continuation! */ | |
380 | if (*p == '\\') | |
381 | p = next_symbol_text (); | |
382 | ||
383 | /* Point to the character after the name | |
384 | of the enum constant. */ | |
385 | for (q = p; *q && *q != ':'; q++) | |
386 | ; | |
387 | /* Note that the value doesn't matter for | |
388 | enum constants in psymtabs, just in symtabs. */ | |
389 | ADD_PSYMBOL_TO_LIST (p, q - p, | |
390 | VAR_NAMESPACE, LOC_CONST, | |
1ab3bf1b | 391 | objfile->static_psymbols, 0); |
7e258d18 PB |
392 | /* Point past the name. */ |
393 | p = q; | |
394 | /* Skip over the value. */ | |
395 | while (*p && *p != ',') | |
396 | p++; | |
397 | /* Advance past the comma. */ | |
398 | if (*p) | |
399 | p++; | |
400 | } | |
401 | } | |
7e258d18 PB |
402 | continue; |
403 | case 'c': | |
404 | /* Constant, e.g. from "const" in Pascal. */ | |
405 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, | |
406 | VAR_NAMESPACE, LOC_CONST, | |
1ab3bf1b | 407 | objfile->static_psymbols, CUR_SYMBOL_VALUE); |
7e258d18 PB |
408 | continue; |
409 | default: | |
410 | /* Skip if the thing following the : is | |
411 | not a letter (which indicates declaration of a local | |
412 | variable, which we aren't interested in). */ | |
413 | continue; | |
414 | } | |
415 | ||
416 | case N_FUN: | |
417 | case N_GSYM: /* Global (extern) variable; can be | |
418 | data or bss (sigh). */ | |
419 | ||
420 | /* Following may probably be ignored; I'll leave them here | |
421 | for now (until I do Pascal and Modula 2 extensions). */ | |
422 | ||
423 | case N_PC: /* I may or may not need this; I | |
424 | suspect not. */ | |
425 | case N_M2C: /* I suspect that I can ignore this here. */ | |
426 | case N_SCOPE: /* Same. */ | |
427 | ||
428 | SET_NAMESTRING(); | |
429 | ||
430 | p = (char *) strchr (namestring, ':'); | |
431 | if (!p) | |
432 | continue; /* Not a debugging symbol. */ | |
433 | ||
434 | ||
435 | ||
436 | /* Main processing section for debugging symbols which | |
437 | the initial read through the symbol tables needs to worry | |
438 | about. If we reach this point, the symbol which we are | |
439 | considering is definitely one we are interested in. | |
440 | p must also contain the (valid) index into the namestring | |
441 | which indicates the debugging type symbol. */ | |
442 | ||
443 | switch (p[1]) | |
444 | { | |
445 | case 'c': | |
446 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, | |
447 | VAR_NAMESPACE, LOC_CONST, | |
1ab3bf1b | 448 | objfile->static_psymbols, CUR_SYMBOL_VALUE); |
7e258d18 PB |
449 | continue; |
450 | case 'S': | |
451 | CUR_SYMBOL_VALUE += addr; /* Relocate */ | |
452 | ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring, | |
453 | VAR_NAMESPACE, LOC_STATIC, | |
1ab3bf1b | 454 | objfile->static_psymbols, CUR_SYMBOL_VALUE); |
7e258d18 PB |
455 | continue; |
456 | case 'G': | |
457 | CUR_SYMBOL_VALUE += addr; /* Relocate */ | |
458 | /* The addresses in these entries are reported to be | |
459 | wrong. See the code that reads 'G's for symtabs. */ | |
460 | ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring, | |
461 | VAR_NAMESPACE, LOC_STATIC, | |
1ab3bf1b | 462 | objfile->global_psymbols, CUR_SYMBOL_VALUE); |
7e258d18 PB |
463 | continue; |
464 | ||
465 | case 't': | |
466 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, | |
467 | VAR_NAMESPACE, LOC_TYPEDEF, | |
1ab3bf1b | 468 | objfile->static_psymbols, CUR_SYMBOL_VALUE); |
7e258d18 PB |
469 | continue; |
470 | ||
471 | case 'f': | |
9342ecb9 JG |
472 | #ifdef DBXREAD_ONLY |
473 | /* Kludges for ELF/STABS with Sun ACC */ | |
474 | last_function_name = namestring; | |
475 | if (pst->textlow == 0) | |
476 | pst->textlow = CUR_SYMBOL_VALUE; | |
477 | #if 0 | |
478 | if (startup_file_end == 0) | |
479 | startup_file_end = CUR_SYMBOL_VALUE; | |
480 | #endif | |
481 | /* End kludge. */ | |
482 | #endif /* DBXREAD_ONLY */ | |
7e258d18 PB |
483 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, |
484 | VAR_NAMESPACE, LOC_BLOCK, | |
1ab3bf1b | 485 | objfile->static_psymbols, CUR_SYMBOL_VALUE); |
7e258d18 PB |
486 | continue; |
487 | ||
488 | /* Global functions were ignored here, but now they | |
489 | are put into the global psymtab like one would expect. | |
490 | They're also in the misc fn vector... | |
491 | FIXME, why did it used to ignore these? That broke | |
492 | "i fun" on these functions. */ | |
493 | case 'F': | |
9342ecb9 JG |
494 | #ifdef DBXREAD_ONLY |
495 | /* Kludges for ELF/STABS with Sun ACC */ | |
496 | last_function_name = namestring; | |
497 | if (pst->textlow == 0) | |
498 | pst->textlow = CUR_SYMBOL_VALUE; | |
499 | #if 0 | |
500 | if (startup_file_end == 0) | |
501 | startup_file_end = CUR_SYMBOL_VALUE; | |
502 | #endif | |
503 | /* End kludge. */ | |
504 | #endif /* DBXREAD_ONLY */ | |
7e258d18 PB |
505 | ADD_PSYMBOL_TO_LIST (namestring, p - namestring, |
506 | VAR_NAMESPACE, LOC_BLOCK, | |
1ab3bf1b | 507 | objfile->global_psymbols, CUR_SYMBOL_VALUE); |
7e258d18 PB |
508 | continue; |
509 | ||
510 | /* Two things show up here (hopefully); static symbols of | |
511 | local scope (static used inside braces) or extensions | |
512 | of structure symbols. We can ignore both. */ | |
513 | case 'V': | |
514 | case '(': | |
515 | case '0': | |
516 | case '1': | |
517 | case '2': | |
518 | case '3': | |
519 | case '4': | |
520 | case '5': | |
521 | case '6': | |
522 | case '7': | |
523 | case '8': | |
524 | case '9': | |
525 | continue; | |
526 | ||
527 | default: | |
528 | /* Unexpected symbol. Ignore it; perhaps it is an extension | |
529 | that we don't know about. | |
530 | ||
531 | Someone says sun cc puts out symbols like | |
532 | /foo/baz/maclib::/usr/local/bin/maclib, | |
533 | which would get here with a symbol type of ':'. */ | |
534 | continue; | |
535 | } | |
536 | ||
7e258d18 | 537 | case N_EXCL: |
aab77d5f | 538 | #ifdef DBXREAD_ONLY |
7e258d18 PB |
539 | |
540 | SET_NAMESTRING(); | |
541 | ||
542 | /* Find the corresponding bincl and mark that psymtab on the | |
543 | psymtab dependency list */ | |
544 | { | |
545 | struct partial_symtab *needed_pst = | |
546 | find_corresponding_bincl_psymtab (namestring, CUR_SYMBOL_VALUE); | |
547 | ||
548 | /* If this include file was defined earlier in this file, | |
549 | leave it alone. */ | |
550 | if (needed_pst == pst) continue; | |
551 | ||
552 | if (needed_pst) | |
553 | { | |
554 | int i; | |
555 | int found = 0; | |
556 | ||
557 | for (i = 0; i < dependencies_used; i++) | |
558 | if (dependency_list[i] == needed_pst) | |
559 | { | |
560 | found = 1; | |
561 | break; | |
562 | } | |
563 | ||
564 | /* If it's already in the list, skip the rest. */ | |
565 | if (found) continue; | |
566 | ||
567 | dependency_list[dependencies_used++] = needed_pst; | |
568 | if (dependencies_used >= dependencies_allocated) | |
569 | { | |
570 | struct partial_symtab **orig = dependency_list; | |
571 | dependency_list = | |
572 | (struct partial_symtab **) | |
573 | alloca ((dependencies_allocated *= 2) | |
574 | * sizeof (struct partial_symtab *)); | |
be772100 | 575 | memcpy ((PTR)dependency_list, (PTR)orig, |
7e258d18 PB |
576 | (dependencies_used |
577 | * sizeof (struct partial_symtab *))); | |
578 | #ifdef DEBUG_INFO | |
579 | fprintf (stderr, "Had to reallocate dependency list.\n"); | |
580 | fprintf (stderr, "New dependencies allocated: %d\n", | |
581 | dependencies_allocated); | |
582 | #endif | |
583 | } | |
584 | } | |
585 | else | |
586 | error ("Invalid symbol data: \"repeated\" header file not previously seen, at symtab pos %d.", | |
587 | symnum); | |
588 | } | |
aab77d5f | 589 | #endif /* DBXREAD_ONLY */ |
7e258d18 | 590 | continue; |
7e258d18 PB |
591 | |
592 | case N_RBRAC: | |
593 | #ifdef HANDLE_RBRAC | |
594 | HANDLE_RBRAC(CUR_SYMBOL_VALUE); | |
aab77d5f | 595 | continue; |
7e258d18 PB |
596 | #endif |
597 | case N_EINCL: | |
598 | case N_DSLINE: | |
599 | case N_BSLINE: | |
600 | case N_SSYM: /* Claim: Structure or union element. | |
601 | Hopefully, I can ignore this. */ | |
602 | case N_ENTRY: /* Alternate entry point; can ignore. */ | |
603 | case N_MAIN: /* Can definitely ignore this. */ | |
604 | case N_CATCH: /* These are GNU C++ extensions */ | |
605 | case N_EHDECL: /* that can safely be ignored here. */ | |
606 | case N_LENG: | |
607 | case N_BCOMM: | |
608 | case N_ECOMM: | |
609 | case N_ECOML: | |
610 | case N_FNAME: | |
611 | case N_SLINE: | |
612 | case N_RSYM: | |
613 | case N_PSYM: | |
614 | case N_LBRAC: | |
615 | case N_NSYMS: /* Ultrix 4.0: symbol count */ | |
616 | case N_DEFD: /* GNU Modula-2 */ | |
9342ecb9 JG |
617 | |
618 | case N_OBJ: /* two useless types from Solaris */ | |
619 | case N_OPT: | |
7e258d18 PB |
620 | /* These symbols aren't interesting; don't worry about them */ |
621 | ||
622 | continue; | |
623 | ||
624 | default: | |
7e258d18 PB |
625 | /* If we haven't found it yet, ignore it. It's probably some |
626 | new type we don't know about yet. */ | |
627 | complain (&unknown_symtype_complaint, local_hex_string(CUR_SYMBOL_TYPE)); | |
7e258d18 PB |
628 | continue; |
629 | } |