Message ID | 20201204014549.2669932-1-vgupta@synopsys.com |
---|---|
State | Rejected |
Headers | show |
Series | Revert "package/gdb: prevent gdbserver being selected for RISC-V builds" | expand |
Hello, On Thu, 3 Dec 2020 17:45:49 -0800 Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote: > This reverts commit 44a9babcc67cd011e957ba9fd1cf741891957c12. > > As of Buildroot 2020.11 (glibc build of qemu_riscv64_virt_defconfig), > cross-gdb for RISCV buildis fine and can also attach to a qemu > instance, so remove the gate on not building it. Is this true for all gdb versions we support ? We currently support 8.2, 8.3 and 9.2. Best regards, Thomas
Hi Thomas, On 12/4/20 12:13 AM, Thomas Petazzoni wrote: > Hello, > > On Thu, 3 Dec 2020 17:45:49 -0800 > Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote: > >> This reverts commit 44a9babcc67cd011e957ba9fd1cf741891957c12. >> >> As of Buildroot 2020.11 (glibc build of qemu_riscv64_virt_defconfig), >> cross-gdb for RISCV buildis fine and can also attach to a qemu >> instance, so remove the gate on not building it. > Is this true for all gdb versions we support ? We currently support > 8.2, 8.3 and 9.2. My working setup has gdb 8.3 and I just tested 8.2 works well too - I'm guessing 9.2 should be fine. riscv64-softmmu/qemu-system-riscv64 -M virt -nographic -bios images/fw_jump.elf -kernel images/Image -append "root=/dev/vda ro" -drive file=images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -s -S ./host/usr/bin/riscv64-linux-gdb GNU gdb (GDB) 8.2.1 Copyright (C) 2018 Free Software Foundation, Inc. (gdb) file build/linux-5.4.58/vmlinux (gdb) b start_kernel Breakpoint 1 at 0xffffffe00000070e (gdb) target remote :1234 Remote debugging using :1234 warning: Target-supplied registers are not supported by the current architecture 0x0000000000001000 in ?? () (gdb) c Continuing. Breakpoint 1, 0xffffffe00000070c in start_kernel () (gdb) si 0xffffffe00000070e in start_kernel () -Vineet
On Thu, Dec 3, 2020 at 5:45 PM Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote: > > This reverts commit 44a9babcc67cd011e957ba9fd1cf741891957c12. > > As of Buildroot 2020.11 (glibc build of qemu_riscv64_virt_defconfig), > cross-gdb for RISCV buildis fine and can also attach to a qemu > instance, so remove the gate on not building it. > > Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > package/gdb/Config.in | 3 --- > package/gdb/Config.in.host | 1 - > 2 files changed, 4 deletions(-) > > diff --git a/package/gdb/Config.in b/package/gdb/Config.in > index 48ec3e0202ac..c90d47cf0de6 100644 > --- a/package/gdb/Config.in > +++ b/package/gdb/Config.in > @@ -20,8 +20,6 @@ config BR2_PACKAGE_GDB > depends on BR2_PACKAGE_GDB_ARCH_SUPPORTS > depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 > depends on BR2_INSTALL_LIBSTDCPP > - # no gdbserver on riscv > - select BR2_PACKAGE_GDB_DEBUGGER if BR2_riscv > # When the external toolchain gdbserver is copied to the > # target, we don't allow building a separate gdbserver. The > # one from the external toolchain should be used. > @@ -48,7 +46,6 @@ if BR2_PACKAGE_GDB > config BR2_PACKAGE_GDB_SERVER > bool "gdbserver" > depends on !BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY > - depends on !BR2_riscv > help > Build the gdbserver stub to run on the target. > A full gdb is needed to debug the progam. > diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host > index 4b868e22556b..199f1c72b001 100644 > --- a/package/gdb/Config.in.host > +++ b/package/gdb/Config.in.host > @@ -5,7 +5,6 @@ config BR2_PACKAGE_HOST_GDB_ARCH_SUPPORTS > depends on !BR2_microblaze > depends on !BR2_nios2 > depends on !BR2_or1k > - depends on !BR2_riscv > depends on !BR2_nds32 > > comment "Host GDB Options" > -- > 2.25.1 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Hello, On Thu, 3 Dec 2020 17:45:49 -0800 Vineet Gupta <Vineet.Gupta1@synopsys.com> wrote: > This reverts commit 44a9babcc67cd011e957ba9fd1cf741891957c12. > > As of Buildroot 2020.11 (glibc build of qemu_riscv64_virt_defconfig), > cross-gdb for RISCV buildis fine and can also attach to a qemu > instance, so remove the gate on not building it. > > Signed-off-by: Vineet Gupta <vgupta@synopsys.com> I am sorry, but I don't see how this can work. RISC-V support in gdbserver was only added in upstream gdb in commit bf84f7066626c78884436e1c39fb60f04c665f21, which first appeared in gdb 10.1. And indeed, when I build: BR2_riscv=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.net/toolchains/tarballs/br-riscv64-musl-2020.02.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_9=y BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_19=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y BR2_TOOLCHAIN_EXTERNAL_CXX=y BR2_PACKAGE_HOST_GDB=y BR2_INIT_NONE=y BR2_SYSTEM_BIN_SH_NONE=y # BR2_PACKAGE_BUSYBOX is not set BR2_PACKAGE_GDB=y # BR2_TARGET_ROOTFS_TAR is not set It fails to build gdbserver, with: Error: target not supported by gdbserver. However, if I build: BR2_riscv=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.net/toolchains/tarballs/br-riscv64-musl-2020.02.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_9=y BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_19=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y BR2_TOOLCHAIN_EXTERNAL_CXX=y BR2_PACKAGE_HOST_GDB=y BR2_GDB_VERSION_10=y BR2_INIT_NONE=y BR2_SYSTEM_BIN_SH_NONE=y # BR2_PACKAGE_BUSYBOX is not set BR2_PACKAGE_GDB=y # BR2_TARGET_ROOTFS_TAR is not set which uses gdb 10.x, then indeed, the gdbserver configure script recognizes RISC-V as a supported CPU architecture, but it fails to build with: ../../gdbserver/linux-riscv-low.cc: In function ‘void riscv_fill_fpregset(regcache*, void*)’: ../../gdbserver/linux-riscv-low.cc:140:19: error: ‘ELF_NFPREG’ was not declared in this scope; did you mean ‘ELF_NGREG’? 140 | for (i = 0; i < ELF_NFPREG - 1; i++, regbuf += flen) | ^~~~~~~~~~ | ELF_NGREG ../../gdbserver/linux-riscv-low.cc: In function ‘void riscv_store_fpregset(regcache*, const void*)’: ../../gdbserver/linux-riscv-low.cc:156:19: error: ‘ELF_NFPREG’ was not declared in this scope; did you mean ‘ELF_NGREG’? 156 | for (i = 0; i < ELF_NFPREG - 1; i++, regbuf += flen) | ^~~~~~~~~~ | ELF_NGREG Note: this is with a musl toolchain, it is possible that it builds fine with a glibc toolchain. But regardless of that, RISC-V support in gdbserver only appeared in gdb 10.x, so I don't see how your patch could have worked, as we only introduced gdb 10.x support in Buildroot yesterday. Could you clarify ? Best regards, Thomas
Hi Thomas, On 12/30/20 2:35 PM, Thomas Petazzoni wrote: > Hello, > > On Thu, 3 Dec 2020 17:45:49 -0800 > Vineet Gupta<Vineet.Gupta1@synopsys.com> wrote: > >> This reverts commit 44a9babcc67cd011e957ba9fd1cf741891957c12. >> >> As of Buildroot 2020.11 (glibc build of qemu_riscv64_virt_defconfig), >> cross-gdb for RISCV buildis fine and can also attach to a qemu >> instance, so remove the gate on not building it. >> >> Signed-off-by: Vineet Gupta<vgupta@synopsys.com> > I am sorry, but I don't see how this can work. RISC-V support in > gdbserver was only added in upstream gdb in commit > bf84f7066626c78884436e1c39fb60f04c665f21, which first appeared in gdb > 10.1. > > And indeed, when I build: > > BR2_riscv=y > BR2_TOOLCHAIN_EXTERNAL=y > BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y > BR2_TOOLCHAIN_EXTERNAL_URL="https://urldefense.com/v3/__http://autobuild.buildroot.net/toolchains/tarballs/br-riscv64-musl-2020.02.tar.bz2__;!!A4F2R9G_pg!IMmgVQqsgsBbM7Snzr0Ck153bU3q4JemVARBT3hfaRonq8Vy9HduoagpFw94R_gCUN_sqw$ > " > BR2_TOOLCHAIN_EXTERNAL_GCC_9=y > BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_19=y > BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y > BR2_TOOLCHAIN_EXTERNAL_CXX=y > BR2_PACKAGE_HOST_GDB=y > BR2_INIT_NONE=y > BR2_SYSTEM_BIN_SH_NONE=y > # BR2_PACKAGE_BUSYBOX is not set > BR2_PACKAGE_GDB=y > # BR2_TARGET_ROOTFS_TAR is not set > > It fails to build gdbserver, with: > > Error: target not supported by gdbserver. > > However, if I build: > > BR2_riscv=y > BR2_TOOLCHAIN_EXTERNAL=y > BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y > BR2_TOOLCHAIN_EXTERNAL_URL="https://urldefense.com/v3/__http://autobuild.buildroot.net/toolchains/tarballs/br-riscv64-musl-2020.02.tar.bz2__;!!A4F2R9G_pg!IMmgVQqsgsBbM7Snzr0Ck153bU3q4JemVARBT3hfaRonq8Vy9HduoagpFw94R_gCUN_sqw$ > " > BR2_TOOLCHAIN_EXTERNAL_GCC_9=y > BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_19=y > BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y > BR2_TOOLCHAIN_EXTERNAL_CXX=y > BR2_PACKAGE_HOST_GDB=y > BR2_GDB_VERSION_10=y > BR2_INIT_NONE=y > BR2_SYSTEM_BIN_SH_NONE=y > # BR2_PACKAGE_BUSYBOX is not set > BR2_PACKAGE_GDB=y > # BR2_TARGET_ROOTFS_TAR is not set > > which uses gdb 10.x, then indeed, the gdbserver configure script > recognizes RISC-V as a supported CPU architecture, but it fails to > build with: > > ../../gdbserver/linux-riscv-low.cc: In function ‘void riscv_fill_fpregset(regcache*, void*)’: > ../../gdbserver/linux-riscv-low.cc:140:19: error: ‘ELF_NFPREG’ was not declared in this scope; did you mean ‘ELF_NGREG’? > 140 | for (i = 0; i < ELF_NFPREG - 1; i++, regbuf += flen) > | ^~~~~~~~~~ > | ELF_NGREG > ../../gdbserver/linux-riscv-low.cc: In function ‘void riscv_store_fpregset(regcache*, const void*)’: > ../../gdbserver/linux-riscv-low.cc:156:19: error: ‘ELF_NFPREG’ was not declared in this scope; did you mean ‘ELF_NGREG’? > 156 | for (i = 0; i < ELF_NFPREG - 1; i++, regbuf += flen) > | ^~~~~~~~~~ > | ELF_NGREG > > Note: this is with a musl toolchain, it is possible that it builds fine > with a glibc toolchain. > > But regardless of that, RISC-V support in gdbserver only appeared in > gdb 10.x, so I don't see how your patch could have worked, as we only > introduced gdb 10.x support in Buildroot yesterday. > > Could you clarify ? I never tried building gdbserver. My mistake was doing a full revert of the commit 44a9babcc67cd01. I only needed the following change to get host gdb working for riscv diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host @@ -7,6 +7,7 @@ config BR2_PACKAGE_HOST_GDB_ARCH_SUPPORTS - depends on !BR2_riscv In the end my config had following GDB related items: BR2_PACKAGE_GDB_ARCH_SUPPORTS=y BR2_PACKAGE_GDB=y # BR2_PACKAGE_GDB_SERVER is not set BR2_PACKAGE_GDB_DEBUGGER=y # BR2_PACKAGE_GDB_TUI is not set And with that I got the host gdb to build and actually connect to qemu which I captured in [1] As for the issue at hand, guess the patch needs to be adjusted to not touch gdbserver fragment. Or perhaps it is all moot point now given enabling gdbserver would do that anyways (or already did). Thx, -Vineet [1] http://lists.busybox.net/pipermail/buildroot/2020-December/297825.html
diff --git a/package/gdb/Config.in b/package/gdb/Config.in index 48ec3e0202ac..c90d47cf0de6 100644 --- a/package/gdb/Config.in +++ b/package/gdb/Config.in @@ -20,8 +20,6 @@ config BR2_PACKAGE_GDB depends on BR2_PACKAGE_GDB_ARCH_SUPPORTS depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 depends on BR2_INSTALL_LIBSTDCPP - # no gdbserver on riscv - select BR2_PACKAGE_GDB_DEBUGGER if BR2_riscv # When the external toolchain gdbserver is copied to the # target, we don't allow building a separate gdbserver. The # one from the external toolchain should be used. @@ -48,7 +46,6 @@ if BR2_PACKAGE_GDB config BR2_PACKAGE_GDB_SERVER bool "gdbserver" depends on !BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY - depends on !BR2_riscv help Build the gdbserver stub to run on the target. A full gdb is needed to debug the progam. diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host index 4b868e22556b..199f1c72b001 100644 --- a/package/gdb/Config.in.host +++ b/package/gdb/Config.in.host @@ -5,7 +5,6 @@ config BR2_PACKAGE_HOST_GDB_ARCH_SUPPORTS depends on !BR2_microblaze depends on !BR2_nios2 depends on !BR2_or1k - depends on !BR2_riscv depends on !BR2_nds32 comment "Host GDB Options"
This reverts commit 44a9babcc67cd011e957ba9fd1cf741891957c12. As of Buildroot 2020.11 (glibc build of qemu_riscv64_virt_defconfig), cross-gdb for RISCV buildis fine and can also attach to a qemu instance, so remove the gate on not building it. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> --- package/gdb/Config.in | 3 --- package/gdb/Config.in.host | 1 - 2 files changed, 4 deletions(-)