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