select fails on windows because a non-socket fd is in the rfds set

Bug #916720 reported by Arie
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
QEMU
Expired
Undecided
Unassigned

Bug Description

The select call in file main_loop.c at line 460 fails on windows because a non-socket fd is in the rfds set. As a result, gdb remote connections will never be accepted by qemu. The select function returns with -1. WSAGetLastError returns code 10038 (WSAENOTSOCK).

I start qemu as follows:
qemu-system-arm -cpu cortex-m3 -M lm3s6965evb -nographic -monitor null -serial null -semihosting -kernel test1.elf -S -gdb tcp:127.0.0.1:2200

qemu is configure with:
CFLAGS="-O4 -march=i686"
configure --target-list="i386-softmmu arm-softmmu sparc-softmmu ppc-softmmu" --prefix=/home/qemu/install --cc=mingw32-gcc --host-cc=mingw32-gcc --audio-drv-list="dsound sdl" --audio-card-list="ac97 es1370 sb16 cs4231a adlib gus"

Revision history for this message
Paolo Bonzini (bonzini) wrote :

Do you know where the non-socket fd comes from? I have some patches to improve the situation on Win32 for the main loop, I'll send them next week to the mailing list.

Revision history for this message
Arie (arie-7) wrote :

It is added to the list by glib_select_fill. Other than that I couldn't find out what the fd is for.

I forgot to add the symptoms of the problem, so i'll add them now so people can google them.
target remote tcp:127.0.0.1:2200
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Malformed response to offset query, timeout

Revision history for this message
tombo (tbo-t) wrote :

I'm also getting this error. Both on my own compile version 1.0 and on the version from http://lassauge.free.fr/qemu/
I have not been able to find a workaround for getting gdb to work. Does anybody knows a patch or a workaround?

Revision history for this message
Michael Rolnik (mrolnik) wrote :

it seems that g_main_context_default creates a semaphore which is added into rfds passed to glib_select_fill function, that's why select fails.

Revision history for this message
Paolo Bonzini (bonzini) wrote :
Paolo Bonzini (bonzini)
Changed in qemu:
status: New → Fix Committed
Revision history for this message
Meador Inge (meadori) wrote :

I am still seeing the symptoms that Arie pointed out:

Remote debugging using :1234
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Malformed response to offset query, timeout

I started QEMU like:

arm-none-eabi-qemu-system.exe -gdb tcp:127.0.0.1:1234,nowait,nodelay,server,ipv4 -S -semihosting -kernel hello.out

This was with an ARM EABI system emulator that I built from today's mainline. From a brief look it seems like QEMU is going into 'g_poll' and never coming out.

Revision history for this message
Thomas Huth (th-huth) wrote :

Triaging old bug tickets... can you still reproduce this issue with the latest version of QEMU? Or could we close this ticket nowadays?

Changed in qemu:
status: Fix Committed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for QEMU because there has been no activity for 60 days.]

Changed in qemu:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.