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