This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC][PATCH 4/4] gdbserver: Add RISC-V/Linux support
- From: Jim Wilson <jimw at sifive dot com>
- To: "Maciej W. Rozycki" <macro at wdc dot com>
- Cc: gdb-patches at sourceware dot org, Andrew Burgess <andrew dot burgess at embecosm dot com>, Palmer Dabbelt <palmer at dabbelt dot com>, Tom Tromey <tom at tromey dot com>, Guo Ren <guoren at kernel dot org>, Lifang Xia <lifang_xia at c-sky dot com>, yunhai_shang <yunhai_shang at c-sky dot com>, jiangshuai_li at c-sky dot com
- Date: Thu, 23 Jan 2020 17:18:34 -0800
- Subject: Re: [RFC][PATCH 4/4] gdbserver: Add RISC-V/Linux support
- References: <alpine.LFD.2.21.2001231412510.14118@redsun52.ssa.fujisawa.hgst.com> <alpine.LFD.2.21.2001231518180.14118@redsun52.ssa.fujisawa.hgst.com>
On Thu, Jan 23, 2020 at 11:42 AM Maciej W. Rozycki <macro@wdc.com> wrote:
> Also handle a glibc bug where ELF_NFPREG is defined in terms of NFPREG,
> however NFPREG is nowhere defined.
I remember that this was discussed on the glibc lists, but I don't
know if a formal bug report was filed. We unfortunately don't have an
active glibc maintainer, and I'm helping to maintain so much stuff
that I'm not fixing a glibc bug unless it is blocking someone's
progress, and this does not appear to be a blocker for this patch.
> gdb/
> * arch/riscv.h (riscv_create_target_description): Remove `const'
> qualifier from the return type.
> * arch/riscv.c (riscv_create_target_description): Likewise.
>
> gdb/gdbserver/
> * linux-riscv-low.c: New file.
> * Makefile.in (SFILES): Add linux-riscv-low.c and arch/riscv.c.
> * configure.srv <riscv*-*-linux*> (srv_tgtobj)
> (srv_linux_regsets, srv_linux_usrregs, srv_linux_thread_db):
> Define.
I didn't really review the patch since I've never done any gdbserver
work. But I did build and test it and it worked for me. My gdb
testsuite results look roughly the same with and without the patch
set.
I did have to add a missing build_gdbserver=yes line to the
riscv*-*-linux* block in configure.tgt. I will submit that as a patch
if you don't.
> Posted as an RFC as this hits a major issue with GDB rejecting the XML
> description supplied, e.g.:
>
> warning: while parsing target description (at line 4): Target description specified unknown architecture "riscv:rv64id"
> warning: Could not load XML target description; ignoring
The problem isn't only in bfd. gdb/arch/riscv.c
riscv_create_target_description() creates the same kind of strings.
Anyways, this seems to be a simple issue with bfd/cpu-riscv.c using
bfd_default_scan. It needs to be fixed to use a riscv specific scan
function that ignores trailing characters in the string when they
don't affect the bfd arch match. I was able to reproduce the problem,
and wrote a bfd patch that is working for me. This should not be a
blocking factor for the patch, as I can get the bfd patch in tomorrow
or so, unless maybe you want to try it first.
Jim