From: Keith Seitz <keiths@redhat.com>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] gdb: int to bool conversion in linux-thread-db.c
Date: Tue, 5 May 2026 11:19:51 -0700 [thread overview]
Message-ID: <0e60778e-c58e-41f4-a30f-af9897272b0f@redhat.com> (raw)
In-Reply-To: <06e340b55f36093000d86d6da7dc6c71910223ca.1775557188.git.aburgess@redhat.com>
On 4/7/26 3:22 AM, Andrew Burgess wrote:
> Some 'int' to 'bool' cleanup in linux-thread-db.c. There should be no
> user visible changes after this commit.
More int -> bool +1000!
Reviewed-By: Keith Seitz <keiths@redhat.com>
Keith
> ---
> gdb/linux-nat.h | 2 +-
> gdb/linux-thread-db.c | 40 ++++++++++++++++++++--------------------
> 2 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
> index 0f128892735..180059a9496 100644
> --- a/gdb/linux-nat.h
> +++ b/gdb/linux-nat.h
> @@ -316,7 +316,7 @@ lwp_info_safe_range all_lwps_safe ();
> does whatever is required to have the child LWP under the
> thread_db's control --- e.g., enabling event reporting. Returns
> true on success, false if the process isn't using libpthread. */
> -extern int thread_db_notice_clone (ptid_t parent, ptid_t child);
> +extern bool thread_db_notice_clone (ptid_t parent, ptid_t child);
>
> /* Return the number of signals used by the threads library. */
> extern unsigned int lin_thread_get_thread_signal_num (void);
> diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
> index 0753d2e7915..cd25c55a898 100644
> --- a/gdb/linux-thread-db.c
> +++ b/gdb/linux-thread-db.c
> @@ -429,7 +429,7 @@ thread_from_lwp (thread_info *stopped, ptid_t ptid)
>
> /* See linux-nat.h. */
>
> -int
> +bool
> thread_db_notice_clone (ptid_t parent, ptid_t child)
> {
> struct thread_db_info *info;
> @@ -437,7 +437,7 @@ thread_db_notice_clone (ptid_t parent, ptid_t child)
> info = get_thread_db_info (linux_target, child.pid ());
>
> if (info == NULL)
> - return 0;
> + return false;
>
> thread_info *stopped = linux_target->find_thread (parent);
>
> @@ -446,7 +446,7 @@ thread_db_notice_clone (ptid_t parent, ptid_t child)
> /* If we do not know about the main thread's pthread info yet, this
> would be a good time to find it. */
> thread_from_lwp (stopped, parent);
> - return 1;
> + return true;
> }
>
> static void *
> @@ -460,10 +460,10 @@ verbose_dlsym (void *handle, const char *name)
> }
>
> /* Verify inferior's '\0'-terminated symbol VER_SYMBOL starts with "%d.%d" and
> - return 1 if this version is lower (and not equal) to
> - VER_MAJOR_MIN.VER_MINOR_MIN. Return 0 in all other cases. */
> + return true if this version is lower (and not equal) to
> + VER_MAJOR_MIN.VER_MINOR_MIN. Return false in all other cases. */
>
> -static int
> +static bool
> inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
> {
> CORE_ADDR version_addr;
> @@ -472,7 +472,7 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
> bound_minimal_symbol version_msym
> = lookup_minimal_symbol (current_program_space, ver_symbol);
> if (version_msym.minsym == NULL)
> - return 0;
> + return false;
>
> version_addr = version_msym.value_address ();
> gdb::unique_xmalloc_ptr<char> version
> @@ -493,10 +493,10 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
> /* Similar as thread_db_find_new_threads_1, but try to silently ignore errors
> if appropriate.
>
> - Return 1 if the caller should abort libthread_db initialization. Return 0
> - otherwise. */
> + Return true if the caller should abort libthread_db initialization.
> + Return false otherwise. */
>
> -static int
> +static bool
> thread_db_find_new_threads_silently (thread_info *stopped)
> {
>
> @@ -518,25 +518,25 @@ thread_db_find_new_threads_silently (thread_info *stopped)
> itself.
>
> If the nptl bug is NOT present in the inferior and still thread_db
> - reports an error return 1. It means the inferior has corrupted thread
> - list and GDB should fall back only to LWPs.
> + reports an error return true. It means the inferior has corrupted
> + thread list and GDB should fall back only to LWPs.
>
> - If the nptl bug is present in the inferior return 0 to silently ignore
> - such errors, and let gdb enumerate threads again later. In such case
> - GDB cannot properly display LWPs if the inferior thread list is
> - corrupted. For core files it does not apply, no 'later enumeration'
> - is possible. */
> + If the nptl bug is present in the inferior return false to
> + silently ignore such errors, and let gdb enumerate threads again
> + later. In such case GDB cannot properly display LWPs if the
> + inferior thread list is corrupted. For core files it does not
> + apply, no 'later enumeration' is possible. */
>
> if (!target_has_execution () || !inferior_has_bug ("nptl_version", 2, 7))
> {
> exception_fprintf (gdb_stderr, except,
> _("Warning: couldn't activate thread debugging "
> "using libthread_db: "));
> - return 1;
> + return true;
> }
> }
>
> - return 0;
> + return false;
> }
>
> /* Lookup a library in which given symbol resides.
> @@ -924,7 +924,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
>
> linux_unstop_all_lwps ();
> }
> - else if (thread_db_find_new_threads_silently (inferior_thread ()) != 0)
> + else if (thread_db_find_new_threads_silently (inferior_thread ()))
> {
> /* Even if libthread_db initializes, if the thread list is
> corrupted, we'd not manage to list any threads. Better reject this
next prev parent reply other threads:[~2026-05-05 18:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 10:22 [PATCH 0/3] Better error handling when creating threads with clone() Andrew Burgess
2026-04-07 10:22 ` [PATCH 1/3] gdb: int to bool conversion in linux-thread-db.c Andrew Burgess
2026-05-05 18:19 ` Keith Seitz [this message]
2026-04-07 10:22 ` [PATCH 2/3] gdb: add some asserts to thread_db_notice_clone Andrew Burgess
2026-05-05 18:24 ` Keith Seitz
2026-04-07 10:22 ` [PATCH 3/3] gdb: improve error handling for thread-db thread adoption Andrew Burgess
2026-05-06 19:39 ` Keith Seitz
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=0e60778e-c58e-41f4-a30f-af9897272b0f@redhat.com \
--to=keiths@redhat.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/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