Move QEMU's gdbstub to another port with -gdb tcp::PORT
Use -gdb tcp::1235 to move QEMU 10.0's gdbstub off port 1234, and bind it to 127.0.0.1 so the unauthenticated debug port stays local.
-s is shorthand for -gdb tcp::1234, which is fine until two VMs run on one machine and the second one fails to bind. Spell the option out and change the port instead.
qemu-system-x86_64 -S -nographic -kernel bzImage \
-append "console=ttyS0 nokaslr" \
-gdb tcp:127.0.0.1:1235In another terminal, attach with the matching port:
gdb vmlinux -ex "target remote :1235"Remote debugging using :1235
0x000000000000fff0 in ?? ()The detail the shorthand hides is the bind address. tcp::1235, with the host left empty, listens on every interface, and the gdbstub has no authentication: anyone who can reach the port can read and write guest memory and registers. Writing 127.0.0.1 in the host slot keeps it on the loopback interface. That form is documented under -gdb in the QEMU invocation manual.
-S freezes the CPU at reset until gdb sends continue, which is why the stop address above is the x86 reset vector area. For kernel work, add nokaslr as shown, otherwise the symbols in vmlinux do not line up with the running addresses.