Obsolete stuff.c and kdb-start.c.
[deliverable/binutils-gdb.git] / gdb / partial-stab.h
CommitLineData
c906108c 1/* Shared code to pre-read a stab (dbx-style), when building a psymtab.
b6ba6518
KB
2 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
3 1996, 1997, 1998, 1999, 2000, 2001
c906108c
SS
4 Free Software Foundation, Inc.
5
c5aa993b 6 This file is part of GDB.
c906108c 7
c5aa993b
JM
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.
c906108c 12
c5aa993b
JM
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.
c906108c 17
c5aa993b
JM
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. */
c906108c
SS
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.
c906108c
SS
28 pst - the partial symbol table being built.
29
30 psymtab_include_list, includes_used, includes_allocated - list of include
c5aa993b 31 file names (N_SOL) seen so far.
c906108c 32 dependency_list, dependencies_used, dependencies_allocated - list of
c5aa993b 33 N_EXCL stabs seen so far.
c906108c
SS
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
c5aa993b
JM
41switch (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:
b8fbeb18 50 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
c5aa993b
JM
51 goto record_it;
52
53 case N_DATA | N_EXT:
54 case N_NBDATA | N_EXT:
b8fbeb18 55 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
c5aa993b
JM
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? */
b8fbeb18 62 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
c5aa993b
JM
63 goto record_it;
64
65 case N_ABS | N_EXT:
66 record_it:
c906108c 67#ifdef DBXREAD_ONLY
c5aa993b 68 SET_NAMESTRING ();
c906108c 69
c5aa993b
JM
70 bss_ext_symbol:
71 record_minimal_symbol (namestring, CUR_SYMBOL_VALUE,
72 CUR_SYMBOL_TYPE, objfile); /* Always */
c906108c 73#endif /* DBXREAD_ONLY */
c5aa993b 74 continue;
c906108c 75
c5aa993b 76 /* Standard, local, non-debugger, symbols */
c906108c 77
c5aa993b 78 case N_NBTEXT:
c906108c 79
c5aa993b
JM
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. */
c906108c 84
c5aa993b
JM
85 case N_FN:
86 case N_FN_SEQ:
87 case N_TEXT:
c906108c 88#ifdef DBXREAD_ONLY
b8fbeb18 89 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
c5aa993b
JM
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;
c906108c 121#endif /* DBXREAD_ONLY */
c5aa993b 122 continue;
c906108c 123
c5aa993b 124 case N_DATA:
b8fbeb18 125 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
c5aa993b 126 goto record_it;
c906108c 127
c5aa993b 128 case N_UNDF | N_EXT:
c906108c 129#ifdef DBXREAD_ONLY
c5aa993b
JM
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. */
c906108c 134
c5aa993b 135 CORE_ADDR reladdr;
c906108c 136
c5aa993b
JM
137 SET_NAMESTRING ();
138 if (target_lookup_symbol (namestring, &reladdr))
139 {
140 continue; /* Error in lookup; ignore symbol for now. */
c906108c 141 }
c5aa993b
JM
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 }
c906108c 146#endif /* DBXREAD_ONLY */
c5aa993b 147 continue; /* Just undefined, not COMMON */
c906108c 148
c5aa993b 149 case N_UNDF:
c906108c 150#ifdef DBXREAD_ONLY
c5aa993b
JM
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 }
c906108c 167#endif /* DBXREAD_ONLY */
c5aa993b
JM
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
b8fbeb18 207 valu = CUR_SYMBOL_VALUE + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
c5aa993b
JM
208
209 prev_textlow_not_set = textlow_not_set;
c906108c
SS
210
211#ifdef SOFUN_ADDRESS_MAYBE_MISSING
c5aa993b
JM
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. */
c906108c 215
c5aa993b
JM
216 if (CUR_SYMBOL_VALUE == 0)
217 {
218 textlow_not_set = 1;
219 valu = 0;
220 }
221 else
222 textlow_not_set = 0;
c906108c 223#else
c5aa993b 224 textlow_not_set = 0;
c906108c 225#endif
c5aa993b 226 past_first_source_file = 1;
c906108c 227
c5aa993b
JM
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;
c906108c 242 }
c5aa993b 243 }
c906108c 244
c5aa993b 245 prev_so_symnum = symnum;
c906108c 246
c5aa993b 247 /* End the current partial symtab and start a new one */
c906108c 248
c5aa993b 249 SET_NAMESTRING ();
c906108c 250
c5aa993b
JM
251 /* Null name means end of .o file. Don't start a new one. */
252 if (*namestring == '\000')
253 continue;
c906108c 254
c5aa993b
JM
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. */
c906108c 259
c5aa993b
JM
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)
d4f3574e 269 pst = START_PSYMTAB (objfile,
c5aa993b
JM
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 {
c906108c 279#ifdef DBXREAD_ONLY
c5aa993b
JM
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 */
c906108c 284
c5aa993b 285 SET_NAMESTRING ();
c906108c 286
c5aa993b 287 tmp_language = deduce_language_from_filename (namestring);
c906108c 288
c5aa993b
JM
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;
c906108c 297
c5aa993b
JM
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);
c906108c 306
c5aa993b 307 /* Mark down an include file in the current psymtab */
c906108c 308
c5aa993b 309 goto record_include_file;
c906108c
SS
310
311#else /* DBXREAD_ONLY */
c5aa993b 312 continue;
c906108c 313#endif
c5aa993b
JM
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]))
c906108c 350 {
c5aa993b
JM
351 i = -1;
352 break;
c906108c 353 }
c5aa993b
JM
354 if (i == -1)
355 continue;
356 }
357
c906108c 358#ifdef DBXREAD_ONLY
c5aa993b 359 record_include_file:
c906108c 360#endif
c5aa993b
JM
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
c906108c
SS
383 data or bss (sigh FIXME). */
384
c5aa993b
JM
385 /* Following may probably be ignored; I'll leave them here
386 for now (until I do Pascal and Modula 2 extensions). */
c906108c 387
c5aa993b 388 case N_PC: /* I may or may not need this; I
c906108c 389 suspect not. */
c5aa993b
JM
390 case N_M2C: /* I suspect that I can ignore this here. */
391 case N_SCOPE: /* Same. */
c906108c 392
c5aa993b 393 SET_NAMESTRING ();
c906108c
SS
394
395#ifdef DBXREAD_ONLY
c5aa993b 396 /* See if this is an end of function stab. */
7d88144c 397 if (pst && CUR_SYMBOL_TYPE == N_FUN && *namestring == '\000')
c5aa993b
JM
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;
c5f231f7 405 if (pst->texthigh == 0 || valu > pst->texthigh)
c5aa993b
JM
406 pst->texthigh = valu;
407 break;
408 }
c906108c
SS
409#endif
410
c5aa993b
JM
411 p = (char *) strchr (namestring, ':');
412 if (!p)
413 continue; /* Not a debugging symbol. */
c906108c
SS
414
415
416
c5aa993b
JM
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. */
c906108c 423
c5aa993b
JM
424 switch (p[1])
425 {
426 case 'S':
b8fbeb18 427 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
c906108c 428#ifdef STATIC_TRANSFORM_NAME
c5aa993b 429 namestring = STATIC_TRANSFORM_NAME (namestring);
c906108c 430#endif
c5aa993b
JM
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':
b8fbeb18 438 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
c5aa993b
JM
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. */
c906108c 532 p++;
c5aa993b 533 }
c906108c 534
c5aa993b
JM
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':
b8fbeb18 579 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
c906108c 580#ifdef DBXREAD_ONLY
c5aa993b
JM
581 /* Kludges for ELF/STABS with Sun ACC */
582 last_function_name = namestring;
c906108c 583#ifdef SOFUN_ADDRESS_MAYBE_MISSING
c5aa993b
JM
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 =
c2c6d25f 589 find_stab_function_addr (namestring, pst->filename, objfile);
c5aa993b
JM
590 textlow_not_set = 0;
591 }
c906108c 592#endif
c5aa993b
JM
593 /* End kludge. */
594
c2c6d25f
JM
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
c5aa993b
JM
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 (textlow_not_set
8d1de4b7 604 || (pst && CUR_SYMBOL_VALUE < pst->textlow
c5aa993b 605 && CUR_SYMBOL_VALUE
b8fbeb18 606 != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))))
c5aa993b
JM
607 {
608 pst->textlow = CUR_SYMBOL_VALUE;
609 textlow_not_set = 0;
610 }
c906108c 611#endif /* DBXREAD_ONLY */
c5aa993b
JM
612 add_psymbol_to_list (namestring, p - namestring,
613 VAR_NAMESPACE, LOC_BLOCK,
614 &objfile->static_psymbols,
615 0, CUR_SYMBOL_VALUE,
616 psymtab_language, objfile);
617 continue;
618
619 /* Global functions were ignored here, but now they
620 are put into the global psymtab like one would expect.
621 They're also in the minimal symbol table. */
622 case 'F':
b8fbeb18 623 CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
c906108c 624#ifdef DBXREAD_ONLY
c5aa993b
JM
625 /* Kludges for ELF/STABS with Sun ACC */
626 last_function_name = namestring;
c906108c 627#ifdef SOFUN_ADDRESS_MAYBE_MISSING
c5aa993b
JM
628 /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
629 value for the bottom of the text seg in those cases. */
c2c6d25f 630 if (CUR_SYMBOL_VALUE == ANOFFSET (objfile->section_offsets,
b8fbeb18 631 SECT_OFF_TEXT (objfile)))
c2c6d25f
JM
632 CUR_SYMBOL_VALUE =
633 find_stab_function_addr (namestring, pst->filename, objfile);
c5aa993b
JM
634 if (pst && textlow_not_set)
635 {
c2c6d25f 636 pst->textlow = CUR_SYMBOL_VALUE;
c5aa993b
JM
637 textlow_not_set = 0;
638 }
c906108c 639#endif
c5aa993b 640 /* End kludge. */
c2c6d25f
JM
641
642 /* Keep track of the start of the last function so we
643 can handle end of function symbols. */
644 last_function_start = CUR_SYMBOL_VALUE;
645
c5aa993b
JM
646 /* In reordered executables this function may lie outside
647 the bounds created by N_SO symbols. If that's the case
648 use the address of this function as the low bound for
649 the partial symbol table. */
650 if (textlow_not_set
e84d946b 651 || (pst && CUR_SYMBOL_VALUE < pst->textlow
c5aa993b 652 && CUR_SYMBOL_VALUE
b8fbeb18 653 != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))))
c5aa993b
JM
654 {
655 pst->textlow = CUR_SYMBOL_VALUE;
656 textlow_not_set = 0;
657 }
c906108c 658#endif /* DBXREAD_ONLY */
c5aa993b
JM
659 add_psymbol_to_list (namestring, p - namestring,
660 VAR_NAMESPACE, LOC_BLOCK,
661 &objfile->global_psymbols,
662 0, CUR_SYMBOL_VALUE,
663 psymtab_language, objfile);
664 continue;
665
666 /* Two things show up here (hopefully); static symbols of
667 local scope (static used inside braces) or extensions
668 of structure symbols. We can ignore both. */
669 case 'V':
670 case '(':
671 case '0':
672 case '1':
673 case '2':
674 case '3':
675 case '4':
676 case '5':
677 case '6':
678 case '7':
679 case '8':
680 case '9':
681 case '-':
682 case '#': /* for symbol identification (used in live ranges) */
683 /* added to support cfront stabs strings */
684 case 'Z': /* for definition continuations */
685 case 'P': /* for prototypes */
686 continue;
687
688 case ':':
689 /* It is a C++ nested symbol. We don't need to record it
690 (I don't think); if we try to look up foo::bar::baz,
691 then symbols for the symtab containing foo should get
692 read in, I think. */
693 /* Someone says sun cc puts out symbols like
694 /foo/baz/maclib::/usr/local/bin/maclib,
695 which would get here with a symbol type of ':'. */
696 continue;
697
698 default:
699 /* Unexpected symbol descriptor. The second and subsequent stabs
700 of a continued stab can show up here. The question is
701 whether they ever can mimic a normal stab--it would be
702 nice if not, since we certainly don't want to spend the
703 time searching to the end of every string looking for
704 a backslash. */
705
706 complain (&unknown_symchar_complaint, p[1]);
707
708 /* Ignore it; perhaps it is an extension that we don't
709 know about. */
710 continue;
711 }
712
713 case N_EXCL:
c906108c
SS
714#ifdef DBXREAD_ONLY
715
c5aa993b 716 SET_NAMESTRING ();
c906108c 717
c5aa993b
JM
718 /* Find the corresponding bincl and mark that psymtab on the
719 psymtab dependency list */
720 {
721 struct partial_symtab *needed_pst =
722 find_corresponding_bincl_psymtab (namestring, CUR_SYMBOL_VALUE);
c906108c 723
c5aa993b
JM
724 /* If this include file was defined earlier in this file,
725 leave it alone. */
726 if (needed_pst == pst)
727 continue;
c906108c 728
c5aa993b
JM
729 if (needed_pst)
730 {
731 int i;
732 int found = 0;
733
734 for (i = 0; i < dependencies_used; i++)
735 if (dependency_list[i] == needed_pst)
c906108c 736 {
c5aa993b
JM
737 found = 1;
738 break;
739 }
740
741 /* If it's already in the list, skip the rest. */
742 if (found)
743 continue;
744
745 dependency_list[dependencies_used++] = needed_pst;
746 if (dependencies_used >= dependencies_allocated)
747 {
748 struct partial_symtab **orig = dependency_list;
749 dependency_list =
750 (struct partial_symtab **)
751 alloca ((dependencies_allocated *= 2)
752 * sizeof (struct partial_symtab *));
753 memcpy ((PTR) dependency_list, (PTR) orig,
754 (dependencies_used
755 * sizeof (struct partial_symtab *)));
c906108c 756#ifdef DEBUG_INFO
c5aa993b
JM
757 fprintf_unfiltered (gdb_stderr, "Had to reallocate dependency list.\n");
758 fprintf_unfiltered (gdb_stderr, "New dependencies allocated: %d\n",
759 dependencies_allocated);
c906108c 760#endif
c5aa993b
JM
761 }
762 }
763 }
c906108c 764#endif /* DBXREAD_ONLY */
c5aa993b 765 continue;
c906108c 766
c5aa993b 767 case N_ENDM:
c906108c 768#ifdef SOFUN_ADDRESS_MAYBE_MISSING
c5aa993b
JM
769 /* Solaris 2 end of module, finish current partial symbol table.
770 END_PSYMTAB will set pst->texthigh to the proper value, which
771 is necessary if a module compiled without debugging info
772 follows this module. */
773 if (pst)
774 {
775 END_PSYMTAB (pst, psymtab_include_list, includes_used,
776 symnum * symbol_size,
777 (CORE_ADDR) 0,
778 dependency_list, dependencies_used, textlow_not_set);
779 pst = (struct partial_symtab *) 0;
780 includes_used = 0;
781 dependencies_used = 0;
782 }
c906108c 783#endif
c5aa993b 784 continue;
c906108c 785
c5aa993b 786 case N_RBRAC:
c906108c 787#ifdef HANDLE_RBRAC
c5aa993b
JM
788 HANDLE_RBRAC (CUR_SYMBOL_VALUE);
789 continue;
c906108c 790#endif
c5aa993b
JM
791 case N_EINCL:
792 case N_DSLINE:
793 case N_BSLINE:
794 case N_SSYM: /* Claim: Structure or union element.
c906108c 795 Hopefully, I can ignore this. */
c5aa993b
JM
796 case N_ENTRY: /* Alternate entry point; can ignore. */
797 case N_MAIN: /* Can definitely ignore this. */
798 case N_CATCH: /* These are GNU C++ extensions */
799 case N_EHDECL: /* that can safely be ignored here. */
800 case N_LENG:
801 case N_BCOMM:
802 case N_ECOMM:
803 case N_ECOML:
804 case N_FNAME:
805 case N_SLINE:
806 case N_RSYM:
807 case N_PSYM:
808 case N_LBRAC:
809 case N_NSYMS: /* Ultrix 4.0: symbol count */
810 case N_DEFD: /* GNU Modula-2 */
811 case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
812
813 case N_OBJ: /* useless types from Solaris */
814 case N_OPT:
815 /* These symbols aren't interesting; don't worry about them */
816
817 continue;
818
819 default:
820 /* If we haven't found it yet, ignore it. It's probably some
821 new type we don't know about yet. */
822 complain (&unknown_symtype_complaint,
823 local_hex_string (CUR_SYMBOL_TYPE));
824 continue;
825 }
This page took 0.138998 seconds and 4 git commands to generate.