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: 166131 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp449886ili; Fri, 7 Jun 2019 03:24:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz1KSOSerAWgjq9d0L7lQrt0BOVODOLX3uUKJXVzOBAb/3O/z/T+JW3tM/wO5Ikks2Rf+a X-Received: by 2002:a37:6652:: with SMTP id a79mr24302813qkc.60.1559903048807; Fri, 07 Jun 2019 03:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559903048; cv=none; d=google.com; s=arc-20160816; b=r88zfLxxZ/kuf1hC0JChDzi7fdhxUr5IIQ5DdnVGrXewcWH22+ThDs+4XYA09EvruP 75N/xWZyv5bToVpRee6aDbblp3EpZYYAAlxgI4Rnvf+Yky57rfXhbluy4hAizZS8Cc0i wZts1rQHIndLFndrxS1VIFI/580BEodSlXjZ/LLfG0jSNq153KlbASFLAspjb9v7YQFo gdCuKmxvobWAFNDT9sdL8JzmYYOYKGb40Ngws0CpSo4/95gnDmgpqzpsZeNAXV84fSa6 iIW2iK4OBDbA+bmhjVUz5PIO2mTyUCMBFMM05MO4Bnkb/93N3Wcwaqrmb3eYK0lOZfjv NE3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Gr42vRKrUtGXl0PC7wlu1Mzbd+6iYUnnF6QdAndqlX8=; b=Qq7brN1QtILr9YW5KT2wPJqYSUc9mrqaifmFAEfONsTBdAfrlZs9mme2Ig7KwPf28U TnJl7daKRB9eG5P42DYLZMGHzNnc2vAa4NOKe7hk0xHdAtZrVx2T8oRH5QtHry5kYQ0n nUVfIix9tjfgQMrNToVV0dDjJqkwXL6byEl03DJuSLexr9nxtN9RRYsdbDhRR7kbCJo1 g/XH/MLsTn80Ko8mNaaOZyhaNc6U5WdEGJK54BoV733KUx1BiWbUy1oeq114+WN295AR Umyy5+8jeNi0ImTiZEk2f3dpwOAk0uhvD9mz3SdnbahSVdLIZ+Q8citF0w8r+Tx8a5vl VHrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d5DsfHhz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.47]) by mx.google.com with ESMTPS id o67si925722qkc.224.2019.06.07.03.24.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:24:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d5DsfHhz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZC2a-0001hK-EF for patch@linaro.org; Fri, 07 Jun 2019 06:24:08 -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-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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-15-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 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':