Re: [PATCH v2] gdb: LoongArch: add orig_a0 into register set

Tiezhu Yang
2022-07-05T14:38:23Z

On 7/4/22 14:20, Xi Ruoyao wrote:
> Hi Tiezhu,
>
> Thanks for the review.
>
> On Mon, 2022-07-04 at 10:50 +0800, Tiezhu Yang wrote:
>
>> The related code in gdb/loongarch-linux-nat.c also need to be
>> modified.
>
> Done in v2.
>
>> 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:
>
> Done in v2, with some modification.
>
> Patch v2 follows here:
>
> -- >8 --
>
>
> 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 orig_a0 was added into struct user_pt_regs in the development
> cycle for merging LoongArch port into the upstream Linux kernel, so
> earlier kernels (notably, the product kernel with version 4.19 used in
> distros like UOS and Loongnix) don't have it. Inspect
> arch/loongarch/include/uapi/asm/ptrace.h in the kernel tree to make sure.
> To build upstream GDB for a kernel lacking orig_a0, it's necessary to
> revert this commit locally.
>
> [1]: 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 <xry111@xry111.site>
> ---
> 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-nat.c | 2 ++
> gdb/loongarch-linux-tdep.c | 8 ++++++++
> gdb/loongarch-tdep.c | 1 +
> gdb/loongarch-tdep.h | 7 ++++---
> 8 files changed, 19 insertions(+), 3 deletions(-)
>

Looks good to me, this patch only touches files related with LoongArch,
pushed.

Thanks,
Tiezhu