From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 265D0C04AAF for ; Tue, 21 May 2019 10:09:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E78C321773 for ; Tue, 21 May 2019 10:09:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YtSHz2Sq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E78C321773 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([127.0.0.1]:50548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT1iL-0003hT-5B for qemu-devel@archiver.kernel.org; Tue, 21 May 2019 06:09:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT1ZM-0005v3-0L for qemu-devel@nongnu.org; Tue, 21 May 2019 06:00:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hT1ZK-0007mp-2y for qemu-devel@nongnu.org; Tue, 21 May 2019 06:00:27 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:39517) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hT1ZJ-0007kv-3Z for qemu-devel@nongnu.org; Tue, 21 May 2019 06:00:26 -0400 Received: by mail-wr1-x444.google.com with SMTP id w8so17871149wrl.6 for ; Tue, 21 May 2019 03:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ni+e0LhW6YWUs24EBh3Q0RNwpZ46aTDH74CutNl7AtE=; b=YtSHz2SqC6bI3ZA/fWNPrSgpZpKEjn2P9IDE64IVGFwd05HPp1kJecwpousInpyZQM AwTNJO3iFJzypJIsQiqXlgXsnurxG+wflMI7so/P1wa+RCtO6DBFyYmriZgTLOqgwSs4 iS4S71GkbZJ05aGFKN1GpttlzPl2skKZOT57EdRlAxgEOe6P55VIeb8KANzS8BP5Q87h mP9DEMwHC64vOzZhdTSapBBzBotOy0hHIgrZMsq2DBFFqiCxGj+TMEy/ZrL2GSU95YbN p0IJkgB5gXcS+6ChLJCN/rSIEdN/wR29NsNtNyo8xJceQGiyntg2C0mRk7atd90jbcDc qUzg== 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=ni+e0LhW6YWUs24EBh3Q0RNwpZ46aTDH74CutNl7AtE=; b=SvZp3RrgQAtylIRTl1n4LyMXGZR0fHdQy0A3DrAO3p0zCEceJpeWwYXc26kNjtGAcn V3Mtu/oFNT26//OdIiWtM1QqQa/Zh62YVWgPXc8g8NZL4RZPmFiUKJSdPvTEkku/WkvI 7lTbhd539TyAo2vCj5AYETBnrt3lFVS+OXqnS79QfYg5yNfM/MyT3n6t/Gm86jqEBX8b x99dciL+wfuGPBUjYOz9pdyH+z+RW2H4ridBf3K1zRh3lFTwxoQjYCdpVMnk0imXZ5EQ YxOoDe12KzP4+Yy94KYH7T1MhbHHBEZLC0BBlVZ8W6w74EI9lZtuBV72us32MhSUGUoY F1uw== X-Gm-Message-State: APjAAAVnNPW6oMtpweNVr0sbXpwItN8y0Fw7v0tDwbMy7tdrkEn1pf4h 1r5ys2nyGJbrJzqBwo9M4O/GT2vW X-Google-Smtp-Source: APXvYqwm9/e9ga4CH6nz2euu7q0P4Ld/vwX3Rt4UzmHlSd7biQ3xNADRw6RoPoV6G3axZ0blduRwhQ== X-Received: by 2002:a5d:68cf:: with SMTP id p15mr20094523wrw.105.1558432824125; Tue, 21 May 2019 03:00:24 -0700 (PDT) Received: from jondnuc.lan ([176.230.64.64]) by smtp.gmail.com with ESMTPSA id 65sm3080257wro.85.2019.05.21.03.00.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:00:23 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Tue, 21 May 2019 12:59:42 +0300 Message-Id: <20190521095948.8204-15-arilou@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190521095948.8204-1-arilou@gmail.com> References: <20190521095948.8204-1-arilou@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v10 14/20] gdbstub: Implement file io (F pkt) with new infra X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, Jon Doron Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Jon Doron --- gdbstub.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 781f5882ac..b35acc679c 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1775,6 +1775,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; @@ -1916,28 +1935,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': -- 2.21.0