From nobody Mon Nov 10 12:57:20 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=1556199593; cv=none; d=zoho.com; s=zohoarc; b=Lei7qw1cwsYXwgi4OU6/mNj0ggsErrxPSQVefP9Dec6Wb+8PmAhU59XXsoyof/o38LEMSQQmcn41kxOgMZzzOy+HOEwpnFBDFLN2+OfJTuI6HaNQU9MN5459WFUPGBiI/kxNXBjdleFylffKtfT2ExmYm5IMOvGVIq6kGsIvcT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556199593; 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=vbRIrSe2/0YQKchHifA9WtEnR/rS78BpaRVSv6nPF1c=; b=i9FukfePVvEiIgIIaC0bLJTysfCfMc29RYbPmACmK5d9r/NesQbOp/wiX3we1p5yqA6OThTFvHC3/NC8a5hlvDs0VL4cl2ZWt1srzt31Jd+tqXnJCjIUe4rpndYKAuAEzbqKQF5qnV9WMnrSWBYhcTYGzAenblVRBA/NIgny/wM= 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 1556199593227938.6415991440099; Thu, 25 Apr 2019 06:39:53 -0700 (PDT) Received: from localhost ([127.0.0.1]:57345 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJebO-0000xl-JO for importer@patchew.org; Thu, 25 Apr 2019 09:39:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJeQS-0000Yc-S6 for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:28:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJeQR-0002BB-Ty for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:28:32 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36551) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJeQR-0002A9-O2 for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:28:31 -0400 Received: by mail-wm1-x343.google.com with SMTP id h18so10619551wml.1 for ; Thu, 25 Apr 2019 06:28:31 -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 y4sm2316540wrt.34.2019.04.25.06.28.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2019 06:28:25 -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=vbRIrSe2/0YQKchHifA9WtEnR/rS78BpaRVSv6nPF1c=; b=Wj2ZYKeEYhvs0AbLnRezIJjZr0ZEFn8VJ33D/V4kbcQD11GEKR7FcRxrULxFmrF+xt M94RT8ihBXgCCjae78FFh7TQqA7miZ7wWquUw9Vxs5MPADcwDQmM0peafGFjPgERg6CU /PCNPfECo9mzeLKOWGYVZ0X0DO4h3I/dey/hZzy6TuYK7B6jEB8ipJ/sNObE40T274LE yG45IL1NRvss4COJbJk+DNZLK9AlJ/VzwgiVoY7U4tU7Uyg6G+c45FsroXIxrKCtRn6V 7Rc8hYe4tT6tpTS7srrTinxO1hSoTgL3s5CfQt6jlvOzXM9rvrEcunL97sYBlj+cWqBt aORg== 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=vbRIrSe2/0YQKchHifA9WtEnR/rS78BpaRVSv6nPF1c=; b=Dr+DOl+S+JyjVZKjjzKIt3zMxLJtQt8F9wMsl3TmbaFLrjgXIw1k45XdHe9MYDyDcR b9Qy8MnzQbAPAhcpROxLuHSP4e/PshAtLO9XunjUKVdSdcemaetFTf//TlMwiOKJWDFe N9CH3vDsDAQef5YRe0PqVjHa4BzbRvWhDdENkAAlO+OWJHg9H6hOLyrt3w7UTOGW7UC9 2vHnkdv0VBx/ue7e1SEndMXBENDiZTlF7lL3uNGDn5sRufZYGv3w5DUsBp7gHPPHRyYq kXvWmcxzqKANj2456ApSDO7ruaaJVLo2zrQi8dFSgSwo9tRoINJbqncZqXoKdBgYrXYl tn1Q== X-Gm-Message-State: APjAAAVvVrN+FA+hBI4Hv6uuTi2jgyruCxlopZBErESHqQL9rM67obS8 cX6Wf4IX+xFTYNci5v3xvCzjfX4r X-Google-Smtp-Source: APXvYqwwSE4tqwjute0/qYP9NcDdKYzm40aQAAhd44fjUNtZEFUxqSi6LT3S8AejQIUGOOZhIvmpag== X-Received: by 2002:a1c:9e96:: with SMTP id h144mr3749144wme.33.1556198908867; Thu, 25 Apr 2019 06:28:28 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Thu, 25 Apr 2019 16:26:35 +0300 Message-Id: <20190425132636.31636-21-arilou@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190425132636.31636-1-arilou@gmail.com> References: <20190425132636.31636-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::343 Subject: [Qemu-devel] [PATCH v6 20/21] gdbstub: Implement target halted (? 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: 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 | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 779da2aa77..8838241209 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2248,13 +2248,30 @@ static void handle_gen_set(GdbCmdContext *gdb_ctx, = void *user_ctx) put_packet(gdb_ctx->s, ""); } =20 +static void handle_target_halt(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + char thread_id[16]; + + /* TODO: Make this return the correct value for user-mode. */ + gdb_fmt_thread_id(gdb_ctx->s, gdb_ctx->s->c_cpu, thread_id, + sizeof(thread_id)); + snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "T%02xthread:%s;", + GDB_SIGNAL_TRAP, thread_id); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); + /* + * Remove all the breakpoints when this query is issued, + * because gdb is doing and initial connect and the state + * should be cleaned up. + */ + gdb_breakpoint_remove_all(); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { const char *p; int ch; uint8_t mem_buf[MAX_PACKET_LENGTH]; char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; - char thread_id[16]; const GdbCmdParseEntry *cmd_parser =3D NULL; =20 trace_gdbstub_io_command(line_buf); @@ -2266,15 +2283,14 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) put_packet(s, "OK"); break; case '?': - /* TODO: Make this return the correct value for user-mode. */ - snprintf(buf, sizeof(buf), "T%02xthread:%s;", GDB_SIGNAL_TRAP, - gdb_fmt_thread_id(s, s->c_cpu, thread_id, sizeof(thread_i= d))); - put_packet(s, buf); - /* Remove all the breakpoints when this query is issued, - * because gdb is doing and initial connect and the state - * should be cleaned up. - */ - gdb_breakpoint_remove_all(); + { + static const GdbCmdParseEntry target_halted_cmd_desc =3D { + .handler =3D handle_target_halt, + .cmd =3D "?", + .cmd_startswith =3D 1 + }; + cmd_parser =3D &target_halted_cmd_desc; + } break; case 'c': { --=20 2.20.1