From patchwork Thu Aug 13 16:35:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 52398 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 8003322EC6 for ; Thu, 13 Aug 2015 16:35:59 +0000 (UTC) Received: by lbcli1 with SMTP id li1sf18278457lbc.2 for ; Thu, 13 Aug 2015 09:35:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=4OW/LMvR1ATtFmzvchh6nfe696sJbfZ5glEoqZwKj3s=; b=U51M0TRQiUnY9eyImdLFea33qo/lWa8IbboEczJXiw54mY35SrtJt8cXAHPRdPjsAl Ua13srrfk2OfRX/EsN2hVdAMPgFgp7Rhp6ZoLRvT3oqFInYKIWURtQheqODANKgQWSwD 6SYEmW5hkk4xb148J74u9aG3YZhDGa5VGMmBzg0gXRNfI7brQELn9qw7vzJBdT5HcErQ z1IxBWyKooiSVeJhz7mQjUec2sX8Fp63uQuUw6dLqvRibUUrCnhSmvqdOto1SXMDekS/ Fmt67fxcwBGrep8K9/aoZpHEUVZ0mAgfeHdUH4jnpnggphj6FeJBdE26tspoylHaNRli qYEA== X-Gm-Message-State: ALoCoQkKnm5RvQL86vdcK+V5lwNsVeGzT42SOj31Y6wdfoVilithmlELpnrsX2J/05AHpASTsVWx X-Received: by 10.112.161.35 with SMTP id xp3mr8469736lbb.2.1439483758540; Thu, 13 Aug 2015 09:35:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.101 with SMTP id z5ls190539laz.65.gmail; Thu, 13 Aug 2015 09:35:58 -0700 (PDT) X-Received: by 10.112.205.161 with SMTP id lh1mr37291753lbc.43.1439483758271; Thu, 13 Aug 2015 09:35:58 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id ll8si3090218lac.15.2015.08.13.09.35.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 09:35:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbbsx3 with SMTP id sx3so30302945lbb.0 for ; Thu, 13 Aug 2015 09:35:57 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr36684115lbc.41.1439483757838; Thu, 13 Aug 2015 09:35:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1052659lba; Thu, 13 Aug 2015 09:35:56 -0700 (PDT) X-Received: by 10.60.144.196 with SMTP id so4mr18618056oeb.66.1439483748890; Thu, 13 Aug 2015 09:35:48 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id z10si1948336obs.83.2015.08.13.09.35.47 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 13 Aug 2015 09:35:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZPvTl-0007UO-J0; Thu, 13 Aug 2015 17:35:45 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Christopher Covington Subject: [PATCH 3/9] gdbstub: Implement gdb_do_syscallv() Date: Thu, 13 Aug 2015 17:35:39 +0100 Message-Id: <1439483745-28752-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1439483745-28752-1-git-send-email-peter.maydell@linaro.org> References: <1439483745-28752-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Implement a variant of the existing gdb_do_syscall() which takes a va_list. Signed-off-by: Peter Maydell --- gdbstub.c | 14 ++++++++++---- include/exec/gdbstub.h | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index ffe7e6e..eee9b25 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1301,9 +1301,8 @@ send_packet: %x - target_ulong argument printed in hex. %lx - 64-bit argument printed in hex. %s - string pointer (target_ulong) and length (int) pair. */ -void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) +void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va) { - va_list va; char *p; char *p_end; target_ulong addr; @@ -1317,7 +1316,6 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) #ifndef CONFIG_USER_ONLY vm_stop(RUN_STATE_DEBUG); #endif - va_start(va, fmt); p = s->syscall_buf; p_end = &s->syscall_buf[sizeof(s->syscall_buf)]; *(p++) = 'F'; @@ -1351,7 +1349,6 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) } } *p = 0; - va_end(va); #ifdef CONFIG_USER_ONLY put_packet(s, s->syscall_buf); gdb_handlesig(s->c_cpu, 0); @@ -1366,6 +1363,15 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) #endif } +void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) +{ + va_list va; + + va_start(va, fmt); + gdb_do_syscallv(cb, fmt, va); + va_end(va); +} + static void gdb_read_byte(GDBState *s, int ch) { int i, csum; diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 05f57c2..d9e8cf7 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -14,7 +14,34 @@ typedef void (*gdb_syscall_complete_cb)(CPUState *cpu, target_ulong ret, target_ulong err); +/** + * gdb_do_syscall: + * @cb: function to call when the system call has completed + * @fmt: gdb syscall format string + * ...: list of arguments to interpolate into @fmt + * + * Send a GDB syscall request. This function will return immediately; + * the callback function will be called later when the remote system + * call has completed. + * + * @fmt should be in the 'call-id,parameter,parameter...' format documented + * for the F request packet in the GDB remote protocol. A limited set of + * printf-style format specifiers is supported: + * %x - target_ulong argument printed in hex + * %lx - 64-bit argument printed in hex + * %s - string pointer (target_ulong) and length (int) pair + */ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...); +/** + * gdb_do_syscallv: + * @cb: function to call when the system call has completed + * @fmt: gdb syscall format string + * @va: arguments to interpolate into @fmt + * + * As gdb_do_syscall, but taking a va_list rather than a variable + * argument list. + */ +void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va); int use_gdb_syscalls(void); void gdb_set_stop_cpu(CPUState *cpu); void gdb_exit(CPUArchState *, int);