From nobody Sat Jun 29 02:21:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1556782223; cv=none; d=zoho.com; s=zohoarc; b=JF9L5myyyEZIy8tgNn1xi4UKpj5+ek5Ne4AaCxt+eafSvFN/o7Ofc2AhT68YorrdOvsc5VdTeMcPz5Y9orOPBqfEZYnFd+pBXnyNFCI00XcipUA0GWG1/QA0Ce3TJw7Xu6Oh2Fnr83oJdPisXQg88vpOSxdhEwbFWGCbn5ehUVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556782223; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lYm7IhGBrxn52sVAeIC90HrrQ0q55SD5y2VdGObDHgY=; b=mx9rEXcnrpH2JA4cGiBg6ji6Qi5NgqH3c7fZ6n74sP7UNSY7Y+HQ6XHqTvImQ/7jB0Kwq3flGek42jaf/AGVmd7QZl9fP0CgtQ0Hko66fgzWP8F1M2mTpZ56LOSWuLbXu+KqqlqvXQOrOifN9255HzZOJezrldjVm/ceU9uI3bg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556782223358575.1654018842559; Thu, 2 May 2019 00:30:23 -0700 (PDT) Received: from localhost ([127.0.0.1]:46510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hM6Aa-0004sM-4x for importer@patchew.org; Thu, 02 May 2019 03:30:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hM68q-0003q5-Uy for qemu-devel@nongnu.org; Thu, 02 May 2019 03:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hM68m-0001jW-8S for qemu-devel@nongnu.org; Thu, 02 May 2019 03:28:27 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:42671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hM68j-0008Ux-Fi for qemu-devel@nongnu.org; Thu, 02 May 2019 03:28:22 -0400 Received: by mail-wr1-x442.google.com with SMTP id l2so1782364wrb.9 for ; Thu, 02 May 2019 00:26:59 -0700 (PDT) Received: from localhost.localdomain ([176.230.64.186]) by smtp.gmail.com with ESMTPSA id z5sm8769289wre.70.2019.05.02.00.26.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2019 00:26:57 -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=lYm7IhGBrxn52sVAeIC90HrrQ0q55SD5y2VdGObDHgY=; b=j2H5OfT5EN+cF9uHqNDHcFcN3+vD2wMCdsbE5xhIBscH0XWolZT2pBW9CtGFtsNBLS x8gMxteIm84u5K5SImBzHQzbmjNC3aLrZia1Cd5lStvizJ62oACK9rc1JDf6fGe5mVNf +Q6aAH1GK5w3Updc1XmXYLcbfinHjUXaniehWmYUQcD+BBS7rEDFlR/utlgCb1ZaUSBn 0DjTG87dB9DNyoGYmTwJun6Y30pz8jWXGz78kKySuCa8DUSHGeapEbAjLOI0Nj/F7lYQ FXXUVhm4r0P5sYVvpTnGVKCtHUagG4Oqvm++RPxr3dx8/wH4rokXo/H5etWNbNca5UZz qVtA== 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=lYm7IhGBrxn52sVAeIC90HrrQ0q55SD5y2VdGObDHgY=; b=mvYpvud6b9+g5uthvEiVSEyiX1fBwbJKwBlyNlbY2RvPdia+UGsrQ06CI72/0p/FR+ 3aawRpvhp7kZoTg99dV53WEZwqLAbaFQJR5QcriRT75RDxsoiW1qkxF56gkppJCRUR+E 0eXMqUqTtUErjhPM78kQML2eqUnUkMjX5WBCqLHSXvDo7WizImWT1inUjoH9BBpfp7Lp ECtFZay2HIxfpDKbSv3+4qwzJogNmRAX4OVrTT0EAtIgc0KTZYIcPgs6g8UceKRzg0+b Kp6yeaDl95TSOeda3ENScVuOiVNOd0ORKKZzlVFWhikD2IOI8N0nRiTewoctohzgomVB jgRg== X-Gm-Message-State: APjAAAVUPKKCjq7KXNzOhuZwpf0TBY+1hMvDYMjIFh9qp/UJ21kTOUMW CKVMo8T+37gcg/UGT63Vz8UIxkSV X-Google-Smtp-Source: APXvYqz4eMZgXAvm8sksSyfgy2ueWBXsyRhv9Lb6AffXH1ic4xnTvFfG7nDDxwo2BQxkgIXDY6aNhA== X-Received: by 2002:a5d:6189:: with SMTP id j9mr1501363wru.176.1556782017916; Thu, 02 May 2019 00:26:57 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Thu, 2 May 2019 10:26:17 +0300 Message-Id: <20190502072641.4667-4-arilou@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190502072641.4667-1-arilou@gmail.com> References: <20190502072641.4667-1-arilou@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v8 03/27] gdbstub: Implement thread_alive (T 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: liran.alon@oracle.com, alex.bennee@linaro.org, Jon Doron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jon Doron --- gdbstub.c | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 621d689868..c47ef7dd9c 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1498,6 +1498,30 @@ static void handle_detach(GdbCmdContext *gdb_ctx, vo= id *user_ctx) put_packet(s, "OK"); } =20 +static void handle_thread_alive(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + CPUState *cpu; + + if (!gdb_ctx->num_params) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + if (gdb_ctx->params[0].thread_id.kind =3D=3D GDB_READ_THREAD_ERR) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + cpu =3D gdb_get_cpu(gdb_ctx->s, gdb_ctx->params[0].thread_id.pid, + gdb_ctx->params[0].thread_id.tid); + if (!cpu) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + put_packet(gdb_ctx->s, "OK"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1798,17 +1822,14 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) } break; case 'T': - thread_kind =3D read_thread_id(p, &p, &pid, &tid); - if (thread_kind =3D=3D GDB_READ_THREAD_ERR) { - put_packet(s, "E22"); - break; - } - cpu =3D gdb_get_cpu(s, pid, tid); - - if (cpu !=3D NULL) { - put_packet(s, "OK"); - } else { - put_packet(s, "E22"); + { + static const GdbCmdParseEntry thread_alive_cmd_desc =3D { + .handler =3D handle_thread_alive, + .cmd =3D "T", + .cmd_startswith =3D 1, + .schema =3D "t0" + }; + cmd_parser =3D &thread_alive_cmd_desc; } break; case 'q': --=20 2.20.1