gdb: bool-ify a few functions in objfiles.{c,h}

Change return types to bool, and make a few stylistic adjustments.

Change-Id: I784c3c33af0394a77c25064b06eb3e128e69222f
Approved-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
This commit is contained in:
Simon Marchi
2024-05-16 16:29:47 -04:00
committed by Simon Marchi
parent fbee6a57b2
commit cc7541ce5e
2 changed files with 50 additions and 50 deletions

View File

@@ -731,56 +731,49 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
if (changed)
breakpoint_re_set ();
}
/* Return non-zero if OBJFILE has full symbols. */
int
objfile_has_full_symbols (struct objfile *objfile)
/* See objfiles.h. */
bool
objfile_has_full_symbols (objfile *objfile)
{
return objfile->compunit_symtabs != NULL;
return objfile->compunit_symtabs != nullptr;
}
/* Return non-zero if OBJFILE has full or partial symbols, either directly
or through a separate debug file. */
/* See objfiles.h. */
int
objfile_has_symbols (struct objfile *objfile)
bool
objfile_has_symbols (objfile *objfile)
{
for (::objfile *o : objfile->separate_debug_objfiles ())
if (o->has_partial_symbols () || objfile_has_full_symbols (o))
return 1;
return 0;
return true;
return false;
}
/* See objfiles.h. */
/* Many places in gdb want to test just to see if we have any partial
symbols available. This function returns zero if none are currently
available, nonzero otherwise. */
int
have_partial_symbols (void)
bool
have_partial_symbols ()
{
for (objfile *ofp : current_program_space->objfiles ())
{
if (ofp->has_partial_symbols ())
return 1;
}
return 0;
if (ofp->has_partial_symbols ())
return true;
return false;
}
/* Many places in gdb want to test just to see if we have any full
symbols available. This function returns zero if none are currently
available, nonzero otherwise. */
/* See objfiles.h. */
int
have_full_symbols (void)
bool
have_full_symbols ()
{
for (objfile *ofp : current_program_space->objfiles ())
{
if (objfile_has_full_symbols (ofp))
return 1;
}
return 0;
if (objfile_has_full_symbols (ofp))
return true;
return false;
}
@@ -799,22 +792,16 @@ objfile_purge_solibs (program_space *pspace)
}
}
/* See objfiles.h. */
/* Many places in gdb want to test just to see if we have any minimal
symbols available. This function returns zero if none are currently
available, nonzero otherwise. */
int
have_minimal_symbols (void)
bool
have_minimal_symbols ()
{
for (objfile *ofp : current_program_space->objfiles ())
{
if (ofp->per_bfd->minimal_symbol_count > 0)
{
return 1;
}
}
return 0;
if (ofp->per_bfd->minimal_symbol_count > 0)
return true;
return false;
}
/* Qsort comparison function. */

View File

@@ -923,13 +923,23 @@ 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_full_symbols (struct objfile *objfile);
/* Return true if OBJFILE has full symbols. */
extern int objfile_has_symbols (struct objfile *objfile);
extern bool objfile_has_full_symbols (objfile *objfile);
extern int have_partial_symbols (void);
/* Return true if OBJFILE has full or partial symbols, either directly
or through a separate debug file. */
extern int have_full_symbols (void);
extern bool objfile_has_symbols (objfile *objfile);
/* Return true if any objfile of the current program space has partial
symbols. */
extern bool have_partial_symbols ();
/* Return true if any objfile of the current program space has full symbols. */
extern bool have_full_symbols ();
extern void objfile_set_sym_fns (struct objfile *objfile,
const struct sym_fns *sf);
@@ -956,7 +966,10 @@ extern void objfile_purge_solibs (program_space *pspace);
/* Functions for dealing with the minimal symbol table, really a misc
address<->symbol mapping for things we don't have debug symbols for. */
extern int have_minimal_symbols (void);
/* Return true if any objfile of the current program space has minimal
symbols. */
extern bool have_minimal_symbols ();
extern struct obj_section *find_pc_section (CORE_ADDR pc);