I ran following commands.
$sudo qemu-system-x86_64 -kernel arch/x86_64/boot/bzImage -nographic -append "console=ttys0 nokaslr" -initrd ramdisk.img -m 512 --enable-kvm -cpu 127.0.0.1 -s -S &
[5] 19846
$gdb vmlinux
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from vmlinux...done.
(gdb) target remote 127.0.0.1:1234
127.0.0.1:1234: Connection timed out.
question from:
https://stackoverflow.com/questions/65877445/i-want-to-debug-kernel-using-gdb-which-printed-connection-timeout-please-help 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…