gdb: make two objfile functions return bool

gdb/ChangeLog:

	* objfiles.h (is_addr_in_objfile,
	shared_objfile_contains_address_p): Return bool.
	* objfile.c (is_addr_in_objfile,
	shared_objfile_contains_address_p): Return bool.
This commit is contained in:
Simon Marchi 2020-05-12 11:17:01 -04:00
parent c7c6634180
commit 02ff80c296
3 changed files with 23 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2020-05-12 Simon Marchi <simon.marchi@efficios.com>
* objfiles.h (is_addr_in_objfile,
shared_objfile_contains_address_p): Return bool.
* objfile.c (is_addr_in_objfile,
shared_objfile_contains_address_p): Return bool.
2020-05-11 Tom Tromey <tromey@adacore.com> 2020-05-11 Tom Tromey <tromey@adacore.com>
* cli/cli-cmds.c (info_command): Restore. * cli/cli-cmds.c (info_command): Restore.

View File

@ -1303,16 +1303,15 @@ inhibit_section_map_updates (struct program_space *pspace)
(&get_objfile_pspace_data (pspace)->inhibit_updates, 1); (&get_objfile_pspace_data (pspace)->inhibit_updates, 1);
} }
/* Return 1 if ADDR maps into one of the sections of OBJFILE and 0 /* See objfiles.h. */
otherwise. */
int bool
is_addr_in_objfile (CORE_ADDR addr, const struct objfile *objfile) is_addr_in_objfile (CORE_ADDR addr, const struct objfile *objfile)
{ {
struct obj_section *osect; struct obj_section *osect;
if (objfile == NULL) if (objfile == NULL)
return 0; return false;
ALL_OBJFILE_OSECTIONS (objfile, osect) ALL_OBJFILE_OSECTIONS (objfile, osect)
{ {
@ -1321,12 +1320,14 @@ is_addr_in_objfile (CORE_ADDR addr, const struct objfile *objfile)
if (obj_section_addr (osect) <= addr if (obj_section_addr (osect) <= addr
&& addr < obj_section_endaddr (osect)) && addr < obj_section_endaddr (osect))
return 1; return true;
} }
return 0; return false;
} }
int /* See objfiles.h. */
bool
shared_objfile_contains_address_p (struct program_space *pspace, shared_objfile_contains_address_p (struct program_space *pspace,
CORE_ADDR address) CORE_ADDR address)
{ {
@ -1334,10 +1335,10 @@ shared_objfile_contains_address_p (struct program_space *pspace,
{ {
if ((objfile->flags & OBJF_SHARED) != 0 if ((objfile->flags & OBJF_SHARED) != 0
&& is_addr_in_objfile (address, objfile)) && is_addr_in_objfile (address, objfile))
return 1; return true;
} }
return 0; return false;
} }
/* The default implementation for the "iterate_over_objfiles_in_search_order" /* The default implementation for the "iterate_over_objfiles_in_search_order"

View File

@ -741,13 +741,16 @@ extern void objfile_set_sym_fns (struct objfile *objfile,
extern void objfiles_changed (void); extern void objfiles_changed (void);
extern int is_addr_in_objfile (CORE_ADDR addr, const struct objfile *objfile); /* Return true if ADDR maps into one of the sections of OBJFILE and false
otherwise. */
extern bool is_addr_in_objfile (CORE_ADDR addr, const struct objfile *objfile);
/* Return true if ADDRESS maps into one of the sections of a /* Return true if ADDRESS maps into one of the sections of a
OBJF_SHARED objfile of PSPACE and false otherwise. */ OBJF_SHARED objfile of PSPACE and false otherwise. */
extern int shared_objfile_contains_address_p (struct program_space *pspace, extern bool shared_objfile_contains_address_p (struct program_space *pspace,
CORE_ADDR address); CORE_ADDR address);
/* This operation deletes all objfile entries that represent solibs that /* This operation deletes all objfile entries that represent solibs that
weren't explicitly loaded by the user, via e.g., the add-symbol-file weren't explicitly loaded by the user, via e.g., the add-symbol-file