static int get_char(GDBState *s)

{

    uint8_t ch;

    int ret;



    for(;;) {

        ret = qemu_recv(s->fd, &ch, 1, 0);

        if (ret < 0) {

            if (errno == ECONNRESET)

                s->fd = -1;

            if (errno != EINTR && errno != EAGAIN)

                return -1;

        } else if (ret == 0) {

            close(s->fd);

            s->fd = -1;

            return -1;

        } else {

            break;

        }

    }

    return ch;

}

static int get_char(GDBState *s)

{

    uint8_t ch;

    int ret;



    for(;;) {

        ret = qemu_recv(s->fd, &ch, 1, 0);

        if (ret < 0) {

            if (errno == ECONNRESET)

                s->fd = -1;

            if (errno != EINTR && errno != EAGAIN)

                return -1;

        } else if (ret == 0) {

            close(s->fd);

            s->fd = -1;

            return -1;

        } else {

            break;

        }

    }

    return ch;

}

static int FUNC_0(GDBState *VAR_0)

{

    uint8_t ch;

    int VAR_1;



    for(;;) {

        VAR_1 = qemu_recv(VAR_0->fd, &ch, 1, 0);

        if (VAR_1 < 0) {

            if (errno == ECONNRESET)

                VAR_0->fd = -1;

            if (errno != EINTR && errno != EAGAIN)

                return -1;

        } else if (VAR_1 == 0) {

            close(VAR_0->fd);

            VAR_0->fd = -1;

            return -1;

        } else {

            break;

        }

    }

    return ch;

}

static int FUNC_0(GDBState *VAR_0)
{ uint8_t ch; int VAR_1; for(;;) { VAR_1 = qemu_recv(VAR_0->fd, &ch, 1, 0); if (VAR_1 < 0) { if (errno == ECONNRESET)
VAR_0->fd = -1; if (errno != EINTR && errno != EAGAIN)
return -1; } else if (VAR_1 == 0) { close(VAR_0->fd); VAR_0->fd = -1; return -1; } else { break; } } return ch; }