return 0;
}
-/* Return 0 if the memory mapping (which is related to FILTERFLAGS, V,
+/* Return false if the memory mapping (which is related to FILTERFLAGS, V,
MAYBE_PRIVATE_P, MAPPING_ANONYMOUS_P, ADDR and OFFSET) should not
- be dumped, or greater than 0 if it should.
+ be dumped, or true if it should.
In a nutshell, this is the logic that we follow in order to decide
if a mapping should be dumped or not.
header (of a DSO or an executable, for example). If it is, and
if the user is interested in dump it, then we should dump it. */
-static int
+static bool
dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
int maybe_private_p, int mapping_anon_p, int mapping_file_p,
const char *filename, ULONGEST addr, ULONGEST offset)
(assuming that the version of the Linux kernel being used
supports it, of course). */
int private_p = maybe_private_p;
- int dump_p;
/* We always dump vDSO and vsyscall mappings, because it's likely that
there'll be no file to read the contents from at core load time.
The kernel does the same. */
if (strcmp ("[vdso]", filename) == 0
|| strcmp ("[vsyscall]", filename) == 0)
- return 1;
+ return true;
if (v->initialized_p)
{
/* We never dump I/O mappings. */
if (v->io_page)
- return 0;
+ return false;
/* Check if we should exclude this mapping. */
if (!dump_excluded_mappings && v->exclude_coredump)
- return 0;
+ return false;
/* Update our notion of whether this mapping is shared or
private based on a trustworthy value. */
{
if ((private_p && (filterflags & COREFILTER_HUGETLB_PRIVATE))
|| (!private_p && (filterflags & COREFILTER_HUGETLB_SHARED)))
- return 1;
+ return true;
- return 0;
+ return false;
}
}
+ bool dump_p;
if (private_p)
{
if (mapping_anon_p && mapping_file_p)
{
/* This mapping contains an ELF header, so we
should dump it. */
- dump_p = 1;
+ dump_p = true;
}
}
}
/* As above, but return true only when we should dump the NT_FILE
entry. */
-static int
+static bool
dump_note_entry_p (filter_flags filterflags, const struct smaps_vmflags *v,
int maybe_private_p, int mapping_anon_p, int mapping_file_p,
const char *filename, ULONGEST addr, ULONGEST offset)
put them in the NT_FILE note. */
if (strcmp ("[vdso]", filename) == 0
|| strcmp ("[vsyscall]", filename) == 0)
- return 0;
+ return false;
/* Otherwise, any other file-based mapping should be placed in the
note. */
- return 1;
+ return true;
}
/* Implement the "info proc" command. */
const char *filename,
void *data);
-typedef int linux_dump_mapping_p_ftype (filter_flags filterflags,
- const struct smaps_vmflags *v,
- int maybe_private_p,
- int mapping_anon_p,
- int mapping_file_p,
- const char *filename,
- ULONGEST addr,
- ULONGEST offset);
+typedef bool linux_dump_mapping_p_ftype (filter_flags filterflags,
+ const struct smaps_vmflags *v,
+ int maybe_private_p,
+ int mapping_anon_p,
+ int mapping_file_p,
+ const char *filename,
+ ULONGEST addr,
+ ULONGEST offset);
/* Helper function to parse the contents of /proc/<pid>/smaps into a data
structure, for easy access.
for (const struct smaps_data &map : smaps)
{
- int should_dump_p = 0;
+ bool should_dump_p = false;
if (map.has_anonymous)
{
{
/* Older Linux kernels did not support the "Anonymous:" counter.
If it is missing, we can't be sure - dump all the pages. */
- should_dump_p = 1;
+ should_dump_p = true;
}
/* Invoke the callback function to create the corefile segment. */