From patchwork Fri Jun 7 09:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 10981331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 057E514E5 for ; Fri, 7 Jun 2019 10:22:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E90C228B45 for ; Fri, 7 Jun 2019 10:22:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD35F28B4B; Fri, 7 Jun 2019 10:22:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.47]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7FC9728B4C for ; Fri, 7 Jun 2019 10:22:44 +0000 (UTC) Received: from localhost ([::1]:47972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC1D-0008Vc-IQ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Jun 2019 06:22:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44993) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZB50-00088e-LP for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZB4z-0005rQ-E6 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:34 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54227) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZB4z-0005pc-7z for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:22:33 -0400 Received: by mail-wm1-x330.google.com with SMTP id x15so1269377wmj.3 for ; Fri, 07 Jun 2019 02:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gr42vRKrUtGXl0PC7wlu1Mzbd+6iYUnnF6QdAndqlX8=; b=d5DsfHhzjtaYyKNtHVkGf4bnxjwVq0P5yRswjrck/XRMWVAYDPbbLpQBkQpYdRLH7k QH2U1DVVNtsEG11zrz6foyBSgOPhsWBqSHoAIZTjSzWFyGXAgIKGGtkymKSnPDBro/Zj fMFOKrO5lJPFMkfscpfnlfBzFVakQVpLRXIeArUUVC4poiht+owWAjTP1oSqknpNERpc ZW6EKhqJy7XS3zdhYNPr/p9+fXX2BTWM8eg70gmwYS6ghXWrtsrcbdDeFEO2qNhQMRc5 Xji7OxADG7OORLOCYhQ3Dp6SYMqg1PMz/zQ1vDCB7FwuoFsjn6ftTMeIV3d4P9Wl9Tiz vg1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gr42vRKrUtGXl0PC7wlu1Mzbd+6iYUnnF6QdAndqlX8=; b=PeAE3+r8x8LduxKAI0Pe8w0CCl65Jt2up/nepHOzgynMu5+Yyld7srLreDPvqCFy1v L52rYbFicD5C3skHAaDzgGNZQts7GxzzfLSVun+z234UBq39OtphiEK8+n2V+TDHyBgd mymIflxnDs39/k3YZrUSFCsz/c2oBvXdTv/x2rGmm0ZwVr9MXcBd8sTzfj8U0/qZZklL 4QCKqag8dCtcsnayRlhQpf+RBceY22v5SbsjchkJ2SoLjtFtoWYgNo8rMQeDgSL8XwpN iWFYwcZb2QYutyt9Ec0GkroHTiyixVPmuwbZKatcCZDkLeYs8oz1s6xZRbX6p2xBRM6P yhIA== X-Gm-Message-State: APjAAAVK7Kb4312w5lh0vN9OJvvSWGgD8oG3qWC7xnFOIMFe93/5m/Y9 KKisLvOmMsAjVVgzwNyOiZ8zwA== X-Google-Smtp-Source: APXvYqwkV/iSmoxaToCtV+B+EAHSy/nXBBCMzL1kiMEp/KdV5QjZ0ZUtbmiez9xmgfK1ti40+HWQMQ== X-Received: by 2002:a7b:c5cd:: with SMTP id n13mr3085392wmk.67.1559899352168; Fri, 07 Jun 2019 02:22:32 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c12sm1223966wmb.1.2019.06.07.02.22.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:22:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A886A1FFC5; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:45 +0100 Message-Id: <20190607090552.12434-47-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 46/52] gdbstub: Implement file io (F pkt) with new infra X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?A?= =?utf-8?q?lex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Jon Doron Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-15-arilou@gmail.com> Signed-off-by: Alex Bennée diff --git a/gdbstub.c b/gdbstub.c index b3c5ced80d..1871077cd7 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1789,6 +1789,25 @@ static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, gdb_ctx->str_buf); } +static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + if (gdb_ctx->num_params >= 2 && gdb_ctx->s->current_syscall_cb) { + target_ulong ret, err; + + ret = (target_ulong)gdb_ctx->params[0].val_ull; + err = (target_ulong)gdb_ctx->params[1].val_ull; + gdb_ctx->s->current_syscall_cb(gdb_ctx->s->c_cpu, ret, err); + gdb_ctx->s->current_syscall_cb = NULL; + } + + if (gdb_ctx->num_params >= 3 && gdb_ctx->params[2].opcode == (uint8_t)'C') { + put_packet(gdb_ctx->s, "T02"); + return; + } + + gdb_continue(gdb_ctx->s); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1930,28 +1949,13 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) return RS_IDLE; case 'F': { - target_ulong ret; - target_ulong err; - - ret = strtoull(p, (char **)&p, 16); - if (*p == ',') { - p++; - err = strtoull(p, (char **)&p, 16); - } else { - err = 0; - } - if (*p == ',') - p++; - type = *p; - if (s->current_syscall_cb) { - s->current_syscall_cb(s->c_cpu, ret, err); - s->current_syscall_cb = NULL; - } - if (type == 'C') { - put_packet(s, "T02"); - } else { - gdb_continue(s); - } + static const GdbCmdParseEntry file_io_cmd_desc = { + .handler = handle_file_io, + .cmd = "F", + .cmd_startswith = 1, + .schema = "L,L,o0" + }; + cmd_parser = &file_io_cmd_desc; } break; case 'g':