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