OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [partial-stab.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.