import gdb-1999-07-07 post reformat
[external/binutils.git] / gdb / partial-stab.h
1 /* Shared code to pre-read a stab (dbx-style), when building a psymtab.
2    Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
3    Free Software Foundation, Inc.
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., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21
22 /* The following need to be defined:
23    SET_NAMESTRING() --Set namestring to name of symbol.
24    CUR_SYMBOL_TYPE --Type code of current symbol.
25    CUR_SYMBOL_VALUE --Value field of current symbol.  May be adjusted here.
26    namestring - variable pointing to the name of the stab.
27    section_offsets - variable pointing to the section offsets.
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 (section_offsets, SECT_OFF_TEXT);
51     goto record_it;
52
53   case N_DATA | N_EXT:
54   case N_NBDATA | N_EXT:
55     CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_DATA);
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 (section_offsets, SECT_OFF_BSS);
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 (section_offsets, SECT_OFF_TEXT);
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 (section_offsets, SECT_OFF_DATA);
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 (section_offsets, SECT_OFF_TEXT);
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, section_offsets,
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 (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 (section_offsets, SECT_OFF_DATA);
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 (section_offsets, SECT_OFF_DATA);
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 (section_offsets, SECT_OFF_TEXT);
580 #ifdef DBXREAD_ONLY
581         /* Keep track of the start of the last function so we
582            can handle end of function symbols.  */
583         last_function_start = CUR_SYMBOL_VALUE;
584         /* Kludges for ELF/STABS with Sun ACC */
585         last_function_name = namestring;
586 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
587         /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
588            value for the bottom of the text seg in those cases. */
589         if (pst && textlow_not_set)
590           {
591             pst->textlow =
592               find_stab_function_addr (namestring, pst, objfile);
593             textlow_not_set = 0;
594           }
595 #endif
596         /* End kludge.  */
597
598         /* In reordered executables this function may lie outside
599            the bounds created by N_SO symbols.  If that's the case
600            use the address of this function as the low bound for
601            the partial symbol table.  */
602         if (textlow_not_set
603             || (CUR_SYMBOL_VALUE < pst->textlow
604                 && CUR_SYMBOL_VALUE
605                 != ANOFFSET (section_offsets, SECT_OFF_TEXT)))
606           {
607             pst->textlow = CUR_SYMBOL_VALUE;
608             textlow_not_set = 0;
609           }
610 #endif /* DBXREAD_ONLY */
611         add_psymbol_to_list (namestring, p - namestring,
612                              VAR_NAMESPACE, LOC_BLOCK,
613                              &objfile->static_psymbols,
614                              0, CUR_SYMBOL_VALUE,
615                              psymtab_language, objfile);
616         continue;
617
618         /* Global functions were ignored here, but now they
619            are put into the global psymtab like one would expect.
620            They're also in the minimal symbol table.  */
621       case 'F':
622         CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_TEXT);
623 #ifdef DBXREAD_ONLY
624         /* Keep track of the start of the last function so we
625            can handle end of function symbols.  */
626         last_function_start = CUR_SYMBOL_VALUE;
627         /* Kludges for ELF/STABS with Sun ACC */
628         last_function_name = namestring;
629 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
630         /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
631            value for the bottom of the text seg in those cases. */
632         if (pst && textlow_not_set)
633           {
634             pst->textlow =
635               find_stab_function_addr (namestring, pst, objfile);
636             textlow_not_set = 0;
637           }
638 #endif
639         /* End kludge.  */
640         /* In reordered executables this function may lie outside
641            the bounds created by N_SO symbols.  If that's the case
642            use the address of this function as the low bound for
643            the partial symbol table.  */
644         if (textlow_not_set
645             || (CUR_SYMBOL_VALUE < pst->textlow
646                 && CUR_SYMBOL_VALUE
647                 != ANOFFSET (section_offsets, SECT_OFF_TEXT)))
648           {
649             pst->textlow = CUR_SYMBOL_VALUE;
650             textlow_not_set = 0;
651           }
652 #endif /* DBXREAD_ONLY */
653         add_psymbol_to_list (namestring, p - namestring,
654                              VAR_NAMESPACE, LOC_BLOCK,
655                              &objfile->global_psymbols,
656                              0, CUR_SYMBOL_VALUE,
657                              psymtab_language, objfile);
658         continue;
659
660         /* Two things show up here (hopefully); static symbols of
661            local scope (static used inside braces) or extensions
662            of structure symbols.  We can ignore both.  */
663       case 'V':
664       case '(':
665       case '0':
666       case '1':
667       case '2':
668       case '3':
669       case '4':
670       case '5':
671       case '6':
672       case '7':
673       case '8':
674       case '9':
675       case '-':
676       case '#':         /* for symbol identification (used in live ranges) */
677         /* added to support cfront stabs strings */
678       case 'Z':         /* for definition continuations */
679       case 'P':         /* for prototypes */
680         continue;
681
682       case ':':
683         /* It is a C++ nested symbol.  We don't need to record it
684            (I don't think); if we try to look up foo::bar::baz,
685            then symbols for the symtab containing foo should get
686            read in, I think.  */
687         /* Someone says sun cc puts out symbols like
688            /foo/baz/maclib::/usr/local/bin/maclib,
689            which would get here with a symbol type of ':'.  */
690         continue;
691
692       default:
693         /* Unexpected symbol descriptor.  The second and subsequent stabs
694            of a continued stab can show up here.  The question is
695            whether they ever can mimic a normal stab--it would be
696            nice if not, since we certainly don't want to spend the
697            time searching to the end of every string looking for
698            a backslash.  */
699
700         complain (&unknown_symchar_complaint, p[1]);
701
702         /* Ignore it; perhaps it is an extension that we don't
703            know about.  */
704         continue;
705       }
706
707   case N_EXCL:
708 #ifdef DBXREAD_ONLY
709
710     SET_NAMESTRING ();
711
712     /* Find the corresponding bincl and mark that psymtab on the
713        psymtab dependency list */
714     {
715       struct partial_symtab *needed_pst =
716       find_corresponding_bincl_psymtab (namestring, CUR_SYMBOL_VALUE);
717
718       /* If this include file was defined earlier in this file,
719          leave it alone.  */
720       if (needed_pst == pst)
721         continue;
722
723       if (needed_pst)
724         {
725           int i;
726           int found = 0;
727
728           for (i = 0; i < dependencies_used; i++)
729             if (dependency_list[i] == needed_pst)
730               {
731                 found = 1;
732                 break;
733               }
734
735           /* If it's already in the list, skip the rest.  */
736           if (found)
737             continue;
738
739           dependency_list[dependencies_used++] = needed_pst;
740           if (dependencies_used >= dependencies_allocated)
741             {
742               struct partial_symtab **orig = dependency_list;
743               dependency_list =
744                 (struct partial_symtab **)
745                 alloca ((dependencies_allocated *= 2)
746                         * sizeof (struct partial_symtab *));
747               memcpy ((PTR) dependency_list, (PTR) orig,
748                       (dependencies_used
749                        * sizeof (struct partial_symtab *)));
750 #ifdef DEBUG_INFO
751               fprintf_unfiltered (gdb_stderr, "Had to reallocate dependency list.\n");
752               fprintf_unfiltered (gdb_stderr, "New dependencies allocated: %d\n",
753                                   dependencies_allocated);
754 #endif
755             }
756         }
757     }
758 #endif /* DBXREAD_ONLY */
759     continue;
760
761   case N_ENDM:
762 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
763     /* Solaris 2 end of module, finish current partial symbol table.
764        END_PSYMTAB will set pst->texthigh to the proper value, which
765        is necessary if a module compiled without debugging info
766        follows this module.  */
767     if (pst)
768       {
769         END_PSYMTAB (pst, psymtab_include_list, includes_used,
770                      symnum * symbol_size,
771                      (CORE_ADDR) 0,
772                      dependency_list, dependencies_used, textlow_not_set);
773         pst = (struct partial_symtab *) 0;
774         includes_used = 0;
775         dependencies_used = 0;
776       }
777 #endif
778     continue;
779
780   case N_RBRAC:
781 #ifdef HANDLE_RBRAC
782     HANDLE_RBRAC (CUR_SYMBOL_VALUE);
783     continue;
784 #endif
785   case N_EINCL:
786   case N_DSLINE:
787   case N_BSLINE:
788   case N_SSYM:                  /* Claim: Structure or union element.
789                                    Hopefully, I can ignore this.  */
790   case N_ENTRY:         /* Alternate entry point; can ignore. */
791   case N_MAIN:                  /* Can definitely ignore this.   */
792   case N_CATCH:         /* These are GNU C++ extensions */
793   case N_EHDECL:                /* that can safely be ignored here. */
794   case N_LENG:
795   case N_BCOMM:
796   case N_ECOMM:
797   case N_ECOML:
798   case N_FNAME:
799   case N_SLINE:
800   case N_RSYM:
801   case N_PSYM:
802   case N_LBRAC:
803   case N_NSYMS:         /* Ultrix 4.0: symbol count */
804   case N_DEFD:                  /* GNU Modula-2 */
805   case N_ALIAS:         /* SunPro F77: alias name, ignore for now.  */
806
807   case N_OBJ:                   /* useless types from Solaris */
808   case N_OPT:
809     /* These symbols aren't interesting; don't worry about them */
810
811     continue;
812
813   default:
814     /* If we haven't found it yet, ignore it.  It's probably some
815        new type we don't know about yet.  */
816     complain (&unknown_symtype_complaint,
817               local_hex_string (CUR_SYMBOL_TYPE));
818     continue;
819   }