Change objfile_has_partial_symbols to a method
This changes objfile_has_partial_symbols to be a method on objfile. There are some other functions that could benefit from this sort of change, but this was the only one that was relevant to this series. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * symfile.c (read_symbols): Update. * objfiles.h (struct objfile) <has_partial_symbols>: New method. (objfile_has_partial_symbols): Don't declare. * objfiles.c (objfile::has_partial_symbols): Rename from objfile_has_partial_symbols. (objfile_has_symbols, have_partial_symbols): Update. * elfread.c (elf_symfile_read): Update. * dwarf2/read.c (dwarf2_has_info): Update. * coffread.c (coff_symfile_read): Update.
This commit is contained in:
parent
701823751b
commit
a8ad4f3c17
@ -1,3 +1,15 @@
|
||||
2021-03-20 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* symfile.c (read_symbols): Update.
|
||||
* objfiles.h (struct objfile) <has_partial_symbols>: New method.
|
||||
(objfile_has_partial_symbols): Don't declare.
|
||||
* objfiles.c (objfile::has_partial_symbols): Rename from
|
||||
objfile_has_partial_symbols.
|
||||
(objfile_has_symbols, have_partial_symbols): Update.
|
||||
* elfread.c (elf_symfile_read): Update.
|
||||
* dwarf2/read.c (dwarf2_has_info): Update.
|
||||
* coffread.c (coff_symfile_read): Update.
|
||||
|
||||
2021-03-20 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* coffread.c: Include dwarf2/public.h.
|
||||
|
@ -708,7 +708,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
dwarf2_build_frame_info (objfile);
|
||||
|
||||
/* Try to add separate debug file if no symbols table found. */
|
||||
if (!objfile_has_partial_symbols (objfile))
|
||||
if (!objfile->has_partial_symbols ())
|
||||
{
|
||||
std::string debugfile = find_separate_debug_file_by_buildid (objfile);
|
||||
|
||||
|
@ -1954,7 +1954,7 @@ dwarf2_has_info (struct objfile *objfile,
|
||||
/* We can share a "dwarf2_per_bfd" with other objfiles if the BFD
|
||||
doesn't require relocations and if there aren't partial symbols
|
||||
from some other reader. */
|
||||
if (!objfile_has_partial_symbols (objfile)
|
||||
if (!objfile->has_partial_symbols ()
|
||||
&& !gdb_bfd_requires_relocations (objfile->obfd))
|
||||
{
|
||||
/* See if one has been created for this BFD yet. */
|
||||
|
@ -1266,7 +1266,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
/* elf_sym_fns_gdb_index cannot handle simultaneous non-DWARF
|
||||
debug information present in OBJFILE. If there is such debug
|
||||
info present never use an index. */
|
||||
if (!objfile_has_partial_symbols (objfile)
|
||||
if (!objfile->has_partial_symbols ()
|
||||
&& dwarf2_initialize_objfile (objfile, &index_kind))
|
||||
{
|
||||
switch (index_kind)
|
||||
@ -1293,14 +1293,14 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
SYMTABS/PSYMTABS. `.gnu_debuglink' may no longer be present with
|
||||
`.note.gnu.build-id'.
|
||||
|
||||
.gnu_debugdata is !objfile_has_partial_symbols because it contains only
|
||||
.gnu_debugdata is !objfile::has_partial_symbols because it contains only
|
||||
.symtab, not .debug_* section. But if we already added .gnu_debugdata as
|
||||
an objfile via find_separate_debug_file_in_section there was no separate
|
||||
debug info available. Therefore do not attempt to search for another one,
|
||||
objfile->separate_debug_objfile->separate_debug_objfile GDB guarantees to
|
||||
be NULL and we would possibly violate it. */
|
||||
|
||||
else if (!objfile_has_partial_symbols (objfile)
|
||||
else if (!objfile->has_partial_symbols ()
|
||||
&& objfile->separate_debug_objfile == NULL
|
||||
&& objfile->separate_debug_objfile_backlink == NULL)
|
||||
{
|
||||
|
@ -810,23 +810,23 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
|
||||
breakpoint_re_set ();
|
||||
}
|
||||
|
||||
/* Return non-zero if OBJFILE has partial symbols. */
|
||||
/* See objfiles.h. */
|
||||
|
||||
int
|
||||
objfile_has_partial_symbols (struct objfile *objfile)
|
||||
objfile::has_partial_symbols ()
|
||||
{
|
||||
if (!objfile->sf)
|
||||
if (!sf)
|
||||
return 0;
|
||||
|
||||
/* If we have not read psymbols, but we have a function capable of reading
|
||||
them, then that is an indication that they are in fact available. Without
|
||||
this function the symbols may have been already read in but they also may
|
||||
not be present in this objfile. */
|
||||
if ((objfile->flags & OBJF_PSYMTABS_READ) == 0
|
||||
&& objfile->sf->sym_read_psymbols != NULL)
|
||||
if ((flags & OBJF_PSYMTABS_READ) == 0
|
||||
&& sf->sym_read_psymbols != NULL)
|
||||
return 1;
|
||||
|
||||
return objfile->sf->qf->has_symbols (objfile);
|
||||
return sf->qf->has_symbols (this);
|
||||
}
|
||||
|
||||
/* Return non-zero if OBJFILE has full symbols. */
|
||||
@ -844,7 +844,7 @@ int
|
||||
objfile_has_symbols (struct objfile *objfile)
|
||||
{
|
||||
for (::objfile *o : objfile->separate_debug_objfiles ())
|
||||
if (objfile_has_partial_symbols (o) || objfile_has_full_symbols (o))
|
||||
if (o->has_partial_symbols () || objfile_has_full_symbols (o))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@ -859,7 +859,7 @@ have_partial_symbols (void)
|
||||
{
|
||||
for (objfile *ofp : current_program_space->objfiles ())
|
||||
{
|
||||
if (objfile_has_partial_symbols (ofp))
|
||||
if (ofp->has_partial_symbols ())
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -548,6 +548,9 @@ public:
|
||||
return per_bfd->gdbarch;
|
||||
}
|
||||
|
||||
/* Return true if OBJFILE has partial symbols. */
|
||||
|
||||
int has_partial_symbols ();
|
||||
|
||||
/* The object file's original name as specified by the user,
|
||||
made absolute, and tilde-expanded. However, it is not canonicalized
|
||||
@ -738,8 +741,6 @@ extern void free_objfile_separate_debug (struct objfile *);
|
||||
extern void objfile_relocate (struct objfile *, const section_offsets &);
|
||||
extern void objfile_rebase (struct objfile *, CORE_ADDR);
|
||||
|
||||
extern int objfile_has_partial_symbols (struct objfile *objfile);
|
||||
|
||||
extern int objfile_has_full_symbols (struct objfile *objfile);
|
||||
|
||||
extern int objfile_has_symbols (struct objfile *objfile);
|
||||
|
@ -775,7 +775,7 @@ read_symbols (struct objfile *objfile, symfile_add_flags add_flags)
|
||||
|
||||
/* find_separate_debug_file_in_section should be called only if there is
|
||||
single binary with no existing separate debug info file. */
|
||||
if (!objfile_has_partial_symbols (objfile)
|
||||
if (!objfile->has_partial_symbols ()
|
||||
&& objfile->separate_debug_objfile == NULL
|
||||
&& objfile->separate_debug_objfile_backlink == NULL)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user