Debug custom xv6 code with gdb

I am making an OS class based on xv6 and I wrote a program that should run on it.

I know that I can debug kernel code with make qemu-gdb, but I'm not sure how to debug my own user program.

Say I want to debug cat, how would I do this?

thank

PS is there an xv6 tag? should this question even go here?

+5
source share
2 answers

file cat, break main,continue

semi reference launch and debug xv6

+5
source

From the top level of xv6:

  • Run the emulator in debug mode (except for X11): make qemu-nox-gdb

  • , :   gdb kernel , , main()

  • gdb: (gdb) target remote localhost:26000 26000 - TCP-, №1 ( ).

  • exec (gdb)file user_program

  • (gdb) break main (gdb) continue

  • ....

+5

All Articles