Toolchain issue

“tst” (a simple C “hello world”) is built without error with:

/usr/local/opt/riscv-gnu-toolchain/bin/riscv64-unknown-elf-gcc -g tst.c -o tst

To debug:

riscv64-unknown-elf-gdb tst

Output error:

Python Exception <type ‘exceptions.ImportError’> No module named gdb:
riscv64-unknown-elf-gdb: warning:
Could not load the Python gdb module from `/usr/local/Cellar/riscv-gnu-toolchain/master/share/gdb/python’.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type “show copying” and “show warranty” for details.
This GDB was configured as “–host=x86_64-apple-darwin20.3.0 --target=riscv64-unknown-elf”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from tst…
I’m sorry, Dave, I can’t do that. Symbol format `elf64-littleriscv’ unknown.
(gdb)

The /usr/local/Cellar/riscv-gnu-toolchain/master/share directory hold only two subdirectories: “info” and “man”
python version 2.7 and 3.8 are installed

There are only two “gdb” folders (very thin content) in the OS drive:
/usr/local/Cellar/isl/0.24/share/gdb (hold auto-load folder holding libisl.23.dylib-gdb file)
/usr/local/Cellar/riscv-gnu-toolchain/master/include/gdb (hold jit-reader)

spike -d pk tst

work fine but only step in assembly

Big Sur on MacPro 2013

Any suggestion will be appreciate.

See
https://sourceware.org/bugzilla/show_bug.cgi?id=26949
Gdb needs to be rebuilt from patched sources.

The python stuff is useful for pretty printing C++ types, and for adding commands to gdb. Odd that it is missing, but it might be related to this system header include problem. Gdb can work fine without python if you don’t need the C++ pretty printing support.

Where is this patched sources ?

I use only C and assembler.

Thank you.

The riscv-gnu-toolchain fix was added here
https://github.com/riscv-collab/riscv-gnu-toolchain/pull/868

If you built your own toolchain, you need to update to sources with a fix. If you downloaded a toolchain, you should file a bug report with the people who built it.

Hum, not sure to understand your instructions.
I must admit that I never use github.
I was able to work with gcc/gdb directly on Unmatched board (Ubuntu) but my main tool to develop is Xcode.
My goal is to try cross-compile-debug on my Mac since I have a very limited experience with Linux.

Where can I download the toolchain ?

I can I do it ?

I really appreciate your patience…

I don’t know where you got your toolchain from, so I can’t offer info on how to submit a bug report to them.

SiFive builds a toolchain for MacOS, and GNU MCU Eclipse supports MacOS also. You can find links to them on the sifive.com/software web page. You could try them instead of the toolchain you are using.