3.6.1. GDB step debug userland custom init
This is the userland debug setup most likely to work, since at init time there is only one userland executable running.
For executables from the userland/ directory such as userland/posix/count.c:
-
Shell 1:
./run --gdb-wait --kernel-cli 'init=/lkmc/posix/count.out'
-
Shell 2:
./run-gdb --userland userland/posix/count.c main
Alternatively, we could also pass the full path to the executable:
./run-gdb --userland "$(./getvar userland_build_dir)/posix/count.out" main
Path resolution is analogous to that of
./run --baremetal
.
Then, as soon as boot ends, we are left inside a debug session that looks just like what gdbserver
would produce.