From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id DE1C4386188C for ; Thu, 21 Dec 2023 06:41:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE1C4386188C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DE1C4386188C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703140912; cv=none; b=mtL3u8ibraiMPbhzZ7wcN299xNt9bjSLKrbG1lu3I46csoh1SzsWP9JAVtWJF5gJCddU/WqewRDiFPMXjmX2LwK1uz1ntWTjkB6uJh2khhxXT4Y7Gv6Xu1ejPRF5+tBFt6BTWDftqGJG1pWbEbfs2jeGW3p6FX3IkqRisRSLK1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703140912; c=relaxed/simple; bh=w6Q9W9nicb1K3FHVuye/0FFVVPEHydsA3c3+k787LfU=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=uigEqeoNgrZ4lyeXLyDSYY0DILZNDn17fAETB56dKDOLRJ1rCvTEBmTpva7a50+pwV6lVI1ZWzu2X3qHBPZb7VG3m6J0+5PtOmPczwYEPbZWzUfdLSwV1up/itm9kVZToK1+czr3h24PO7KfhMEvJ6MnWPFsIgAgk5iugjf/RII= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGCkd-0005Tt-Vr; Thu, 21 Dec 2023 01:41:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=gCdWV0tmas2TKlf99ml6y401/PBAuKA9DklT1ikZ5Yc=; b=EwaMfxIjW3Gq hPJMfkwpYmV+vu5MzbfGfCPCQr7mbNiBmdZJsURhHrSmsAKe8q0FEIMcvV8rHM5hidrWSuOd9TJL8 yopuQOzbNBJ+IqniZN/U+OVaLf/KmF3pfQmTLM0unVFkplmGZXg2CWH3h7rqFA27GEMHQVrPNfJwL ZsqY4V5mT9TnI7I0m6i3N9Rm3o0o7In+E0hCxYA0W7XWiCqU9ECUbwTKG8uGH7Z7sMNLUF7Y3qA8d TJGt3nHyZHbDpJ7neujI35ri1FQgELDCIu9yZeqVuueteGu8qcg2BuaTGqi7NJw1FrGkJ7uxc1sUT pf1uf3Kh2NN4AeowgOmgOA==; Date: Thu, 21 Dec 2023 08:41:31 +0200 Message-Id: <838r5ogiqs.fsf@gnu.org> From: Eli Zaretskii To: John Baldwin Cc: tankut.baris.aktemur@intel.com, gdb-patches@sourceware.org In-Reply-To: <1aa5010d-e17c-484b-b0cb-c1bf67b2f71d@FreeBSD.org> (message from John Baldwin on Wed, 20 Dec 2023 14:00:03 -0800) Subject: Re: [PATCH v4 2/2] gdb: raise and handle NOT_AVAILABLE_ERROR when accessing frame PC References: <6fb2a95f5999118e30ac972503be4bec35b092ac.1702909611.git.tankut.baris.aktemur@intel.com> <1aa5010d-e17c-484b-b0cb-c1bf67b2f71d@FreeBSD.org> X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Date: Wed, 20 Dec 2023 14:00:03 -0800 > From: John Baldwin > > > --- a/gdb/amd64-linux-nat.c > > +++ b/gdb/amd64-linux-nat.c > > @@ -223,7 +223,10 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) > > elf_gregset_t regs; > > > > if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0) > > - perror_with_name (_("Couldn't get registers")); > > + { > > + std::string msg = perror_string (_("Couldn't get registers")); > > + throw_error (NOT_AVAILABLE_ERROR, "%s", msg.c_str ()); > > + } > > Should other nat backends for other OS's (and other arches) also > make this change when failing to fetch registers? That's probably a good idea, yes. But I also wonder whether the difference between Couldn't get registers: No such process. or Could not read registers; remote failure reply 'E01' and or Backtrace stopped: not enough registers or memory available to unwind further is such a significant improvement in terms of UX. Both the "before" and "after" messages allude to issues that are extremely technical and obscure, IMO. If anything, "No such process" sounds better to me than "", because the former explicitly explains the reason in high-level terms understood by anyone, while the latter alludes to the PC register, which is a GDB abstraction, and the fact that some register is not available doesn't necessarily tell me what is wrong in practical terms. IOW, it seems to me that, when we catch the error, we ought to produce some meaningful message, and with this change we don't yet do that. Does this make sense?