From: Matthieu Longo <matthieu.longo@arm.com>
To: <gdb-patches@sourceware.org>
Cc: Luis Machado <luis.machado@amd.com>,
Luis Machado <luis.machado.foss@gmail.com>,
Andrew Burgess <aburgess@redhat.com>,
Matthieu Longo <matthieu.longo@arm.com>
Subject: [PATCH v1 2/8] gdb/linux-tdep: change linux_fill_prpsinfo to return bool
Date: Fri, 3 Jul 2026 19:58:47 +0100 [thread overview]
Message-ID: <20260703185853.450440-3-matthieu.longo@arm.com> (raw)
In-Reply-To: <20260703185853.450440-1-matthieu.longo@arm.com>
Change linux_fill_prpsinfo() to return a boolean instead of an integer, since
it only reports success or failure.
Replace the returned integer values 1 and 0 with true and false respectively.
---
gdb/linux-tdep.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 9f8f9f1af5e..0da33ba379b 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -2258,7 +2258,7 @@ linux_corefile_parse_exec_context (struct gdbarch *gdbarch, bfd *cbfd)
return 1 since some information was already recorded. It will only return
0 iff nothing can be gathered. */
-static int
+static bool
linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
{
/* The filename which we will use to obtain some info about the process.
@@ -2297,14 +2297,14 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
{
/* No program name was read, so we won't be able to retrieve more
information about the process. */
- return 0;
+ return false;
}
if (fname.get ()[buf_len - 1] != '\0')
{
warning (_("target file %s "
"does not contain a trailing null character"),
filename);
- return 0;
+ return false;
}
memset (p, 0, sizeof (*p));
@@ -2336,9 +2336,9 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
if (proc_stat == NULL || *proc_stat == '\0')
{
/* Despite being unable to read more information about the
- process, we return 1 here because at least we have its
+ process, we return true here because at least we have its
command line, PID and arguments. */
- return 1;
+ return true;
}
/* Ok, we have the stats. It's time to do a little parsing of the
@@ -2359,7 +2359,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
/* ps command also relies on no trailing fields ever contain ')'. */
proc_stat = strrchr (proc_stat, ')');
if (proc_stat == NULL)
- return 1;
+ return true;
proc_stat++;
proc_stat = skip_spaces (proc_stat);
@@ -2384,8 +2384,8 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
{
/* Again, we couldn't read the complementary information about
the process state. However, we already have minimal
- information, so we just return 1 here. */
- return 1;
+ information, so we just return true here. */
+ return true;
}
/* Filling the structure fields. */
@@ -2413,8 +2413,8 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
if (proc_status == NULL || *proc_status == '\0')
{
- /* Returning 1 since we already have a bunch of information. */
- return 1;
+ /* Returning true since we already have a bunch of information. */
+ return true;
}
/* Extracting the UID. */
@@ -2443,7 +2443,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
p->pr_gid = strtol (tmpstr, &tmpstr, 10);
}
- return 1;
+ return true;
}
/* Build the note section for a corefile, and return it in a malloc
--
2.55.0
next prev parent reply other threads:[~2026-07-03 19:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 18:58 [PATCH v1 0/8] gdb: various refactoring in linux-tdep Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 1/8] gdb/linux-tdep: use pid_t consistently for process IDs Matthieu Longo
2026-07-05 21:22 ` Tom Tromey
2026-07-06 9:30 ` Matthieu Longo
2026-07-03 18:58 ` Matthieu Longo [this message]
2026-07-03 18:58 ` [PATCH v1 3/8] target_fileio_read_stralloc: add an optional length parameter Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 4/8] gdb support: add index_type to array_view for documentation purpose Matthieu Longo
2026-07-03 19:55 ` Pedro Alves
2026-07-06 10:51 ` Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 5/8] gdb support: add gdb::replace algorithm for iterators and ranges Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 6/8] gdb: introduce helper class file_reader_t Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 7/8] gdb/linux-tdep: parse ProtectionKey in /proc/PID/smaps Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 8/8] gdb/linux: add helpers to read AT_HWCAP3 Matthieu Longo
2026-07-07 10:39 ` Yury Khrustalev
2026-07-07 15:51 ` Matthieu Longo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260703185853.450440-3-matthieu.longo@arm.com \
--to=matthieu.longo@arm.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado.foss@gmail.com \
--cc=luis.machado@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox