From patchwork Fri Sep 4 15:05:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 53122 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 4E83622E23 for ; Fri, 4 Sep 2015 15:22:38 +0000 (UTC) Received: by lbcao8 with SMTP id ao8sf7925509lbc.1 for ; Fri, 04 Sep 2015 08:22:37 -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:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=P24uqq9dlA7xOhSe2tgAfdizDR5A2WgAQjQvNR2vRpY=; b=MJa94s+iVydgq8qpYY/tSVc6MiBQZ73jPyAvwZYChXnZ7R3BilkjKrU2ZtgEHklaxy z9E60Ec7MX2cu1YsvE8RRS8q5Is/3PbFTPzPoXGV1AhOZ+MUjylHv36H23ofWHOO8Wyh zpp6SbzRYr5DZJ8EcFq/tXNomnBz9jQHpQJugkHx3FqlsoUsVx48C66FbNIoNY2w8ukH grPuBlJfVGYfYsAULE3TRmSBoWIJ1HwsLJbsDI4szfol4qHjJLmgDhfrkNMkQ4rBgUnP piai+UitGyNgRteI9pMIW9kU0bPHJe+yYpFOfyn03mAb8OpRbdzDk0Ay/4fxhwvmR8D+ azyQ== X-Gm-Message-State: ALoCoQnXdcxY41tu1f0FWL7iJTTSLQWLM15z7iPVg+/MUcWcBFinoQjuWx8DsbtQVQo8QJmkIVOu X-Received: by 10.180.90.106 with SMTP id bv10mr1244631wib.6.1441380157088; Fri, 04 Sep 2015 08:22:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.169 with SMTP id x9ls359953lad.74.gmail; Fri, 04 Sep 2015 08:22:36 -0700 (PDT) X-Received: by 10.152.8.169 with SMTP id s9mr4192089laa.3.1441380156919; Fri, 04 Sep 2015 08:22:36 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id o4si2583368lag.55.2015.09.04.08.22.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 08:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by laeb10 with SMTP id b10so15988671lae.1 for ; Fri, 04 Sep 2015 08:22:36 -0700 (PDT) X-Received: by 10.152.44.196 with SMTP id g4mr4289467lam.56.1441380156692; Fri, 04 Sep 2015 08:22:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp2055920lbb; Fri, 4 Sep 2015 08:22:35 -0700 (PDT) X-Received: by 10.140.238.195 with SMTP id j186mr6233796qhc.21.1441380154992; Fri, 04 Sep 2015 08:22:34 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 80si3144407qgj.52.2015.09.04.08.22.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 04 Sep 2015 08:22:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsoz-0006Jl-Ai for patch@linaro.org; Fri, 04 Sep 2015 11:22:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsZF-0000CY-73 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXsZ9-0000r9-7r for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:17 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsZ8-0000iE-WB for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:11 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZXsYu-0006Eq-Bf for qemu-devel@nongnu.org; Fri, 04 Sep 2015 16:05:56 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 4 Sep 2015 16:05:33 +0100 Message-Id: <1441379156-23939-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1441379156-23939-1-git-send-email-peter.maydell@linaro.org> References: <1441379156-23939-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 04/27] gdbstub: Implement gdb_do_syscallv() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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.215.51 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Implement a variant of the existing gdb_do_syscall() which takes a va_list. Signed-off-by: Peter Maydell Tested-by: Christopher Covington Message-id: 1439483745-28752-4-git-send-email-peter.maydell@linaro.org --- 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);