From patchwork Fri Mar 3 02:57:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 658464 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp226353wrb; Thu, 2 Mar 2023 19:01:33 -0800 (PST) X-Google-Smtp-Source: AK7set9pyeR5hXYujObdjEqYcBXY2WPsGIirIuBqiRfLoioVD+R7/P0dM7F8iJt/X3K73SSxtbS/ X-Received: by 2002:ad4:5b86:0:b0:56e:9317:eb9a with SMTP id 6-20020ad45b86000000b0056e9317eb9amr615880qvp.29.1677812493664; Thu, 02 Mar 2023 19:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677812493; cv=none; d=google.com; s=arc-20160816; b=pqcwst+uNJo7CjxtxDZvLkogiUq/hBfF6cFrhyuR6Gw+5EIQdSdA0aZg9WFLP+GVGb g+eIhS/X87pz5f44QcoQyxrjAhczLh6aHtTT4ZwcLHPztjx7jV5nFCGGRtYr0YhWP5+W L0UpY4owO5Vz3K8GvhyJRmaOr2oPL3tKux4Tf6XXTpwiSJDwnB0dvLa8mA2Wy3QgSBRH feJBXtp+QthW/+xgP2dfpU9cExLqc4blC4PW/0herSbdnt3uFJGymuflTg//TnkL/oMY REumdyryAaxXO+Fi1/31zmHXxTVzbl/I86kPqxe3rzXzgmKyrJaRvTSKLi+tfnQk2vD8 WBVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eLmx2eJEzrcuefRjyJcG44ypWKcZev5YnQRPSJMGOkQ=; b=I19bFuimKYiUHPaiaCUtSPaCzsDvb74F6/YWUu4sGgCD99sxRJtwJ1wcqQYlNnj3g6 KWr6+LvhvQhivNu6bK/kErsCt6gNdyOzO2bGB9aKG2NrsgN1vGY8A63yYO290Qx9VoUV /aTfYLlqgMUau7v/hj44apmRW7Rr3kd4DEyI3PdSeEHJCpz9GJVXACXX3FFWx0GOA0rz Hxe6r/TGAkCtALgoj/GLg5QmDSKEQ4/0YCOWTMLowR9fzSYrRlvbbQE3jCRCICoHeOFe SAKadDyLp4qf62Mk/XPGJiK7H3vbjK5IinIFK4v0ZDy0cVxcCWENCthjqjR1oqLzz1y7 w/Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EOPJ71RO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d19-20020a05620a241300b0073ba6e7f4f8si1070348qkn.262.2023.03.02.19.01.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 19:01:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EOPJ71RO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXvco-0007WB-Lx; Thu, 02 Mar 2023 21:58:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXvck-0007Tj-EM for qemu-devel@nongnu.org; Thu, 02 Mar 2023 21:58:22 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXvci-0001qG-K0 for qemu-devel@nongnu.org; Thu, 02 Mar 2023 21:58:22 -0500 Received: by mail-pj1-x102d.google.com with SMTP id y15-20020a17090aa40f00b00237ad8ee3a0so967570pjp.2 for ; Thu, 02 Mar 2023 18:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677812299; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eLmx2eJEzrcuefRjyJcG44ypWKcZev5YnQRPSJMGOkQ=; b=EOPJ71RO/fkKGs8g/MCBwM9kCbc4f0MSBSeB76VvG/FL1T2K3brPGOGy7hcuzXe/vR f72pPwH6MTef97wJDPBDUXxCQ8t9RFUZDKbfbwTDr+bvzAAqQsKIzmCSUcjSViE0leSz 4PxO/y8/6cRnkPy+khNhYa6slCol9HHz0R0H31EcKl2zmeyGg1CFk1nLGYocXj5/tw7O QSCBx46kpW11tCJOb4leHCf7bXcf7JAyfoUY9buCI4yBj98M+GalTZ754D+a/TMwnNyJ viOoq3NKZ7K9dw5ttw6tP2hE8m79FBXPU4n1pedg0/eYVs0RBQBSlTY6qzTYhCapsI6I 4qUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677812299; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eLmx2eJEzrcuefRjyJcG44ypWKcZev5YnQRPSJMGOkQ=; b=4FJnqgPJdgj0Bqmc7d63r86c8sh2cvIZhOEFN8OuczTvng5ioAbUxEsj/UZgVj7SEs rSJ1vwCuXTTax+CLCb1+iYsUUpzLvVtBXj9KZSWlLhyKyal+ur09jR89kQPRmpMotxVe bT76en8g8T/ELQg0uTbWVGG0sKv9MylVSyboVZC7rjo33Qp0XxYBq2t1pWcLNnIuL55a /R+NlRmTNp3IUN8ZEe8a5EzfElePfKXDWZKRTs/2QZdnQ9eS7uxWIu/S/m4bLW65PykO E7A29MkLkaKVVt+l1GUPgJnxTDgB9DnIZysR2FvRr8apNMkOojf4zNemIyxZdWSPNC2T aGBQ== X-Gm-Message-State: AO0yUKUVwEYhZudTBHd+opQf3m3FFu1M2e9qII8X9aQMzwwUu6TOgk8D wn3mup2YzQmg8dETrc0QkO244yaOXillDQ5F8rU= X-Received: by 2002:a17:902:f54b:b0:19c:f16c:5cb4 with SMTP id h11-20020a170902f54b00b0019cf16c5cb4mr653004plf.1.1677812299238; Thu, 02 Mar 2023 18:58:19 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:f3e6:4626:fbc8:b2ce]) by smtp.gmail.com with ESMTPSA id e4-20020a17090301c400b001992e74d055sm372244plh.12.2023.03.02.18.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 18:58:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4.5 14/29] gdbstub: specialise handle_query_attached Date: Thu, 2 Mar 2023 18:57:50 -0800 Message-Id: <20230303025805.625589-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230303025805.625589-1-richard.henderson@linaro.org> References: <20230303025805.625589-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée In both user and softmmu cases we are just replying with a constant. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20230302190846.2593720-15-alex.bennee@linaro.org> --- gdbstub/internals.h | 4 +++- gdbstub/gdbstub.c | 15 ++------------- gdbstub/softmmu.c | 5 +++++ gdbstub/user.c | 5 +++++ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 6534e373cb..20caacd744 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -154,7 +154,7 @@ int gdb_continue_partial(char *newstates); void gdb_put_buffer(const uint8_t *buf, int len); /* - * Command handlers - either softmmu or user only + * Command handlers - either specialised or softmmu or user only */ void gdb_init_gdbserver_state(void); @@ -183,6 +183,8 @@ void gdb_handle_query_rcmd(GArray *params, void *user_ctx); /* softmmu */ void gdb_handle_query_offsets(GArray *params, void *user_ctx); /* user */ void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx); /*user */ +void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */ + /* * Break/Watch point support - there is an implementation for softmmu * and user mode. diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 0476ee7039..52d1769f57 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -46,12 +46,6 @@ #include "internals.h" -#ifdef CONFIG_USER_ONLY -#define GDB_ATTACHED "0" -#else -#define GDB_ATTACHED "1" -#endif - #ifndef CONFIG_USER_ONLY static int phy_memory_mode; #endif @@ -1673,11 +1667,6 @@ static void handle_query_xfer_features(GArray *params, void *user_ctx) gdbserver_state.str_buf->len, true); } -static void handle_query_attached(GArray *params, void *user_ctx) -{ - gdb_put_packet(GDB_ATTACHED); -} - static void handle_query_qemu_supported(GArray *params, void *user_ctx) { g_string_printf(gdbserver_state.str_buf, "sstepbits;sstep"); @@ -1787,12 +1776,12 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = { }, #endif { - .handler = handle_query_attached, + .handler = gdb_handle_query_attached, .cmd = "Attached:", .cmd_startswith = 1 }, { - .handler = handle_query_attached, + .handler = gdb_handle_query_attached, .cmd = "Attached", }, { diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index 04e75449a2..7c180b779a 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -446,6 +446,11 @@ void gdb_handle_query_rcmd(GArray *params, void *user_ctx) * Execution state helpers */ +void gdb_handle_query_attached(GArray *params, void *user_ctx) +{ + gdb_put_packet("1"); +} + void gdb_continue(void) { if (!runstate_needs_reset()) { diff --git a/gdbstub/user.c b/gdbstub/user.c index 0c8cd028b1..c0fd83b373 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -345,6 +345,11 @@ void gdbserver_fork(CPUState *cpu) * Execution state helpers */ +void gdb_handle_query_attached(GArray *params, void *user_ctx) +{ + gdb_put_packet("0"); +} + void gdb_continue(void) { gdbserver_user_state.running_state = 1;