From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 720A6381DC00 for ; Tue, 24 May 2022 16:47:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 720A6381DC00 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4FAFA74363; Tue, 24 May 2022 16:47:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L70VL1VzKz3MJ5; Tue, 24 May 2022 16:47:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653410842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=laqoN2Kg/vFkbkQpiIIf5HtM6Gb4n4PhHYNsV89MSsI=; b=YsFhQPX83sPhqYoIU1wrq6gawwNPHeb+lmPnUj81ryaHq6BUHnxYax6ZA3j0Fo/k6keb0C zAR2pbyhQ50xX0t6Qhkpae9gQNH+3xC6eNakRyW4W1fWBX1wbDA366UTDYtuLGKydXMt9X 7/6VXZpSplOA4qWeJYAYhqqfQn7qAQ7O9WVC6Pqi0lxWV9xk1RBfgcMSK5Mvvop8LuXihb egMVWNG7qPbrdLQp6evPAVyEwRM815cV2p7emG15f63iJwHa5Kf0wSA/YbN+d2WYcm4PQX eKXV/9NlQdnENnIfr5GhctmGtp4TW8FOGgHr97Xc5OEB5uK7dM0uRQoOhr+iuA== Received: from [IPV6:2601:648:8680:ed60:e500:53d:3abd:d723] (unknown [IPv6:2601:648:8680:ed60:e500:53d:3abd:d723]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id B5DD91C50; Tue, 24 May 2022 16:47:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <47d2fec5-36a3-012d-4d60-0553b04c3405@FreeBSD.org> Date: Tue, 24 May 2022 09:47:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PUSHED OBV] Fix loongarch_iterate_over_regset_sections for non-native targets. Content-Language: en-US To: Tiezhu Yang , gdb-patches@sourceware.org References: <20220523181559.54764-1-jhb@FreeBSD.org> <9ff1f06f-f274-36e0-0921-bac72ff4df74@loongson.cn> From: John Baldwin In-Reply-To: <9ff1f06f-f274-36e0-0921-bac72ff4df74@loongson.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653410842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=laqoN2Kg/vFkbkQpiIIf5HtM6Gb4n4PhHYNsV89MSsI=; b=u7SDy5iaoni87YuZcCjlRQigDQ3Kzm26r+MDUdjEpRuyg3R+VnC2h8fuCYXxqfjdiI+xhP vOPEJ+xbveTETw0pWMZoYnm55UloqWWpAze06vA1EbfHuqwcMXKZOsflH+WTBvLmGlh7KE Fx5BAODoQk/N7JF4l6F25aB4R8Qnk9QvzQ8cGa/MVyU/jhhi6dHlsxld7QxV5PMgd99CBE y7+DqvPDTvmbIW8ZIKHdTXCPPe6ymPgZJMFrBxgkCx8eVK22CIoaZwtcfX5UjxVs49Qags T/XIe7Hl7+uHLQrqxTmk0ZEOwKadNgm7pqCwluK3dbRxRxh28oio8ECxbL8FSQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653410842; a=rsa-sha256; cv=none; b=kEOulnStBVy+RpRiFQJZHGmYJ0UD+HsZPZn8qQDEjuSle4cS1ddxIpQB1lzMsEySUA07FQ r4FDa1/gF2W2DpPIdv6jdEy4qACLzL5o2/2mUSu89qg0yv6wUHvQOnc4k6oT6AWVf5eNBa ULEVVZZ+2r0bliMlF1RhhGREWKhBG6ODFaKrz3qcGS+xZ1YxQVGQ1JWOAvtAE+umyYX4ZD Ry5sfduf+Vb5WJaKU7P12c0uCVAP2RSiQMS6mBivUxfXTmZtxAuUd5LY8lrnI2hnyE6/cW +NSLY2hdTgMsuRwddBU3cztofPVMDXiyqorJ+E1N4Lht2t+Ea2MAuQXaH+PORg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, 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 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, 24 May 2022 16:47:25 -0000 On 5/24/22 2:20 AM, Tiezhu Yang wrote: > > > On 05/24/2022 02:15 AM, John Baldwin wrote: >> Define a constant for the number of registers stored in a register set >> and use this with register_size to compute the size of the >> general-purpose register set in core dumps. >> >> This also fixes the build on hosts such as FreeBSD that do not define >> an elf_gregset_t type. > > Hi John, > > Sorry for the related issues on FreeBSD, > the original patch is only tested on LoongArch Linux, > thank you very much for your test and fix. Testing on x86-64 Linux or the like might also be good to help ensure that you can cross-debug core dumps in the future. Testing on that would probably have also not worked due to elf_gregset_t being different sizes for different architectures. >> --- >> gdb/loongarch-linux-tdep.c | 14 ++++++++++++-- >> 1 file changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c >> index f13756dd003..bbb43abe13f 100644 >> --- a/gdb/loongarch-linux-tdep.c >> +++ b/gdb/loongarch-linux-tdep.c >> @@ -29,6 +29,11 @@ >> #include "trad-frame.h" >> #include "tramp-frame.h" >> >> +/* The general-purpose regset consists of 32 R registers, plus PC, >> + and BADV registers. */ >> + >> +#define LOONGARCH_LINUX_NUM_GREGSET (34) > > LOONGARCH_LINUX_NUM_GREGSET should be defined as 45 (32 + 1 + 1 + 11) > due to reserved 11 for extension in glibc, otherwise when execute: Thanks for fixing the constant. I just guessed based on what the regset functions supplied and collected. -- John Baldwin