aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c106
1 files changed, 40 insertions, 66 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 0e47f50..98cb637 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -58,7 +58,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
-#include <ctype.h>
#include <chrono>
#include <algorithm>
@@ -835,9 +834,9 @@ init_entry_point_info (struct objfile *objfile)
= gdbarch_addr_bits_remove (objfile->arch (), entry_point);
found = 0;
- for (obj_section *osect : objfile->sections ())
+ for (obj_section &osect : objfile->sections ())
{
- struct bfd_section *sect = osect->the_bfd_section;
+ struct bfd_section *sect = osect.the_bfd_section;
if (entry_point >= bfd_section_vma (sect)
&& entry_point < (bfd_section_vma (sect)
@@ -2748,7 +2747,7 @@ set_ext_lang_command (const char *args,
error (_("'%s': Filename extension must begin with '.'"), ext_args.c_str ());
/* Find end of first arg. */
- while (*end != '\0' && !isspace (*end))
+ while (*end != '\0' && !c_isspace (*end))
end++;
if (*end == '\0')
@@ -3007,9 +3006,9 @@ static void
overlay_invalidate_all (program_space *pspace)
{
for (objfile *objfile : pspace->objfiles ())
- for (obj_section *sect : objfile->sections ())
- if (section_is_overlay (sect))
- sect->ovly_mapped = -1;
+ for (obj_section &sect : objfile->sections ())
+ if (section_is_overlay (&sect))
+ sect.ovly_mapped = -1;
}
/* Function: section_is_mapped (SECTION)
@@ -3183,18 +3182,18 @@ find_pc_overlay (CORE_ADDR pc)
if (overlay_debugging)
{
for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *osect : objfile->sections ())
- if (section_is_overlay (osect))
+ for (obj_section &osect : objfile->sections ())
+ if (section_is_overlay (&osect))
{
- if (pc_in_mapped_range (pc, osect))
+ if (pc_in_mapped_range (pc, &osect))
{
- if (section_is_mapped (osect))
- return osect;
+ if (section_is_mapped (&osect))
+ return &osect;
else
- best_match = osect;
+ best_match = &osect;
}
- else if (pc_in_unmapped_range (pc, osect))
- best_match = osect;
+ else if (pc_in_unmapped_range (pc, &osect))
+ best_match = &osect;
}
}
return best_match;
@@ -3210,9 +3209,9 @@ find_pc_mapped_section (CORE_ADDR pc)
if (overlay_debugging)
{
for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *osect : objfile->sections ())
- if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect))
- return osect;
+ for (obj_section &osect : objfile->sections ())
+ if (pc_in_mapped_range (pc, &osect) && section_is_mapped (&osect))
+ return &osect;
}
return NULL;
@@ -3229,18 +3228,18 @@ list_overlays_command (const char *args, int from_tty)
if (overlay_debugging)
{
for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *osect : objfile->sections ())
- if (section_is_mapped (osect))
+ for (obj_section &osect : objfile->sections ())
+ if (section_is_mapped (&osect))
{
struct gdbarch *gdbarch = objfile->arch ();
const char *name;
bfd_vma lma, vma;
int size;
- vma = bfd_section_vma (osect->the_bfd_section);
- lma = bfd_section_lma (osect->the_bfd_section);
- size = bfd_section_size (osect->the_bfd_section);
- name = bfd_section_name (osect->the_bfd_section);
+ vma = bfd_section_vma (osect.the_bfd_section);
+ lma = bfd_section_lma (osect.the_bfd_section);
+ size = bfd_section_size (osect.the_bfd_section);
+ name = bfd_section_name (osect.the_bfd_section);
gdb_printf ("Section %s, loaded at ", name);
gdb_puts (paddress (gdbarch, lma));
@@ -3275,27 +3274,27 @@ map_overlay_command (const char *args, int from_tty)
/* First, find a section matching the user supplied argument. */
for (objfile *obj_file : current_program_space->objfiles ())
- for (obj_section *sec : obj_file->sections ())
- if (!strcmp (bfd_section_name (sec->the_bfd_section), args))
+ for (obj_section &sec : obj_file->sections ())
+ if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
- if (!section_is_overlay (sec))
+ if (!section_is_overlay (&sec))
continue; /* not an overlay section */
/* Mark the overlay as "mapped". */
- sec->ovly_mapped = 1;
+ sec.ovly_mapped = 1;
/* Next, make a pass and unmap any sections that are
overlapped by this new section: */
for (objfile *objfile2 : current_program_space->objfiles ())
- for (obj_section *sec2 : objfile2->sections ())
- if (sec2->ovly_mapped && sec != sec2 && sections_overlap (sec,
- sec2))
+ for (obj_section &sec2 : objfile2->sections ())
+ if (sec2.ovly_mapped && &sec != &sec2 && sections_overlap (&sec,
+ &sec2))
{
if (info_verbose)
gdb_printf (_("Note: section %s unmapped by overlap\n"),
- bfd_section_name (sec2->the_bfd_section));
- sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */
+ bfd_section_name (sec2.the_bfd_section));
+ sec2.ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */
}
return;
}
@@ -3319,12 +3318,12 @@ unmap_overlay_command (const char *args, int from_tty)
/* First, find a section matching the user supplied argument. */
for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *sec : objfile->sections ())
- if (!strcmp (bfd_section_name (sec->the_bfd_section), args))
+ for (obj_section &sec : objfile->sections ())
+ if (!strcmp (bfd_section_name (sec.the_bfd_section), args))
{
- if (!sec->ovly_mapped)
+ if (!sec.ovly_mapped)
error (_("Section %s is not mapped"), args);
- sec->ovly_mapped = 0;
+ sec.ovly_mapped = 0;
return;
}
error (_("No overlay section called %s"), args);
@@ -3578,17 +3577,17 @@ simple_overlay_update (struct obj_section *osect)
/* Now may as well update all sections, even if only one was requested. */
for (objfile *objfile : current_program_space->objfiles ())
- for (obj_section *sect : objfile->sections ())
- if (section_is_overlay (sect))
+ for (obj_section &sect : objfile->sections ())
+ if (section_is_overlay (&sect))
{
int i;
- asection *bsect = sect->the_bfd_section;
+ asection *bsect = sect.the_bfd_section;
for (i = 0; i < cache_novlys; i++)
if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{ /* obj_section matches i'th entry in ovly_table. */
- sect->ovly_mapped = cache_ovly_table[i][MAPPED];
+ sect.ovly_mapped = cache_ovly_table[i][MAPPED];
break; /* finished with inner for loop: break out. */
}
}
@@ -3756,31 +3755,6 @@ symfile_free_objfile (struct objfile *objfile)
objfile->pspace ()->remove_target_sections (objfile);
}
-/* Wrapper around the quick_symbol_functions expand_symtabs_matching "method".
- Expand all symtabs that match the specified criteria.
- See quick_symbol_functions.expand_symtabs_matching for details. */
-
-bool
-expand_symtabs_matching (expand_symtabs_file_matcher file_matcher,
- const lookup_name_info &lookup_name,
- expand_symtabs_symbol_matcher symbol_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- block_search_flags search_flags,
- domain_search_flags domain,
- expand_symtabs_lang_matcher lang_matcher)
-{
- for (objfile *objfile : current_program_space->objfiles ())
- if (!objfile->expand_symtabs_matching (file_matcher,
- &lookup_name,
- symbol_matcher,
- expansion_notify,
- search_flags,
- domain,
- lang_matcher))
- return false;
- return true;
-}
-
/* Wrapper around the quick_symbol_functions map_symbol_filenames "method".
Map function FUN over every file.
See quick_symbol_functions.map_symbol_filenames for details. */