Use bool in pc_in_* functions

I noticed that pc_in_unmapped_range had a weird return type -- it was
returning a CORE_ADDR but intending to return a bool.  This patch
changes all the pc_in_* functions to return bool instead.
This commit is contained in:
Tom Tromey
2023-01-18 16:36:52 -07:00
parent 42938c1a5b
commit 6ec27270ff
6 changed files with 17 additions and 22 deletions

View File

@@ -892,7 +892,7 @@ extern void delete_exited_threads (void);
/* Return true if PC is in the stepping range of THREAD. */
int pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread);
bool pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread);
/* Enable storing stack temporaries for thread THR and disable and
clear the stack temporaries on destruction. Holds a strong

View File

@@ -1208,18 +1208,13 @@ find_pc_section (CORE_ADDR pc)
/* Return non-zero if PC is in a section called NAME. */
int
bool
pc_in_section (CORE_ADDR pc, const char *name)
{
struct obj_section *s;
int retval = 0;
s = find_pc_section (pc);
retval = (s != NULL
&& s->the_bfd_section->name != NULL
&& strcmp (s->the_bfd_section->name, name) == 0);
return (retval);
struct obj_section *s = find_pc_section (pc);
return (s != nullptr
&& s->the_bfd_section->name != nullptr
&& strcmp (s->the_bfd_section->name, name) == 0);
}

View File

@@ -891,8 +891,8 @@ extern int have_minimal_symbols (void);
extern struct obj_section *find_pc_section (CORE_ADDR pc);
/* Return non-zero if PC is in a section called NAME. */
extern int pc_in_section (CORE_ADDR, const char *);
/* Return true if PC is in a section called NAME. */
extern bool pc_in_section (CORE_ADDR, const char *);
/* Return non-zero if PC is in a SVR4-style procedure linkage table
section. */

View File

@@ -3022,7 +3022,7 @@ section_is_mapped (struct obj_section *osect)
/* Function: pc_in_unmapped_range
If PC falls into the lma range of SECTION, return true, else false. */
CORE_ADDR
bool
pc_in_unmapped_range (CORE_ADDR pc, struct obj_section *section)
{
if (section_is_overlay (section))
@@ -3035,26 +3035,26 @@ pc_in_unmapped_range (CORE_ADDR pc, struct obj_section *section)
if (bfd_section_lma (bfd_section) + offset <= pc
&& pc < bfd_section_lma (bfd_section) + offset + size)
return 1;
return true;
}
return 0;
return false;
}
/* Function: pc_in_mapped_range
If PC falls into the vma range of SECTION, return true, else false. */
CORE_ADDR
bool
pc_in_mapped_range (CORE_ADDR pc, struct obj_section *section)
{
if (section_is_overlay (section))
{
if (section->addr () <= pc
&& pc < section->endaddr ())
return 1;
return true;
}
return 0;
return false;
}
/* Return true if the mapped ranges of sections A and B overlap, false

View File

@@ -296,10 +296,10 @@ extern int section_is_overlay (struct obj_section *);
extern int section_is_mapped (struct obj_section *);
/* Return true if pc belongs to section's VMA. */
extern CORE_ADDR pc_in_mapped_range (CORE_ADDR, struct obj_section *);
extern bool pc_in_mapped_range (CORE_ADDR, struct obj_section *);
/* Return true if pc belongs to section's LMA. */
extern CORE_ADDR pc_in_unmapped_range (CORE_ADDR, struct obj_section *);
extern bool pc_in_unmapped_range (CORE_ADDR, struct obj_section *);
/* Map an address from a section's LMA to its VMA. */
extern CORE_ADDR overlay_mapped_address (CORE_ADDR, struct obj_section *);

View File

@@ -968,7 +968,7 @@ can_access_registers_thread (thread_info *thread)
return true;
}
int
bool
pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread)
{
return (pc >= thread->control.step_range_start