seanhalle
seanhalle

Reputation: 1013

GDB on RISC-V QEMU

We are porting OpenJDK to RISC-V. We're at the point that the interpreter builds. We need to debug it, using GDB. However, we haven't been able to find a working GDB that works with RISC-V QEMU. Any help would be much appreciated.

Upvotes: 4

Views: 1163

Answers (1)

Palmer Dabbelt
Palmer Dabbelt

Reputation: 1068

It depends on what you mean by "GDB that works with QEMU". There's three use cases here

  • Running system-mode QEMU, trying to debug a machine-mode or supervisor-mode program (like the Linux kernel, for example). For this, you should be able to use the upstream RISC-V GDB port attached to QEMU's built-in GDB stup to debug like normal.
  • Running user-mode QEMU, trying to debug a user-mode program. I've never done this before, but I think you can still use QEMU's built-in GDB stub and connect with the upstream GDB.
  • Running system-mode QEMU, trying to debug a user-mode program (like OpenJDK, for example). In this case QEMU doesn't actually factor in to the equation, as you're really just looking for a standard Linux GDB port. Both our Linux and GDB ports are currently buggy when it comes to native debugging, but you should be able to take the latest upstream versions of both and at least get some work done. There's lots of issues with drivers in our upstream Linux port, but if you're just using QEMU's virt machine then you should be good to go.

I'm not actually sure StackOverflow is the best place to ask this question, as the answer will be obsolete pretty much as soon as it's been asked.

Upvotes: 2

Related Questions