void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)

{

    va_list va;

    char buf[256];

    char *p;

    target_ulong addr;

    uint64_t i64;

    GDBState *s;



    s = gdbserver_state;

    if (!s)

        return;

    gdb_current_syscall_cb = cb;

    s->state = RS_SYSCALL;

#ifndef CONFIG_USER_ONLY

    vm_stop(EXCP_DEBUG);

#endif

    s->state = RS_IDLE;

    va_start(va, fmt);

    p = buf;

    *(p++) = 'F';

    while (*fmt) {

        if (*fmt == '%') {

            fmt++;

            switch (*fmt++) {

            case 'x':

                addr = va_arg(va, target_ulong);

                p += snprintf(p, &buf[sizeof(buf)] - p, TARGET_FMT_lx, addr);

                break;

            case 'l':

                if (*(fmt++) != 'x')

                    goto bad_format;

                i64 = va_arg(va, uint64_t);

                p += snprintf(p, &buf[sizeof(buf)] - p, "%" PRIx64, i64);

                break;

            case 's':

                addr = va_arg(va, target_ulong);

                p += snprintf(p, &buf[sizeof(buf)] - p, TARGET_FMT_lx "/%x",

                              addr, va_arg(va, int));

                break;

            default:

            bad_format:

                fprintf(stderr, "gdbstub: Bad syscall format string '%s'\n",

                        fmt - 1);

                break;

            }

        } else {

            *(p++) = *(fmt++);

        }

    }

    *p = 0;

    va_end(va);

    put_packet(s, buf);

#ifdef CONFIG_USER_ONLY

    gdb_handlesig(s->c_cpu, 0);

#else

    cpu_interrupt(s->c_cpu, CPU_INTERRUPT_EXIT);

#endif

}

void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)

{

    va_list va;

    char buf[256];

    char *p;

    target_ulong addr;

    uint64_t i64;

    GDBState *s;



    s = gdbserver_state;

    if (!s)

        return;

    gdb_current_syscall_cb = cb;

    s->state = RS_SYSCALL;

#ifndef CONFIG_USER_ONLY

    vm_stop(EXCP_DEBUG);

#endif

    s->state = RS_IDLE;

    va_start(va, fmt);

    p = buf;

    *(p++) = 'F';

    while (*fmt) {

        if (*fmt == '%') {

            fmt++;

            switch (*fmt++) {

            case 'x':

                addr = va_arg(va, target_ulong);

                p += snprintf(p, &buf[sizeof(buf)] - p, TARGET_FMT_lx, addr);

                break;

            case 'l':

                if (*(fmt++) != 'x')

                    goto bad_format;

                i64 = va_arg(va, uint64_t);

                p += snprintf(p, &buf[sizeof(buf)] - p, "%" PRIx64, i64);

                break;

            case 's':

                addr = va_arg(va, target_ulong);

                p += snprintf(p, &buf[sizeof(buf)] - p, TARGET_FMT_lx "/%x",

                              addr, va_arg(va, int));

                break;

            default:

            bad_format:

                fprintf(stderr, "gdbstub: Bad syscall format string '%s'\n",

                        fmt - 1);

                break;

            }

        } else {

            *(p++) = *(fmt++);

        }

    }

    *p = 0;

    va_end(va);

    put_packet(s, buf);

#ifdef CONFIG_USER_ONLY

    gdb_handlesig(s->c_cpu, 0);

#else

    cpu_interrupt(s->c_cpu, CPU_INTERRUPT_EXIT);

#endif

}

void FUNC_0(gdb_syscall_complete_cb VAR_0, const char *VAR_1, ...)

{

    va_list va;

    char VAR_2[256];

    char *VAR_3;

    target_ulong addr;

    uint64_t i64;

    GDBState *s;



    s = gdbserver_state;

    if (!s)

        return;

    gdb_current_syscall_cb = VAR_0;

    s->state = RS_SYSCALL;

#ifndef CONFIG_USER_ONLY

    vm_stop(EXCP_DEBUG);

#endif

    s->state = RS_IDLE;

    va_start(va, VAR_1);

    VAR_3 = VAR_2;

    *(VAR_3++) = 'F';

    while (*VAR_1) {

        if (*VAR_1 == '%') {

            VAR_1++;

            switch (*VAR_1++) {

            case 'x':

                addr = va_arg(va, target_ulong);

                VAR_3 += snprintf(VAR_3, &VAR_2[sizeof(VAR_2)] - VAR_3, TARGET_FMT_lx, addr);

                break;

            case 'l':

                if (*(VAR_1++) != 'x')

                    goto bad_format;

                i64 = va_arg(va, uint64_t);

                VAR_3 += snprintf(VAR_3, &VAR_2[sizeof(VAR_2)] - VAR_3, "%" PRIx64, i64);

                break;

            case 's':

                addr = va_arg(va, target_ulong);

                VAR_3 += snprintf(VAR_3, &VAR_2[sizeof(VAR_2)] - VAR_3, TARGET_FMT_lx "/%x",

                              addr, va_arg(va, int));

                break;

            default:

            bad_format:

                fprintf(stderr, "gdbstub: Bad syscall format string '%s'\n",

                        VAR_1 - 1);

                break;

            }

        } else {

            *(VAR_3++) = *(VAR_1++);

        }

    }

    *VAR_3 = 0;

    va_end(va);

    put_packet(s, VAR_2);

#ifdef CONFIG_USER_ONLY

    gdb_handlesig(s->c_cpu, 0);

#else

    cpu_interrupt(s->c_cpu, CPU_INTERRUPT_EXIT);

#endif

}

void FUNC_0(gdb_syscall_complete_cb VAR_0, const char *VAR_1, ...)
{ va_list va; char VAR_2[256]; char *VAR_3; target_ulong addr; uint64_t i64; GDBState *s; s = gdbserver_state; if (!s)
return; gdb_current_syscall_cb = VAR_0; s->state = RS_SYSCALL; #ifndef CONFIG_USER_ONLY
vm_stop(EXCP_DEBUG); #endif
s->state = RS_IDLE; va_start(va, VAR_1); VAR_3 = VAR_2; *(VAR_3++) = 'F'; while (*VAR_1) { if (*VAR_1 == '%') { VAR_1++; switch (*VAR_1++) { case 'x':
addr = va_arg(va, target_ulong); VAR_3 += snprintf(VAR_3, &VAR_2[sizeof(VAR_2)] - VAR_3, TARGET_FMT_lx, addr); break; case 'l':
if (*(VAR_1++) != 'x')
goto bad_format; i64 = va_arg(va, uint64_t); VAR_3 += snprintf(VAR_3, &VAR_2[sizeof(VAR_2)] - VAR_3, "%" PRIx64, i64); break; case 's':
addr = va_arg(va, target_ulong); VAR_3 += snprintf(VAR_3, &VAR_2[sizeof(VAR_2)] - VAR_3, TARGET_FMT_lx "/%x",
addr, va_arg(va, int)); break; default:
bad_format:
fprintf(stderr, "gdbstub: Bad syscall format string '%s'\n",
VAR_1 - 1); break; } } else { *(VAR_3++) = *(VAR_1++); } } *VAR_3 = 0; va_end(va); put_packet(s, VAR_2); #ifdef CONFIG_USER_ONLY
gdb_handlesig(s->c_cpu, 0); #else
cpu_interrupt(s->c_cpu, CPU_INTERRUPT_EXIT); #endif
}