mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.52k stars 2.37k forks source link

`gdb run` doesn't work #235

Closed Risc-lt closed 3 months ago

Risc-lt commented 3 months ago

I'm trying to complete my lab7 and after calling gdb-multiarch to debug, it broke down and print some warnings below.

(gdb) file kernel/kernel
Reading symbols from kernel/kernel...
(gdb) b kerneltrap
Breakpoint 1 at 0x80002c54: file kernel/trap.c, line 135.
(gdb) r
Starting program: /mnt/d/Code/Files/xv6-labs-2020/kernel/kernel
/build/gdb-ktlO15/gdb-9.2/gdb/i387-tdep.c:592: internal-error: void i387_supply_fxsave(regcache*, int, const void*): Assertion `tdep->st0_regnum >= I386_ST0_REGNUM' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

/build/gdb-ktlO15/gdb-9.2/gdb/i387-tdep.c:592: internal-error: void i387_supply_fxsave(regcache*, int, const void*): Assertion `tdep->st0_regnum >= I386_ST0_REGNUM' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n

The current workspace is OS: Ubuntu 20.04.6 LTS on Windows 10 x86_64 and /mnt/d/Code/Files/xv6-labs-2020/

I'm wondering whether it's caused by some lacking in system support in xv6 itself or it's my careless fault after editing. And I've searched for many solutions but none of them works. I'll appreciate it very much if you can answer my question.

Risc-lt commented 3 months ago

Sorry for interruption. I've solved this problem. The problem is that I've forgotten to provide the program with any host.

Just add one more command: target remote localhost:26000. And it'll work.