From nobody Mon Nov 10 19:26:18 2025 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=1558433200; cv=none; d=zoho.com; s=zohoarc; b=juX+1uGfbHFBJnEgk2hz7rfyfI34V2VTp3FySQBAJm7d8ptYkFsnIFMY+QsMvts8DRTjHSPgVABPH+nTyUG5zGCxgPRneIKKn3WeP9Bg9uL03lQsSx8Kzaq6lr4MRc2TYow6SfxJf8OKoPo+9kxMtg3YI/7+2C6hsXjWvdcXSUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558433200; 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=wCPlNOOjuBj+Z7/fbZOhYxVCeolCa7FpcLlxWgYcW2g=; b=n0mbizO5IrOkn5ipZTjr2P4was5Ig7h21M5qEiGlpm5haI4Lzo57/DPSRXoXuffDRcEjsv+StwCQk1aByVQJeN5OLWUF9HJsC0tGG4EA9taVaHbizobJnfIzm+uM73DdEVSLDadx79pjsGEbjcfoOMlLp/mNW5bh6/VePrrA8LI= 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 1558433200852846.494695037233; Tue, 21 May 2019 03:06:40 -0700 (PDT) Received: from localhost ([127.0.0.1]:50522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT1fF-00017t-R5 for importer@patchew.org; Tue, 21 May 2019 06:06:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT1Z4-0005aw-2n for qemu-devel@nongnu.org; Tue, 21 May 2019 06:00:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hT1Z3-0007LS-06 for qemu-devel@nongnu.org; Tue, 21 May 2019 06:00:10 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:33176) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hT1Z2-0007KY-Q5 for qemu-devel@nongnu.org; Tue, 21 May 2019 06:00:08 -0400 Received: by mail-wr1-x441.google.com with SMTP id d9so4894488wrx.0 for ; Tue, 21 May 2019 03:00:08 -0700 (PDT) Received: from jondnuc.lan ([176.230.64.64]) by smtp.gmail.com with ESMTPSA id 65sm3080257wro.85.2019.05.21.03.00.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 May 2019 03:00:07 -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=wCPlNOOjuBj+Z7/fbZOhYxVCeolCa7FpcLlxWgYcW2g=; b=higoBbmHXlVx/oWfq92/jaRyfYiJAH7jlRIrLfbnsbLr8s9CcewhWZd3vQwR2ddTY+ NRWpuhkyVS6fm5hBL4FM/t83rX+2Yb40sZn3f/IBIWvdRdo2CqQb6ofjQlz9TPP5E2d3 QIE1TfQvczd8G1gg5j5w8Sy93bPu/1hns+oL2vZDQnPu5BGHg951ElCdbdSBtcBjnxnV rzoZhkyrMzWsSQPLzMW8XZBdAY4RGxqwxZC2gNkElW77nTofy+nfxYwBTHUe+n/3e2wZ KCSdgNHAJ7nkhPrS/qeq3Rpsdta59Tn8gFc9LI5iHlXpNumyndKREYzllgxaplDHivgE qS8Q== 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=wCPlNOOjuBj+Z7/fbZOhYxVCeolCa7FpcLlxWgYcW2g=; b=j85WSquWhdYeWOf8Q/KO8tYCMTpXR/sgyUGfF5oMlhpzOnU06vVlq7K0otmir+SQDi k9CVVGaDPNs4rdLJV/BEmTTFqmBaXLrQemmdSq9x/DtKCNT0XCIXAtlKiW0oFOn7lXxh I3ZDcIUJbB9Mmd/duyP6TPsrh+3BZSQ39Pn2imbh4x7ip7m1ldbBhdBZKsPM1YPgO40k GC5FgsPKnnN0OKgK4p1l7Ao9z0TSdyR+nGwG0iK83Wgao1nxwu7yH1/wMkmkb7JhYp1c emmIja43c6wXLGGSCRQOtjlaMNSLYNjak+WxXneIXPIWrlL2KMJtRwaUKsxnkMt47YIO WcTA== X-Gm-Message-State: APjAAAVLoFOFqt+5vFmmc9gLMIVASfgQvLn6xuPMI3xXaXBvq0a9qwba Fl9MUGAJ6CySmty/flMrv9tZsVMl X-Google-Smtp-Source: APXvYqxdnamLLFUAM9E3yEif5e0AKN1O52c6Pi5/4qrLR6rNrVWRKqvPOOa3DazwSm46Izks9XCijg== X-Received: by 2002:adf:f408:: with SMTP id g8mr21159821wro.264.1558432807727; Tue, 21 May 2019 03:00:07 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Tue, 21 May 2019 12:59:31 +0300 Message-Id: <20190521095948.8204-4-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: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v10 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) 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 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