rohanrhu / gdb-frontend

☕ GDBFrontend is an easy, flexible and extensible gui debugger.
GNU General Public License v3.0
2.86k stars 100 forks source link

Not support risc-v #52

Closed zzdts closed 2 years ago

zzdts commented 2 years ago

Has any plan to support risc-v arch?

rohanrhu commented 2 years ago

Hi @zzdts,

You can try building GDB for RISC-V target with Python 3 support and use GDBFrontend on RISC-V device or run gdbserver on it and connect.

If you run GDBFrontend on RISC-V device, it already provides you a way to use remotely. If you use gdbserver, you can use connect from GDBFrontend.

We have a tutorial and script to build GDB for ARM target: https://rohanrhu.github.io/gdb-frontend/tutorials/embedded-debugging/

I think RISC-V building should not be much different, you can try something like this:

cd ~
wget https://ftp.gnu.org/gnu/gdb/gdb-11.1.tar.xz
tar zxvf gdb-11.1.tar.gz
mkdir gdb-11.1-build
cd gdb-11.1-build

# Build with Python3 support to RISC-V???
# ../gdb-11.1/configure --with-python=/usr/bin/python3 --host=riscv64-unknown-linux-gnu --target=riscv64-unknown-linux-gnu

# Build for using gdbserver on RISC-V
../gdb-11.1/configure --host=riscv64-unknown-linux-gnu --target=riscv64-unknown-linux-gnu

gnu --enable-interwork --enable-multilib
make

Somehow, you should link Python3 for RISC-V arch to run GDBFrontend on RISC-V. We have to find a way for that.

After building GDB for using gdbserver on RISC-V, you can build GDB also for your host:

../gdb-11.1/configure --with-python=/usr/bin/python3 --target=riscv64-unknown-linux-gnu

If you are not running Linux on RISC-V, you can take a look at this tutorial: https://elrobotista.com/en/posts/stm32-debug-linux/

Looks like you can use OpenOCD with RISC-V: https://github.com/riscv/riscv-openocd

If you try something succesful, please contribute with a tutorial and/or a build script.

zzdts commented 2 years ago

Oh, that's my fault. I used qemu run a riscv program: $ qemu-system-riscv64 -M virt -kernel kernel.img -bios none -serial stdio -s -S & $ gdbfrontend So i get errors: "warning: while parsing target description (at line 1): Target description specified unknown architecture "riscv:rv64""

If i specify gdb cmd that support riscv, gdbfrontend works well. The correct cmd to work with riscv : $ gdbfrontend -g /usr/bin/gdb-multiarch

rohanrhu commented 2 years ago

If i specify gdb cmd that support riscv, gdbfrontend works well. The correct cmd to work with riscv : $ gdbfrontend -g /usr/bin/gdb-multiarch

It would be great if you could write a tutorial in documentation/ or add a quick notice to README.md about the steps you followed to debug RISC-V with QUEMU and GDBFrontend.

documentation/ directory automatically deploys to https://rohanrhu.github.io/gdb-frontend/.

I wonder about some Linux distros could not have gdb-multiarch in their pakcage repositories. It would be great if you could also give all steps you followed to install it.