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