From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.baldwin.cx (bigwig.baldwin.cx [66.216.25.90]) by sourceware.org (Postfix) with ESMTPS id F1799396D802 for ; Tue, 3 Aug 2021 18:50:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1799396D802 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=FreeBSD.org Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 5F53F1A84E1F for ; Tue, 3 Aug 2021 14:50:59 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH v2 11/13] fbsd-nat: Return NULL rather than failing thread_alive. Date: Tue, 3 Aug 2021 11:49:58 -0700 Message-Id: <20210803185000.22171-12-jhb@FreeBSD.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210803185000.22171-1-jhb@FreeBSD.org> References: <20210803185000.22171-1-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (mail.baldwin.cx [0.0.0.0]); Tue, 03 Aug 2021 14:50:59 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.103.1 at mail.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KHOP_HELO_FCRDNS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2021 18:51:01 -0000 ptrace on FreeBSD cannot be used against running processes and instead fails with EBUSY. This meant that 'info threads' would fail if any of the threads were running (for example when using schedule-multiple=on in gdb.base/fork-running-state.exp). Instead of throwing errors, just return NULL as no thread name is better than causing info threads to fail completely. --- gdb/fbsd-nat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index ec57bfe3d8a..1c27b698cce 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -818,9 +818,9 @@ fbsd_nat_target::thread_name (struct thread_info *thr) if a name has not been set explicitly. Return a NULL name in that case. */ if (!fbsd_fetch_kinfo_proc (pid, &kp)) - perror_with_name (_("Failed to fetch process information")); + return NULL; if (ptrace (PT_LWPINFO, lwp, (caddr_t) &pl, sizeof pl) == -1) - perror_with_name (("ptrace (PT_LWPINFO)")); + return NULL; if (strcmp (kp.ki_comm, pl.pl_tdname) == 0) return NULL; xsnprintf (buf, sizeof buf, "%s", pl.pl_tdname); -- 2.31.1