ubsan: xgate: left shift of negative value
[deliverable/binutils-gdb.git] / gdb / mdebugread.c
index 454929381d92742efd3d56f65e98371ad0e578e4..ff1d13032210447d0e6a80521cca11e2d6cc90c4 100644 (file)
@@ -1,6 +1,6 @@
 /* Read a symbol table in ECOFF format (Third-Eye).
 
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
 
    Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
    CMU.  Major work by Per Bothner, John Gilmore and Ian Lance Taylor
@@ -541,7 +541,7 @@ mdebug_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch)
   if (regno < 0 || regno >= gdbarch_num_cooked_regs (gdbarch))
     {
       reg_value_complaint (regno, gdbarch_num_cooked_regs (gdbarch),
-                          SYMBOL_PRINT_NAME (sym));
+                          sym->print_name ());
 
       regno = gdbarch_sp_regnum (gdbarch); /* Known safe, though useless.  */
     }
@@ -580,7 +580,7 @@ add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
 
 static int
 parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
-             struct section_offsets *section_offsets, struct objfile *objfile)
+             const section_offsets &section_offsets, struct objfile *objfile)
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
@@ -610,18 +610,18 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
          The value of a stBlock symbol is the displacement from the
          procedure address.  */
       if (sh->st != stEnd && sh->st != stBlock)
-       sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
+       sh->value += section_offsets[SECT_OFF_TEXT (objfile)];
       break;
     case scData:
     case scSData:
     case scRData:
     case scPData:
     case scXData:
-      sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
+      sh->value += section_offsets[SECT_OFF_DATA (objfile)];
       break;
     case scBss:
     case scSBss:
-      sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
+      sh->value += section_offsets[SECT_OFF_BSS (objfile)];
       break;
     }
 
@@ -646,7 +646,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
          /* It is a FORTRAN common block.  At least for SGI Fortran the
             address is not in the symbol; we need to fix it later in
             scan_file_globals.  */
-         int bucket = hashname (SYMBOL_LINKAGE_NAME (s));
+         int bucket = hashname (s->linkage_name ());
          SYMBOL_VALUE_CHAIN (s) = global_sym_chain[bucket];
          global_sym_chain[bucket] = s;
        }
@@ -794,11 +794,11 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
 
       /* All functions in C++ have prototypes.  For C we don't have enough
          information in the debug info.  */
-      if (SYMBOL_LANGUAGE (s) == language_cplus)
+      if (s->language () == language_cplus)
        TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
 
       /* Create and enter a new lexical context.  */
-      b = new_block (FUNCTION_BLOCK, SYMBOL_LANGUAGE (s));
+      b = new_block (FUNCTION_BLOCK, s->language ());
       SYMBOL_BLOCK_VALUE (s) = b;
       BLOCK_FUNCTION (b) = s;
       BLOCK_START (b) = BLOCK_END (b) = sh->value;
@@ -1066,9 +1066,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                FIELD_BITSIZE (*f) = 0;
 
                enum_sym = allocate_symbol (mdebugread_objfile);
-               SYMBOL_SET_LINKAGE_NAME
-                 (enum_sym,
-                  obstack_strdup (&mdebugread_objfile->objfile_obstack,
+               enum_sym->set_linkage_name
+                 (obstack_strdup (&mdebugread_objfile->objfile_obstack,
                                   f->name));
                SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST;
                SYMBOL_TYPE (enum_sym) = t;
@@ -1334,7 +1333,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                 for anything except pointers or functions.  */
            }
          else
-           TYPE_NAME (SYMBOL_TYPE (s)) = SYMBOL_LINKAGE_NAME (s);
+           TYPE_NAME (SYMBOL_TYPE (s)) = s->linkage_name ();
        }
       break;
 
@@ -2024,8 +2023,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
       /* GDB expects the absolute function start address for the
          procedure descriptor in e->pdr.adr.
          As the address in the procedure descriptor is usually relative,
-         we would have to relocate e->pdr.adr with cur_fdr->adr and
-         ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
+         we would have to relocate e->pdr.adr with cur_fdr->adr.
          Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
          in shared libraries on some systems, and on other systems
          e->pdr.adr is sometimes offset by a bogus value.
@@ -2061,11 +2059,8 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
 
    This routine clobbers top_stack->cur_block and ->cur_st.  */
 
-static void parse_external (EXTR *, int, struct section_offsets *,
-                           struct objfile *);
-
 static void
-parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
+parse_external (EXTR *es, int bigend, const section_offsets &section_offsets,
                struct objfile *objfile)
 {
   union aux_ext *ax;
@@ -3863,7 +3858,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
   struct linetable *lines;
   CORE_ADDR lowest_pdr_addr = 0;
   int last_symtab_ended = 0;
-  struct section_offsets *section_offsets = objfile->section_offsets;
+  const section_offsets &section_offsets = objfile->section_offsets;
 
   if (pst->readin)
     return;
@@ -3981,8 +3976,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
                      && previous_stab_code != (unsigned char) N_SO
                      && *name == '\000')
                    {
-                     valu += ANOFFSET (section_offsets,
-                                       SECT_OFF_TEXT (objfile));
+                     valu += section_offsets[SECT_OFF_TEXT (objfile)];
                      previous_stab_code = N_SO;
                      cust = end_symtab (valu, SECT_OFF_TEXT (objfile));
                      end_stabs ();
@@ -4029,8 +4023,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
              else
                {
                  /* Handle encoded stab line number.  */
-                 valu += ANOFFSET (section_offsets,
-                                   SECT_OFF_TEXT (objfile));
+                 valu += section_offsets[SECT_OFF_TEXT (objfile)];
                  record_line (get_current_subfile (), sh.index,
                               gdbarch_addr_bits_remove (gdbarch, valu));
                }
@@ -4489,10 +4482,10 @@ mylookup_symbol (const char *name, const struct block *block,
   inc = name[0];
   ALL_BLOCK_SYMBOLS (block, iter, sym)
     {
-      if (SYMBOL_LINKAGE_NAME (sym)[0] == inc
+      if (sym->linkage_name ()[0] == inc
          && SYMBOL_DOMAIN (sym) == domain
          && SYMBOL_CLASS (sym) == theclass
-         && strcmp (SYMBOL_LINKAGE_NAME (sym), name) == 0)
+         && strcmp (sym->linkage_name (), name) == 0)
        return sym;
     }
 
@@ -4762,9 +4755,8 @@ new_symbol (const char *name)
 {
   struct symbol *s = allocate_symbol (mdebugread_objfile);
 
-  SYMBOL_SET_LANGUAGE (s, psymtab_language,
-                      &mdebugread_objfile->objfile_obstack);
-  SYMBOL_SET_NAMES (s, name, true, mdebugread_objfile);
+  s->set_language (psymtab_language, &mdebugread_objfile->objfile_obstack);
+  s->compute_and_set_names (name, true, mdebugread_objfile->per_bfd);
   return s;
 }
 
This page took 0.027624 seconds and 4 git commands to generate.