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