Has anyone been able to debug an OS running in qemu with gdb on a windows system? Here's the problem I'm having:
I have a simple kernel running in qemu. It's run with 'C:\cygwin\qemu\qemu.exe -s -S -L C:\cygwin\qemu -cdrom kernel.iso'. According to the wiki (the kernel debugging page) and qemu docs, adding the -s flag will run a gdb stub inside qemu allowing gdb remote debugging via port :1234.
After the kernel is running, in another Cygwin window, I type 'gdb' then 'target remote :1234'. After waiting a bit, I get ':1234 Connection timed out.'.
Any ideas? I've verified that the qemu process is indeed listening on 1234. I've search here and elsewhere and all I was able to come up with is this - http://www.cygwin.com/ml/cygwin/2007-04/msg00563.html - saying the gdb remote server may not be supported in Cygwin.
Version info:
windows 8
Cygwin 1.7.20-1
gdb 7.6.50-2 (Cygwin install)
qemu prebuilt windows binary (unable to find version)
Thanks!
Cygwin, Qemu, and gdb
-
- Member
- Posts: 595
- Joined: Mon Jul 05, 2010 4:15 pm
Re: Cygwin, Qemu, and gdb
On gdb side you should use "target remote localhost:1234" if the extra "localhost" matters.
I've discovered that localhost seems to mean different addresses on different versions of Windows. Because of this I had to specify the address when running Qemu. I added "-gdb tcp:127.0.0.1:1234" to Qemu options.
I've discovered that localhost seems to mean different addresses on different versions of Windows. Because of this I had to specify the address when running Qemu. I added "-gdb tcp:127.0.0.1:1234" to Qemu options.
Re: Cygwin, Qemu, and gdb
Wow, thanks: Using -gdb tcp:127.0.0.1:1234 instead of -s worked!
Re: Cygwin, Qemu, and gdb
really nice.OSwhatever wrote:I added "-gdb tcp:127.0.0.1:1234" to Qemu options.
i love you.
i installed qemu by "sudo apt-get install qemu", and this qemu can not be connected by gdb, just as you wrote. I work on ubuntu15.04.
PS: the -S option is still necessary, for me.
PS: qemu doesn't quit when i CTRL-C the debug session in gdb terminal, a little buggy.