mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
gdb: int to bool conversion in find_memory_regions API
Perform int to bool conversion for find_memory_region_ftype function type. This function type is used in the find_memory_regions API, both target_find_memory_regions and target_find_memory_regions. There should be no user visible changes after this commit. Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -225,8 +225,8 @@ extern const char *pc_prefix (CORE_ADDR);
|
||||
DATA is passed without changes from a caller. */
|
||||
|
||||
typedef int (*find_memory_region_ftype) (CORE_ADDR addr, unsigned long size,
|
||||
int read, int write, int exec,
|
||||
int modified, bool memory_tagged,
|
||||
bool read, bool write, bool exec,
|
||||
bool modified, bool memory_tagged,
|
||||
void *data);
|
||||
|
||||
/* * Possible lvalue types. Like enum language, this should be in
|
||||
|
||||
@@ -188,7 +188,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
|
||||
Pass MODIFIED as true, we do not know the real modification state. */
|
||||
func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
|
||||
kve->kve_protection & KVME_PROT_WRITE,
|
||||
kve->kve_protection & KVME_PROT_EXEC, 1, false, data);
|
||||
kve->kve_protection & KVME_PROT_EXEC, true, false, data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
34
gdb/gcore.c
34
gdb/gcore.c
@@ -398,8 +398,8 @@ make_output_phdrs (bfd *obfd, asection *osec)
|
||||
DATA is 'bfd *' for the core file GDB is creating. */
|
||||
|
||||
static int
|
||||
gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
|
||||
int write, int exec, int modified, bool memory_tagged,
|
||||
gcore_create_callback (CORE_ADDR vaddr, unsigned long size, bool read,
|
||||
bool write, bool exec, bool modified, bool memory_tagged,
|
||||
void *data)
|
||||
{
|
||||
bfd *obfd = (bfd *) data;
|
||||
@@ -409,7 +409,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
|
||||
/* If the memory segment has no permissions set, ignore it, otherwise
|
||||
when we later try to access it for read/write, we'll get an error
|
||||
or jam the kernel. */
|
||||
if (read == 0 && write == 0 && exec == 0 && modified == 0)
|
||||
if (!read && !write && !exec && !modified)
|
||||
{
|
||||
if (info_verbose)
|
||||
gdb_printf ("Ignore segment, %s bytes at %s\n",
|
||||
@@ -419,7 +419,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (write == 0 && modified == 0 && !solib_keep_data_in_core (vaddr, size))
|
||||
if (!write && !modified && !solib_keep_data_in_core (vaddr, size))
|
||||
{
|
||||
/* See if this region of memory lies inside a known file on disk.
|
||||
If so, we can avoid copying its contents by clearing SEC_LOAD. */
|
||||
@@ -453,7 +453,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
|
||||
keep:;
|
||||
}
|
||||
|
||||
if (write == 0)
|
||||
if (!write)
|
||||
flags |= SEC_READONLY;
|
||||
|
||||
if (exec)
|
||||
@@ -489,8 +489,8 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
|
||||
|
||||
static int
|
||||
gcore_create_memtag_section_callback (CORE_ADDR vaddr, unsigned long size,
|
||||
int read, int write, int exec,
|
||||
int modified, bool memory_tagged,
|
||||
bool read, bool write, bool exec,
|
||||
bool modified, bool memory_tagged,
|
||||
void *data)
|
||||
{
|
||||
/* Are there memory tags in this particular memory map entry? */
|
||||
@@ -548,10 +548,10 @@ objfile_find_memory_regions (struct target_ops *self,
|
||||
int ret;
|
||||
|
||||
ret = (*func) (objsec.addr (), size,
|
||||
1, /* All sections will be readable. */
|
||||
true, /* All sections will be readable. */
|
||||
(flags & SEC_READONLY) == 0, /* Writable. */
|
||||
(flags & SEC_CODE) != 0, /* Executable. */
|
||||
1, /* MODIFIED is unknown, pass it as true. */
|
||||
true, /* MODIFIED is unknown, pass it as true. */
|
||||
false, /* No memory tags in the object file. */
|
||||
obfd);
|
||||
if (ret != 0)
|
||||
@@ -562,10 +562,10 @@ objfile_find_memory_regions (struct target_ops *self,
|
||||
/* Make a stack segment. */
|
||||
if (derive_stack_segment (&temp_bottom, &temp_top))
|
||||
(*func) (temp_bottom, temp_top - temp_bottom,
|
||||
1, /* Stack section will be readable. */
|
||||
1, /* Stack section will be writable. */
|
||||
0, /* Stack section will not be executable. */
|
||||
1, /* Stack section will be modified. */
|
||||
true, /* Stack section will be readable. */
|
||||
true, /* Stack section will be writable. */
|
||||
false, /* Stack section will not be executable. */
|
||||
true, /* Stack section will be modified. */
|
||||
false, /* No memory tags in the object file. */
|
||||
obfd);
|
||||
|
||||
@@ -573,10 +573,10 @@ objfile_find_memory_regions (struct target_ops *self,
|
||||
if (derive_heap_segment (current_program_space->exec_bfd (), &temp_bottom,
|
||||
&temp_top))
|
||||
(*func) (temp_bottom, temp_top - temp_bottom,
|
||||
1, /* Heap section will be readable. */
|
||||
1, /* Heap section will be writable. */
|
||||
0, /* Heap section will not be executable. */
|
||||
1, /* Heap section will be modified. */
|
||||
true, /* Heap section will be readable. */
|
||||
true, /* Heap section will be writable. */
|
||||
false, /* Heap section will not be executable. */
|
||||
true, /* Heap section will be modified. */
|
||||
false, /* No memory tags in the object file. */
|
||||
obfd);
|
||||
|
||||
|
||||
@@ -2623,7 +2623,7 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
|
||||
last_protection & VM_PROT_READ,
|
||||
last_protection & VM_PROT_WRITE,
|
||||
last_protection & VM_PROT_EXECUTE,
|
||||
1, /* MODIFIED is unknown, pass it as true. */
|
||||
true, /* MODIFIED is unknown, pass it as true. */
|
||||
false, /* No memory tags in the object file. */
|
||||
data);
|
||||
last_region_address = region_address;
|
||||
|
||||
@@ -1322,8 +1322,8 @@ linux_core_xfer_siginfo (struct gdbarch *gdbarch, struct bfd &cbfd,
|
||||
|
||||
typedef int linux_find_memory_region_ftype (ULONGEST vaddr, ULONGEST size,
|
||||
ULONGEST offset,
|
||||
int read, int write,
|
||||
int exec, int modified,
|
||||
bool read, bool write,
|
||||
bool exec, bool modified,
|
||||
bool memory_tagged,
|
||||
const std::string &filename,
|
||||
void *data);
|
||||
@@ -1596,7 +1596,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
|
||||
{
|
||||
func (map.start_address, map.end_address - map.start_address,
|
||||
map.offset, map.read, map.write, map.exec,
|
||||
1, /* MODIFIED is true because we want to dump
|
||||
true, /* MODIFIED is true because we want to dump
|
||||
the mapping. */
|
||||
map.vmflags.memory_tagging != 0,
|
||||
map.filename, obfd);
|
||||
@@ -1626,8 +1626,8 @@ struct linux_find_memory_regions_data
|
||||
static int
|
||||
linux_find_memory_regions_thunk (ULONGEST vaddr, ULONGEST size,
|
||||
ULONGEST offset,
|
||||
int read, int write, int exec, int modified,
|
||||
bool memory_tagged,
|
||||
bool read, bool write, bool exec,
|
||||
bool modified, bool memory_tagged,
|
||||
const std::string &filename, void *arg)
|
||||
{
|
||||
struct linux_find_memory_regions_data *data
|
||||
@@ -1683,7 +1683,7 @@ struct linux_make_mappings_data
|
||||
static int
|
||||
linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
|
||||
ULONGEST offset,
|
||||
int read, int write, int exec, int modified,
|
||||
bool read, bool write, bool exec, bool modified,
|
||||
bool memory_tagged,
|
||||
const std::string &filename, void *data)
|
||||
{
|
||||
|
||||
@@ -260,7 +260,7 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
|
||||
Pass MODIFIED as true, we do not know the real modification state. */
|
||||
func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
|
||||
kve->kve_protection & KVME_PROT_WRITE,
|
||||
kve->kve_protection & KVME_PROT_EXEC, 1, false, data);
|
||||
kve->kve_protection & KVME_PROT_EXEC, true, false, data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3168,7 +3168,7 @@ find_memory_regions_callback (struct prmap *map,
|
||||
(map->pr_mflags & MA_READ) != 0,
|
||||
(map->pr_mflags & MA_WRITE) != 0,
|
||||
(map->pr_mflags & MA_EXEC) != 0,
|
||||
1, /* MODIFIED is unknown, pass it as true. */
|
||||
true, /* MODIFIED is unknown, pass it as true. */
|
||||
false,
|
||||
data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user