From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D03DCC61DA3 for ; Tue, 21 Feb 2023 22:57:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUbVs-0008LW-J0; Tue, 21 Feb 2023 17:53:33 -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 1pUbVL-0007cR-3G for qemu-devel@nongnu.org; Tue, 21 Feb 2023 17:52:59 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUbV0-00043E-Ke for qemu-devel@nongnu.org; Tue, 21 Feb 2023 17:52:58 -0500 Received: by mail-wm1-x32d.google.com with SMTP id k37so1402682wms.0 for ; Tue, 21 Feb 2023 14:52:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=6yZplVwk5y7jjRL3DqnzbL5VWfL6vttjPtvPuvL0LbM=; b=cy66sKvCUrn1KSGGBVivaf5xNFUoVUI9fDy8ze5nQAFT+IfieEY6Xh2RoHF1xGOL2N 1yPr40zwBJjxWDVzuKMTiih+rdpnNJtY/TwDnppeFFEyylvfG/sEyxx5NeqTRx3Juw+D ITvwS9MJ0HysvbvreVwzMROQeAjQGwu7Nf+sIvmEy0G+l+0JtGfZFtGWHsFFcIjRCj5E q4ICHBcxuI5GXh7ZWLGMZnWyCWHNhzr8FLNrvEhXQwLbMRhxVk1nIkT4icOzDC78CSkS RUfo5BR/XNZQ505IJcTrBwakdB68uhhrIic9ijz4R8M0bEYUDVpkbpV09z3aAZzQA/XA /EdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=6yZplVwk5y7jjRL3DqnzbL5VWfL6vttjPtvPuvL0LbM=; b=fytDhwlsTC1iMbf45RPatfmb3fe+RtXQyJwd1rdeutbai8qX+nkHvZjZyKNW3Q03Y3 U7Hg8+cBZ82YXgGQQS9QSvIT6WqgVEfUFhsSMukhm5eGSMAQUCitMpgDhnAwp4kEweDZ uBqZkfBPS7HWML8AsEpttVIRTbRXMQfBLY7x0S7G5BLyQKKYA7/UsWuTh1UY9lAlGlJS i2Nx5/B5Nflc9MrLe+y7cF15LjutFql7XqTLsxKA9idp50rmdYfLNntObiTteLHAzUKA PqSg2skmEuMlrmmMSRFIGC60W2001Cj5Red+q53a6yJkRBt45S4qR2K6hy43UVQ4N6uv M7Gg== X-Gm-Message-State: AO0yUKV/VsMjetZpcIMTzBwXcFyR29dO97HKCiLQeti2edTYI1W0177u ZUqzWPPFSQmKqSaRjQKKYaavBQ== X-Google-Smtp-Source: AK7set/sDNmL/xf6MrdMOrmC0c5p1RfMwzxqteg7BWUetSU6PhBqNMJ1HBxn1FtKB4orLqnPRvnc2w== X-Received: by 2002:a05:600c:1f06:b0:3df:9858:c03c with SMTP id bd6-20020a05600c1f0600b003df9858c03cmr5322893wmb.17.1677019955757; Tue, 21 Feb 2023 14:52:35 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id fm18-20020a05600c0c1200b003dc1d668866sm6474680wmb.10.2023.02.21.14.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 14:52:34 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1F3E81FFC3; Tue, 21 Feb 2023 22:52:29 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Yoshinori Sato , nicolas.eder@lauterbach.com, Stafford Horne , Daniel Henrique Barboza , Mahmoud Mandour , Taylor Simpson , mads@ynddal.dk, Marek Vasut , Artyom Tarasenko , Alistair Francis , qemu-ppc@nongnu.org, Yanan Wang , Sunil Muthuswamy , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eduardo Habkost , Bin Meng , Bastian Koppelmann , Palmer Dabbelt , Marcel Apfelbaum , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Aleksandar Rikalo , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aurelien Jarno , Xiaojuan Yang , Richard Henderson , Peter Maydell , Alexandre Iooss , Chris Wulff , Jiaxun Yang , David Gibson , "Edgar E. Iglesias" , Greg Kurz , David Hildenbrand , Song Gao , Ilya Leoshkevich , Max Filippov , Mark Cave-Ayland Subject: [PATCH v3 13/24] gdbstub: specialise handle_query_attached Date: Tue, 21 Feb 2023 22:52:16 +0000 Message-Id: <20230221225227.3735319-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221225227.3735319-1-alex.bennee@linaro.org> References: <20230221225227.3735319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.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=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- v3 - remove allusions to possible linker optimisations --- 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 3912d0de38..3875c6877e 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -152,7 +152,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); @@ -181,6 +181,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 76c24b7cb6..0d90685c72 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 @@ -1672,11 +1666,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"); @@ -1786,12 +1775,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 0232e62ea4..ade0cc366c 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -439,6 +439,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 33a0701cea..90dfe49f27 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -340,6 +340,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; -- 2.39.1