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