gdbstub: avoid busy loop while waiting for gdb
commit5819e3e072f41cbf81ad80d822a5c468a91f54e0
authorPeter Wu <peter@lekensteyn.nl>
Sun, 5 Jun 2016 14:35:48 +0000 (5 16:35 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 6 Jun 2016 10:15:54 +0000 (6 11:15 +0100)
treed1da050ae4b9e78f1b0fbfd06f10b0934d7d9a39
parentde5dca1b792ada25c29a95c8f84e01f4300aef9c
gdbstub: avoid busy loop while waiting for gdb

While waiting for a gdb response, or while sending an acknowledgement
there is not much to do, so do not mark the socket as non-blocking to
avoid a busy loop while paused at gdb. This only affects the user-mode
emulation (qemu-arm -g 1234 ./a.out).

Note that this issue was reported before at
https://lists.nongnu.org/archive/html/qemu-devel/2013-02/msg02277.html.

While at it, close the gdb client fd on EOF or error while reading.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
gdbstub.c