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: "Maciej W. Rozycki" <macro at wdc dot com>
- To: Jim Wilson <jimw at sifive 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: Fri, 24 Jan 2020 19:47:24 +0000 (GMT)
- Subject: Re: [RFC][PATCH 4/4] gdbserver: Add RISC-V/Linux support
- Ironport-sdr: +B5Q4oOd1lt6pWaQx+wxk7Pf0fdO0SNOqatdTkm9FiVEJdfKBCCvPS73kHOZlXfqxUUEGpyjZt CpPdVcjooLpohNdLiDkwS8zpm2otRqPP4+gAqaxuGzCGlv7+xzcBYanF5nGkJibBfp/DxvL8ys /3Zw57P+lpjib6QzvE1Avs0JCgf3BBKnBw/tbGPLI3IPPpmynis7c1+gg546tKKUrmv7xBxeVR oJSGgZdNJEW+sO6zdvPIwkN24UUStfy7K23vYvGtDoFWtlSXLfpL4/hWA298lM/R/9yQq3qjpo ag0=
- Ironport-sdr: gkyLpLkAHfF7aAqIwae4PWYwswFWRRz2xCbEFIwB4qYlugJ35z+H6WlLzGjz5uXaNqtOuAFoIf YLuigBI2/wV+XtF+072WINBFYI0ots8Ux+6cXUYZ9EwTqU/79ymlQsYzPgjoasObnVf0IMONuR V0Kh3hP76iQ9tG2gSzZfiF94nFb+B8lFiXEMcb5HKWhsirglW5MAG1o5QosYflRITVZpnqu6mC XnCIG1QUIN5c44DZXsswDb++DvEPfo5PuKlCsw5zPIjRLlLooXRzQRueL10EKuehF0UNMpmkT6 tBKuuovk/++NPge9RybuejIl
- Ironport-sdr: /OYN4p/fxHdhGwcq0zjxXvTBhVt2sfJkGdgGudx0tI+f9yZOy6IwUxYlIodM/xHFSTqNwN2Yxo eeK2v6E2PWIrD4Au1pGkZExD+KNdwlga6/p39TBJZAhwcRROjs232MUtPdc+U3Qr9Jo1AVZGGn epc84kpzOb+r+Do0h8W8BriAjAA/9CAHRMlY91JHhUd1gJsKTHG3iq99wpwQradWp9tpoeKcNR 8y6st4wfTI8U+1tJqTC/U9nT1vbeEtZcjjGAOl8s4jebzi+watThRk7ZxkTiNQj7WkRE6++ir5 buY=
- References: <alpine.LFD.2.21.2001231412510.14118@redsun52.ssa.fujisawa.hgst.com> <alpine.LFD.2.21.2001231518180.14118@redsun52.ssa.fujisawa.hgst.com> <CAFyWVaYLWmeJYMZWA7=vhZASmquuLx5V--ai1+_0=MAUXny16A@mail.gmail.com>
- Wdcironportexception: Internal
On Thu, 23 Jan 2020, Jim Wilson 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.
I actually volunteered to become a glibc RISC-V machine maintainer, but
then I have to admit I haven't been pursuing it particularly actively. :(
> > 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.
Indeed, that's useful for a native configuration to build the gdbserver/
subdirectory automagically and I missed that, having not looked into it
(for cross-compilation you need to build `gdbserver' explictly of course).
Now fixed and included with an updated version, thanks for catching it!
> > 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.
Well, that's exactly where `gdbserver' gets its string from.
> 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.
Native regression-testing of 1/4 has now completed successfully, so I'll
run remote testing now with your patch preapplied and adjustments made to
4/4. We'll see how it goes.
Maciej