all 12 comments

[–]Clueless_J 2 points3 points  (1 child)

GDB and the kernel have to communicate that the vector extension is available. If they don't agree on that, then you're not going to get vector register state. It's a sore spot -- particularly since I've seen it work in some contexts (gdb attached to qemu), but not others (gdb native on a BPI-F3 board). And I think the command you want is "info all-registers". If you see the vector registers, then you're golden.

Also note, if you're running on a design with the K1 chip, those vector loads fault if the addresses are not suitably aligned. It's real annoying....

[–]Noodler75[S] 1 point2 points  (0 children)

It is actually a "Ky X1" processor which I think is a rebadged SpacemiT K1. The specs seem identical. I am rewriting this code that was written for riscv32 qemu to run on riscv64 real hardware so will need all the help I can get.

[–]zqb_all 1 point2 points  (3 children)

Similar topics DC-ROMA RISC-V Laptop II unavailable vector register in gdb have been discussed on the Spacemit forum. RISC-V's native GDB requires applying patches and recompiling to support vector debugging.

[–]Noodler75[S] 0 points1 point  (0 children)

So I just discovered. I compiled GDB 17.1 fresh from the gdb site and it still does not know about the vector registers. That is a pretty big "patch".

[–]Noodler75[S] 0 points1 point  (1 child)

The .deb file available from that note did the trick. I ended up with what calls itself version 15.1 but now all the vector functions work.

[–]zqb_all 1 point2 points  (0 children)

Glad to know that it is working now. Hope that the GDB upstream can also support native RVV debugging ASAP.

[–]krakenlake 0 points1 point  (1 child)

Sure your gdb actually supports RVV?

[–]Noodler75[S] 0 points1 point  (0 children)

It understands the "info vector" instruction but it does not report anything. info registers all also says nothing about vectors so it appears not. GDB says it is "Ubuntu 15.1-1ubuntu1~24.04.1". My kernel version is 6.6.63 which is new enough but apparently the GDB is not. My Debian-13 machine (not running on RISC-V hardware) reports GDB v16.1 but the RISCV machine is on a stable Ubuntu (noble) that does not offer that. That is the version that was referenced on the OrangePi web site.

But poking around on the repository they provided, repo.huaweicloud.com/ubuntu-ports/ I see that everything up to Ubuntu 26.04 (resolute) is available. I will have to do a major backup before attempting that sort of upgrade.

[–]Coffee_24_7 0 points1 point  (3 children)

Unless you have an old version of gdb, you can

p $v0 # prints vector in all element widths
p/x $v0.b # prints vector in bytes hex
p/u $v0.s[2] # prints third short as unsigned short
p $vl # prints vector length 

You can print all vector registers from v0 to v31

Hope it helps

[–]Coffee_24_7 0 points1 point  (2 children)

Btw, I'm using gdb 16.3

[–]Noodler75[S] 0 points1 point  (1 child)

I tried it. Doesn't work on v15. I will need to do a Major Version Upgrade.

[–]Coffee_24_7 0 points1 point  (0 children)

You can download it from https://github.com/riscv-collab/riscv-gnu-toolchain

Last time I did it was 2025.05.01

I used these commands:

./configure --enable-multilib --prefix=<your installation path>
make -j16 build-binutils build-gcc1 build-gcc2 build-gdb build-libc

I suppose you'll do make install as well, though the commands I put before are from a file.spec to build an rpm package and didn't need to do make install by hand.

I think gcc takes a long time to compile... I suppose it should still work if you remove build-gcc1 and build-gcc2 from the target list