From nobody Sun Feb 8 23:05:17 2026 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=1558714503; cv=none; d=zoho.com; s=zohoarc; b=FXBmhGhPvfFhzMyTGuA3AnHU7tb4k0GwfjZDf5Whs9v4+EhxzxlEB/Ag6f1ENRbTDfP2WkyZB68dcUdxw0Ry7eP9U8Poz159/p4cYfokLw/xCojCSOFKM0QSW861krVnD0an9oL9F/LOnFTJLAqiba+9+fuZx/3bFf5sVoai6do= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558714503; h=Content-Type: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=wh9EpBdoOlG51mER9CpfFoTYwVIIpWsaGH6DJuJrlR8=; b=TE0x/3P9+wqqQqL65sH6YKkY4ckVP7G3snANZkGx5UI8QVB/IW2ONFwh0vuLS+sKKfbBTXvmY2XY8rWH/s8xmHcJ5FeXI97fN4CvkgUt46hdxz/hLZhsPxWpWtlY0QlEcYIzOFb9eqjL8QduSPWKBbSLHyiJgsQBX4mKe/hpH/w= 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 1558714503533984.1794869861037; Fri, 24 May 2019 09:15:03 -0700 (PDT) Received: from localhost ([127.0.0.1]:57056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUCqU-0006xd-DW for importer@patchew.org; Fri, 24 May 2019 12:15:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUCdd-000442-BO for qemu-devel@nongnu.org; Fri, 24 May 2019 12:01:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUCdX-0001zG-T6 for qemu-devel@nongnu.org; Fri, 24 May 2019 12:01:43 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:36841) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hUCdX-0001uU-FM for qemu-devel@nongnu.org; Fri, 24 May 2019 12:01:39 -0400 Received: by mail-wm1-x341.google.com with SMTP id v22so2498776wml.1 for ; Fri, 24 May 2019 09:01:34 -0700 (PDT) Received: from jondnuc.lan ([176.230.64.37]) by smtp.gmail.com with ESMTPSA id s11sm370863wro.17.2019.05.24.09.01.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:01:32 -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=wh9EpBdoOlG51mER9CpfFoTYwVIIpWsaGH6DJuJrlR8=; b=IpVstYaZK1HL36mbLGf9oGUIfmui1awanGFGAUmmwzUKGx/EDEgVKrWSxT3GdPJtt1 raWUtRU3XhhHKdCLp6x2CTOlRtnQEZV/OfmTX8NaUx3XF9fMi9Sxtj45pbmTeUK5FftX BOMT61NXy+F9oG9qQyIQLxLpO51H9Vr+h/4D9TEeg6sEJBvYZY0QN3D54O4uPFnPBU0B p0ys1Bph3XQikEAvhuMDIzvwCnOMNOtVdkucEqMitBI+jF/Wpv3iicxPbKv4LrOIXWnW K7qRwj/+ObGTlrPsBHgayHBwL8E1bB10ZVB0uLP6iNVs0XmTl0rRrkUaR4jYnaKeifoJ qK9A== 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=wh9EpBdoOlG51mER9CpfFoTYwVIIpWsaGH6DJuJrlR8=; b=o3BW2WlHpl5oYToysTd13q3mGLELZH9gLucp+TjDvfy+PKgG6zx+VSnme4o01F5tgn S03JKezP8MU3iVqFG+qb1hknbKnrnfQoeRX6hY2AHPYx0A6PN6pKvfPISC2oYRIBpiGD 2ejRrH6RJeZB0vaYNrr4qm1bf1rv6TmxubiTzwsFjYhM/hvqcJEGvK5K22+HGsQJ3rkq GHyuOy68AWFqBGLhRwwayhgjYu37T1fn+kV5OzMJMYS0wIUn/5Zl4c3c5X1uNST0061T 9Pp3sEWCTgYEdw+5DcH865CVDbU+LsRoqhKSxehyealNO30GW+xsukNzRmmbLjAItxW4 bsmg== X-Gm-Message-State: APjAAAUr6TshzlfY4gPULGZ1YZrcGAS6pVEAN5yMUr+prBArtS9AIuQL I3n4mEy82gszROp2ybdAtz4vILTJ X-Google-Smtp-Source: APXvYqxWu+1OHXngz7Ir6p+lmOMY8zOBjhOsPV8RZbPKCG7KT2D+Keo+W3ivce3iG5Rfz+yVIakdmA== X-Received: by 2002:a1c:9e92:: with SMTP id h140mr425471wme.82.1558713692750; Fri, 24 May 2019 09:01:32 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 19:01:01 +0300 Message-Id: <20190524160118.31134-4-arilou@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190524160118.31134-1-arilou@gmail.com> References: <20190524160118.31134-1-arilou@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::341 Subject: [Qemu-devel] [PATCH v11 03/20] 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: 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) Signed-off-by: Jon Doron Reviewed-by: Alex Benn=C3=A9e --- gdbstub.c | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 307366b250..b4c4bd4b08 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1493,6 +1493,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; @@ -1793,17 +1817,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.21.0