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