From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 00EA43857366 for ; Mon, 4 Jul 2022 02:50:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 00EA43857366 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from [10.130.0.135] (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxX+N0VcJi4K0HAA--.23471S3; Mon, 04 Jul 2022 10:50:29 +0800 (CST) Subject: Re: [PATCH] gdb: LoongArch: add orig_a0 into register set To: Xi Ruoyao , gdb-patches@sourceware.org References: From: Tiezhu Yang Message-ID: Date: Mon, 4 Jul 2022 10:50:28 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf9DxX+N0VcJi4K0HAA--.23471S3 X-Coremail-Antispam: 1UD129KBjvJXoW7tFy5uFWUXrWkJry5JryDtrb_yoW8CrW5pa sru3Z8tF4kCF4UX34qkw1YvFWYqws8GryagF15Ar13uF4qqr1IvFs7Zrn3ZF12k34qgFW0 vF1fWw1Yga4UZaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvqb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4 vEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40E FcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr 0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2xFo4CEbIxv r21lc2xSY4AK67AK6r4UMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI 8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AK xVWUXVWUAwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI 8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_WFyUJVCq3wCI42IY6I8E 87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0x ZFpf9x07bOa9fUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, 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 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: Mon, 04 Jul 2022 02:50:36 -0000 On 07/03/2022 11:58 AM, Xi Ruoyao wrote: > Upstreamed Linux kernel has added orig_a0 into struct user_pt_regs. > Adapt GDB register definition so it will work with upstream kernel. > > Url: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/uapi/asm/ptrace.h#n24 > Signed-off-by: Xi Ruoyao > --- > gdb/features/loongarch/base32.c | 1 + > gdb/features/loongarch/base32.xml | 1 + > gdb/features/loongarch/base64.c | 1 + > gdb/features/loongarch/base64.xml | 1 + > gdb/loongarch-linux-tdep.c | 4 ++++ > gdb/loongarch-tdep.c | 1 + > gdb/loongarch-tdep.h | 7 ++++--- > 7 files changed, 13 insertions(+), 3 deletions(-) Hi Ruoyao, Thank you for your patch. The related code in gdb/loongarch-linux-nat.c also need to be modified. Additionally, we know that the LoongArch upstream Linux kernel can not actually be used before efistub, irqchip and pci are merged [0]. [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c6f2f3e2c80e So I think we can modify the patch subject and the commit message like this: gdb: LoongArch: Add orig_a0 to match upstream Linux kernel The basic support for LoongArch has been merged into the upstream Linux kernel since 5.19-rc1 on June 5, 2022, this commit adds orig_a0 which is added into struct user_pt_regs [1] to match the upstream kernel, and then the upstream GDB will work with the upstream kernel. Note that there is no orig_a0 in struct user_pt_regs in the product kernel which version is 4.19, if somebody wants to use the upstream GDB with the product kernel, please revert this commit manually. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/uapi/asm/ptrace.h#n24 Thanks, Tiezhu