From nobody Sun Feb 8 22:49:44 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=1556254704; cv=none; d=zoho.com; s=zohoarc; b=JoFX+pliUKyXviAhEUeF4x801NkIYcxfYttZMf5NBxFjZINkMf6C8GIVDE3jk4RDyunY4MKZeqy47H7lkAQ6m3t0/ziOoKsdsAgfVg4P3U+OsNWsZ7laB/QwAPCMJYCJCASvPbeFoXLeJu4SPZr/d+a2ActPmkjBPRc66UFQ1Dg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556254704; 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=dlZY5p6BbdkIAQg6dexwHzGLAJ6u8ldj55dcTiiGS7YV5Q2feoUyeEXLJ4b6tEWEo+mSKIuTLYki6v/R2LH4hrAuT04vv+5HZ8HmxhsLgZvNi+3kD4R3oMgfOQ07JdYr7k/38sztkV3IY6j/WXf+HB4UawT9OFsSLOb0AXNNMEA= 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 1556254704488297.3349304465494; Thu, 25 Apr 2019 21:58:24 -0700 (PDT) Received: from localhost ([127.0.0.1]:39253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJswH-0002dn-D0 for importer@patchew.org; Fri, 26 Apr 2019 00:58:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJsmm-0000dG-1v for qemu-devel@nongnu.org; Fri, 26 Apr 2019 00:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJsat-0004GT-C9 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 00:36:17 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:35593) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJsar-0004DS-Ta for qemu-devel@nongnu.org; Fri, 26 Apr 2019 00:36:14 -0400 Received: by mail-wm1-x344.google.com with SMTP id y197so2376235wmd.0 for ; Thu, 25 Apr 2019 21:36:13 -0700 (PDT) Received: from localhost.localdomain (bzq-79-178-247-46.red.bezeqint.net. [79.178.247.46]) by smtp.gmail.com with ESMTPSA id h5sm3467088wmf.38.2019.04.25.21.36.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2019 21:36:11 -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=GuxftqfDBOC6Gh/IgmEfBv1W4NhNRan/qGK3Dw5MJKzDR69QPEUivIShut7Q7Axv5d LKh7QfQq9c6M60hcAgxOMxUeyjEjwAuVFqR9j6MYmF06zjoJT2KFjxHqViZmXJp/ZL01 xP8wxFFZwHm0XjXTyMgO++xCRLbZhYdFCmaJSPeQlGOOETRqQQ/4gM53bFpeCsZOxFG4 z2rkIs+OWj5DdwLn1nzt3xAQgo0jKiUpkaDmJwkizn2FaTzezdh7IvGXF/TWJJV/tw25 hUUeYx/fSkksiQd32hwBEXvT/T8loySXGKbUvr4xRhcDK0LPNH93hcQLAAlg3MXTeIhu pUoQ== 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=CMbpIzFDYj3nbA1E9aKA/K7yCB75hlD271s/rnQVKcNAMhVGFsDbcuwqsGrR4r8GMX QnjyfklMsA0n7mI8oG1uWIBY6qL8QMeYECzajjdcKF0SSoBkwhcFTkI0Ecm3D96/Plah v+ceHwtznwqvtb/7+cm6bFhd15AqpBAlniEV/EgRj0uW3nEvQTlCiQhu9zWU4aj5Cbwf NNLABiHbavsMEW3ZO/Oii2IOf91EaO/mfnGxsporgIRFNuNBC763DaASJ4baZB8Lh8bS ctz3rEqBtFfsrlQJEpVZ4BPRQveTfwyMbBX2Kf+5+OBLorzRLQM6YL54lzRzudWjN7N0 TFFA== X-Gm-Message-State: APjAAAXOFwAKEmJOMYhtnQbRmHbH0fZmLQoCM8R49p+B9Giu1zaxMgDH BaP/3RYEA7gUAF41WfSmD9omLZol X-Google-Smtp-Source: APXvYqwifvW1CP6iF7M4v4S4Du7nNXfC0gtBqNcSoi3t0MIFYMiTlpYu6iA2UttVNjJeMUSrhdCVuA== X-Received: by 2002:a1c:a103:: with SMTP id k3mr6221401wme.8.1556253372530; Thu, 25 Apr 2019 21:36:12 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Fri, 26 Apr 2019 07:35:40 +0300 Message-Id: <20190426043558.6888-4-arilou@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426043558.6888-1-arilou@gmail.com> References: <20190426043558.6888-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::344 Subject: [Qemu-devel] [PATCH v7 03/21] 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) 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