Open nbosio1001 opened 1 year ago
When you run make qemu-gdb, you are debugging the kernel, not user processes like user/_primes.
You might want to take a look at trampoline.S, which has a 'sret' instruction for returning to user mode. I think after 'sret' you won't be able to debug into user process and you will get back to gdb once you are back somewhere in the kernel, (probably via a syscal or timer interrupt).
In GDB, use "b trap.c:128" to break before jumping to userret. Then use "si" to step by instruction, until you reach to 'sret'. after that you will see that GDB sill not step from supervisor mode into user mode.
I am working on primes.c and I can't get my gdb environment setup so I can debug the code visually. I have the same .gdbinit.tmpl-riscv file and put $U/_primes\ in my Makefile. I am also running on a Raspberry Pi OS.
I run
make qemu-gdb
and then rungdb-multiarch user/_primes
. After I runlay next
, press enter and get the gdb environment in the picture.