I am new to kernel debugging using gdb. Few days back I read that we can turn on KGDB which is a gdb server running in the kernel . We can connect to this gdbserver on kernel using the gdb client on host machine used for development.
Today I came across a different solution where we run the kernel on a virtual environment on qemu. There we do not turn on the KGDB still we can connect to the qemu using gdb client. I think "gdbstub" acts as the gdbserver here and gdb client connects to QEMU and not the kernel. Is my understanding correct? This setup is somewhat similar to using a JTAG to control the cpu rather than the kernel. Is this correct?