From nobody Tue Feb 10 18:54:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1512998962527151.53899573314584; Mon, 11 Dec 2017 05:29:22 -0800 (PST) Received: from localhost ([::1]:53023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOO90-0000Hc-Pf for importer@patchew.org; Mon, 11 Dec 2017 08:29:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOO2R-0000fh-L2 for qemu-devel@nongnu.org; Mon, 11 Dec 2017 08:22:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eOO2Q-000272-KY for qemu-devel@nongnu.org; Mon, 11 Dec 2017 08:22:31 -0500 Received: from mail.ispras.ru ([83.149.199.45]:43450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOO2Q-00026e-DV for qemu-devel@nongnu.org; Mon, 11 Dec 2017 08:22:30 -0500 Received: from Misha-PC.lan02.inno (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id ABEF754006A; Mon, 11 Dec 2017 16:22:29 +0300 (MSK) From: Mihail Abakumov To: qemu-devel@nongnu.org Date: Mon, 11 Dec 2017 16:22:15 +0300 Message-ID: <151299853501.4808.4968277796848274446.stgit@Misha-PC.lan02.inno> In-Reply-To: <151299847127.4808.14646046517426494416.stgit@Misha-PC.lan02.inno> References: <151299847127.4808.14646046517426494416.stgit@Misha-PC.lan02.inno> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH v4 10/46] windbg: structures for parsing data stream 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: sw@weilnetz.de, lprosek@redhat.com, dovgaluk@ispras.ru, rkagan@virtuozzo.com, pbonzini@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Added structures for parsing data stream from windbg to packet. Signed-off-by: Mihail Abakumov Signed-off-by: Pavel Dovgalyuk Signed-off-by: Dmitriy Koltunov --- include/exec/windbgstub-utils.h | 11 +++++++++++ windbgstub.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-util= s.h index ced03b0663..b7e65faefe 100755 --- a/include/exec/windbgstub-utils.h +++ b/include/exec/windbgstub-utils.h @@ -52,6 +52,17 @@ typedef struct InitedAddr { bool is_init; } InitedAddr; =20 +typedef struct PacketData { + union { + struct { + DBGKD_MANIPULATE_STATE64 m64; + uint8_t extra[0]; + }; + uint8_t buf[PACKET_MAX_SIZE]; + }; + uint16_t extra_size; +} PacketData; + InitedAddr *windbg_get_KPCR(void); InitedAddr *windbg_get_version(void); =20 diff --git a/windbgstub.c b/windbgstub.c index e9aabd807b..395f244d4f 100755 --- a/windbgstub.c +++ b/windbgstub.c @@ -19,6 +19,36 @@ #include "sysemu/kvm.h" #include "sysemu/reset.h" =20 +typedef enum ParsingState { + STATE_LEADER, + STATE_PACKET_TYPE, + STATE_PACKET_BYTE_COUNT, + STATE_PACKET_ID, + STATE_PACKET_CHECKSUM, + STATE_PACKET_DATA, + STATE_TRAILING_BYTE, +} ParsingState; + +typedef enum ParsingResult { + RESULT_NONE, + RESULT_BREAKIN_BYTE, + RESULT_UNKNOWN_PACKET, + RESULT_CONTROL_PACKET, + RESULT_DATA_PACKET, + RESULT_ERROR, +} ParsingResult; + +typedef struct ParsingContext { + /* index in the current buffer, + which depends on the current state */ + int index; + ParsingState state; + ParsingResult result; + KD_PACKET packet; + PacketData data; + const char *name; +} ParsingContext; + typedef struct WindbgState { bool is_loaded; =20