1.Enable Debugging in QEMU: Start QEMU with debugging options enabled. You can use the -s and -S options to start QEMU in a paused state and listen for a debugger connection:
qemu-system-x86_64 -s -S -hda your_image.img
gdb
target remote localhost:1234