From patchwork Tue Apr 7 10:22:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 132752 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 9CC394BA2E16 for ; Tue, 7 Apr 2026 10:23:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CC394BA2E16 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IZI32DOy X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 985A14BA2E0B for ; Tue, 7 Apr 2026 10:22:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 985A14BA2E0B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 985A14BA2E0B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775557356; cv=none; b=HZnv9CSHKPeM1o2d0eTHH9p4LYR4zmXsi1PW9l/avP91LOmo7vMw0jUMyMKrEtQZIFhQvmxCBLnFI+ECp+ls40kcClvXJvdY8wByh0+LRmc9zO3rlBVN1QsW3yX4CChdryAfutUQ9INv8tNYq8jFTtmA9pfR1E5eu3chpf9Xn/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775557356; c=relaxed/simple; bh=/T3Y1Mcwgng3Xu6VnBrsBGA48TfMeQz7lGGjsivazjE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=iPOVZIrnOU9OxBr1j7arQBqEuU2yiMh8q+6Ykzh+o/tTUpOlQSLbbiugu3hCvWFKlXa0UGAQVE0+2dZqX7LLe3E1/K62dNrZ39XKmXHYLZT6bbDt0cLJ5doKDJDaolJQDIhngZ4xAjjx+dUAFC4zmh9GjpT1ejGYeEH+rYTJxlw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 985A14BA2E0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775557356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/PzGU5gRw1z4p3kVngNgpPLmuNsbdEBFW2z+kfM/OXI=; b=IZI32DOykwGNm/x8ITXyRUPhM8DFlDIqnR7ut35rkEi5ce66YIGrqF4KofpwmipQtHhKV8 WESS8Zjh6j7kVfguqVQ8qCQGvvnZNEqniOH/Xo31aCFhVaWnUGVJ+slergsvcXKhL0ohUF JAVQSViiDFtybsB9Vlk+BatilwF8/MQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-376-uAG3Qpe7MYaFRrBAK2TbCQ-1; Tue, 07 Apr 2026 06:22:34 -0400 X-MC-Unique: uAG3Qpe7MYaFRrBAK2TbCQ-1 X-Mimecast-MFC-AGG-ID: uAG3Qpe7MYaFRrBAK2TbCQ_1775557353 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-43cfedb10a8so3203369f8f.1 for ; Tue, 07 Apr 2026 03:22:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775557353; x=1776162153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/PzGU5gRw1z4p3kVngNgpPLmuNsbdEBFW2z+kfM/OXI=; b=eL3QC3gJJOi20jhQAN+05i/imevuRF99ka8XdG1lv69Fh+BrTmM6pMk/kPN9JWXxtL Xj0q7wFIV4wrw+TSQbjf7GczR9HVRLCnJXUpx9mA0f8IjQ9LJLRpLvqBP4OM8xn7oFCo VUiQU2alCcIFRczqJVWJcJ/6yABxkNf6dQvnsLvkC+PRzm5Q+ypCgWSZSVNlmXniVQ0p 0XOd1lx2dKQIiIkFOJKBbsdgqgfjNJy8/HNkxnp4XjFISdjPTOWce29ye8L2IKxr6Eve GywXho4Mw2D9gr2/ZQz8diWZR76x07nIHufaxYNnPvVjt8fsw5jLrjfXhHoQx7X+7G9l TCQA== X-Gm-Message-State: AOJu0YwtyiZM0EeqEwRzLMxECPe+it9HxsvEHTc9J4+LcJxKM73fcVPE NqtlaTfIliE76Ke2NeUDI/9Yctbk/iqK8RzzRJM4Kvp5/pmm1lYm7IeljkHooZsZ28kvLKcryM0 1QICHeICqk7TLZmz1S/C85aEXZwW9rfFs1l00ZY04HzEr0XKTtGZh1FGh8LvPqAhc+D4XKSt/2+ 6bsm+gXugcsRPRx52owOLSB5hGw/TAJUrsLPQVf2/LvXfHRWM= X-Gm-Gg: AeBDiesuQ1ffQmXDgCaAnRO0PayiI8X3dkzO6Eop38j6iac6P6b0xZZFSOXQ8EPYVsG HYTwXLqEaOeb/mZoNmC0C9Xdqm5BO8qjBxXqtwWyCOq+HTYvlDQJH6AH0A7N1q2f1lUn4m5c+UV GhUVuz628DV087Vw0VY1nSPBF4SRz8yWeSuj0Lj0j+1xejPpUswNQIHK394YG4/EPgbyDZOl3AY uo8KMWxPWdFH1DeisIQCuHTdLYEccm5W8bgSrGNi/PDsidZeHdsmrv7CP7yXvlQfzkVns5BAFcN MosU7EVvHlb9R8Z++p8K89Pv87ACIgW9RHi0GrsSr1iic4itE4z7NrV+PHp+LTIj5R9zmkor4Oy OH8tTJdl8eisgTKNT X-Received: by 2002:a05:6000:25c6:b0:43c:ffee:ee91 with SMTP id ffacd0b85a97d-43d292ff366mr23102244f8f.36.1775557352698; Tue, 07 Apr 2026 03:22:32 -0700 (PDT) X-Received: by 2002:a05:6000:25c6:b0:43c:ffee:ee91 with SMTP id ffacd0b85a97d-43d292ff366mr23102186f8f.36.1775557352110; Tue, 07 Apr 2026 03:22:32 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d1e2a71f7sm51286623f8f.1.2026.04.07.03.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 03:22:31 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 1/3] gdb: int to bool conversion in linux-thread-db.c Date: Tue, 7 Apr 2026 11:22:27 +0100 Message-Id: <06e340b55f36093000d86d6da7dc6c71910223ca.1775557188.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: eWqMh60kaPnm24h9xr-24jw0d6RI3RaG6LLsVNRFlo4_1775557353 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Some 'int' to 'bool' cleanup in linux-thread-db.c. There should be no user visible changes after this commit. Reviewed-By: Keith Seitz --- 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 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