* gdbthread.h (struct thread_info): Add comments around
[deliverable/binutils-gdb.git] / gdb / symtab.c
index 2ab520d515eb1ef041830d18e96e47d7190820ba..1a0dcbad1d278cb6498572ec0f9d0a21d1a51bff 100644 (file)
@@ -651,7 +651,7 @@ symbol_natural_name (const struct general_symbol_info *gsymbol)
 /* Return the demangled name for a symbol based on the language for
    that symbol.  If no demangled name exists, return NULL. */
 char *
-symbol_demangled_name (struct general_symbol_info *gsymbol)
+symbol_demangled_name (const struct general_symbol_info *gsymbol)
 {
   switch (gsymbol->language) 
     {
@@ -705,8 +705,11 @@ init_sal (struct symtab_and_line *sal)
    file and another in a separated debug file.  */
 
 int
-matching_bfd_sections (asection *first, asection *second)
+matching_obj_sections (struct obj_section *obj_first,
+                      struct obj_section *obj_second)
 {
+  asection *first = obj_first? obj_first->the_bfd_section : NULL;
+  asection *second = obj_second? obj_second->the_bfd_section : NULL;
   struct objfile *obj;
 
   /* If they're the same section, then they match.  */
@@ -766,7 +769,7 @@ matching_bfd_sections (asection *first, asection *second)
    We may find a different psymtab than PST.  See FIND_PC_SECT_PSYMTAB.  */
 
 struct partial_symtab *
-find_pc_sect_psymtab_closer (CORE_ADDR pc, asection *section,
+find_pc_sect_psymtab_closer (CORE_ADDR pc, struct obj_section *section,
                             struct partial_symtab *pst,
                             struct minimal_symbol *msymbol)
 {
@@ -844,7 +847,7 @@ find_pc_sect_psymtab_closer (CORE_ADDR pc, asection *section,
    exactly matches PC, or, if we cannot find an exact match, the
    psymtab that contains a symbol whose address is closest to PC.  */
 struct partial_symtab *
-find_pc_sect_psymtab (CORE_ADDR pc, asection *section)
+find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section)
 {
   struct objfile *objfile;
   struct minimal_symbol *msymbol;
@@ -941,7 +944,7 @@ find_pc_psymtab (CORE_ADDR pc)
 
 struct partial_symbol *
 find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
-                     asection *section)
+                     struct obj_section *section)
 {
   struct partial_symbol *best = NULL, *p, **pp;
   CORE_ADDR best_pc;
@@ -973,7 +976,7 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
          if (section)          /* match on a specific section */
            {
              fixup_psymbol_section (p, psymtab->objfile);
-             if (!matching_bfd_sections (SYMBOL_BFD_SECTION (p), section))
+             if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
                continue;
            }
          best_pc = SYMBOL_VALUE_ADDRESS (p);
@@ -997,7 +1000,7 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
          if (section)          /* match on a specific section */
            {
              fixup_psymbol_section (p, psymtab->objfile);
-             if (!matching_bfd_sections (SYMBOL_BFD_SECTION (p), section))
+             if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
                continue;
            }
          best_pc = SYMBOL_VALUE_ADDRESS (p);
@@ -1034,7 +1037,7 @@ fixup_section (struct general_symbol_info *ginfo,
   msym = lookup_minimal_symbol_by_pc_name (addr, ginfo->name, objfile);
   if (msym)
     {
-      ginfo->bfd_section = SYMBOL_BFD_SECTION (msym);
+      ginfo->obj_section = SYMBOL_OBJ_SECTION (msym);
       ginfo->section = SYMBOL_SECTION (msym);
     }
   else
@@ -1081,9 +1084,10 @@ fixup_section (struct general_symbol_info *ginfo,
          int idx = s->the_bfd_section->index;
          CORE_ADDR offset = ANOFFSET (objfile->section_offsets, idx);
 
-         if (s->addr - offset <= addr && addr < s->endaddr - offset)
+         if (obj_section_addr (s) - offset <= addr
+             && addr < obj_section_endaddr (s) - offset)
            {
-             ginfo->bfd_section = s->the_bfd_section;
+             ginfo->obj_section = s;
              ginfo->section = idx;
              return;
            }
@@ -1099,7 +1103,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
   if (!sym)
     return NULL;
 
-  if (SYMBOL_BFD_SECTION (sym))
+  if (SYMBOL_OBJ_SECTION (sym))
     return sym;
 
   /* We either have an OBJFILE, or we can get at it from the sym's
@@ -1141,7 +1145,7 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
   if (!psym)
     return NULL;
 
-  if (SYMBOL_BFD_SECTION (psym))
+  if (SYMBOL_OBJ_SECTION (psym))
     return psym;
 
   gdb_assert (objfile);
@@ -1969,7 +1973,7 @@ lookup_block_symbol (const struct block *block, const char *name,
    psymtabs and read in another symtab if necessary. */
 
 struct symtab *
-find_pc_sect_symtab (CORE_ADDR pc, asection *section)
+find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
 {
   struct block *b;
   struct blockvector *bv;
@@ -2039,7 +2043,7 @@ find_pc_sect_symtab (CORE_ADDR pc, asection *section)
            ALL_BLOCK_SYMBOLS (b, iter, sym)
              {
                fixup_symbol_section (sym, objfile);
-               if (matching_bfd_sections (SYMBOL_BFD_SECTION (sym), section))
+               if (matching_obj_sections (SYMBOL_OBJ_SECTION (sym), section))
                  break;
              }
            if (sym == NULL)
@@ -2097,7 +2101,7 @@ find_pc_symtab (CORE_ADDR pc)
 /* If it's worth the effort, we could be using a binary search.  */
 
 struct symtab_and_line
-find_pc_sect_line (CORE_ADDR pc, struct bfd_section *section, int notcurrent)
+find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 {
   struct symtab *s;
   struct linetable *l;
@@ -2334,7 +2338,7 @@ find_pc_sect_line (CORE_ADDR pc, struct bfd_section *section, int notcurrent)
 struct symtab_and_line
 find_pc_line (CORE_ADDR pc, int notcurrent)
 {
-  asection *section;
+  struct obj_section *section;
 
   section = find_pc_overlay (pc);
   if (pc_in_unmapped_range (pc, section))
@@ -2566,7 +2570,7 @@ find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
    address after the function prologue.  */
 CORE_ADDR
 find_function_start_pc (struct gdbarch *gdbarch,
-                       CORE_ADDR pc, asection *section)
+                       CORE_ADDR pc, struct obj_section *section)
 {
   /* If the function is in an unmapped overlay, use its unmapped LMA address,
      so that gdbarch_skip_prologue has something unique to work on.  */
@@ -2602,9 +2606,9 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
   if (funfirstline)
     {
       /* Skip "first line" of function (which is actually its prologue).  */
-      pc = find_function_start_pc (gdbarch, pc, SYMBOL_BFD_SECTION (sym));
+      pc = find_function_start_pc (gdbarch, pc, SYMBOL_OBJ_SECTION (sym));
     }
-  sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
+  sal = find_pc_sect_line (pc, SYMBOL_OBJ_SECTION (sym), 0);
 
   /* Check if gdbarch_skip_prologue left us in mid-line, and the next
      line is still part of the same function.  */
@@ -2615,7 +2619,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
       /* First pc of next line */
       pc = sal.end;
       /* Recalculate the line number (might not be N+1).  */
-      sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
+      sal = find_pc_sect_line (pc, SYMBOL_OBJ_SECTION (sym), 0);
     }
 
   /* On targets with executable formats that don't have a concept of
@@ -2629,7 +2633,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
     {
       pc = gdbarch_skip_main_prologue (current_gdbarch, pc);
       /* Recalculate the line number (might not be N+1).  */
-      sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
+      sal = find_pc_sect_line (pc, SYMBOL_OBJ_SECTION (sym), 0);
     }
 
   sal.pc = pc;
This page took 0.02826 seconds and 4 git commands to generate.