From patchwork Tue Feb 21 22:52:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 655392 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp371398wrb; Tue, 21 Feb 2023 14:57:07 -0800 (PST) X-Google-Smtp-Source: AK7set/8ifKGOGG6qEoI1Q0/cYNLTnlAOFUqRQwDFdR2k1umo6iYSzNkt5PAnDAn6Hz9g92LT3Ux X-Received: by 2002:ac8:5b8c:0:b0:3b9:b497:109e with SMTP id a12-20020ac85b8c000000b003b9b497109emr11833964qta.18.1677020226838; Tue, 21 Feb 2023 14:57:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677020226; cv=none; d=google.com; s=arc-20160816; b=0DDNuko0y5xLyq0eoaxlONCjUdDViW1REyRgJ6lFTADCeIhq5XFv2gEgDCMEU5bV8/ xEkodIFToumG190zC8enQ6tmy41qtw1Lo9NYyFiyZk1DP3gYra1AVkS0i42AR0a0lcFi sI6r8UFNWOipPXnV+MHBAHFxFxgClWwBrF28u6V40t5j5oOr9xZ/p3o1ekaIWnc6ojVE Mg7jF6YpHQWQUZMcVpZSkUoCQPV6JVR6SYKcGZnrv5x90hR6SGo8R9EwVWE3VF4eAZTs Tip3jYwLQFfDD0FIQl61T1bB/y6tlEs4tv4uT60o0dD47ALcvFLBMKLac4vngcOWAz+o 5eww== 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=6yZplVwk5y7jjRL3DqnzbL5VWfL6vttjPtvPuvL0LbM=; b=w72mcCmqIWa8AxKMlnl1VSThY2drWko+zhTlj0aKV+94+D7T3QSV8Kuj4QFwAZIRve u3Z7SV0nKGkyFCmGtD1SI5klsq+6O6po3KqJ3vcs5eojU0UFmMwGN+AbhuP2MDJI8SEC LgWneHgW/1uG610aCUoOM4qP90UDX9cFMXzE9UEvDzvROP8uO+ts+YYctCSw9OZTXIBZ wDX/Sg64YGJH29kYsHFlP6JR7N/qBdQ0swmOdc/OYVfjf4nK3qNbXBiYRhWqLT22XpGP 6yjX0EGJgVk17NuXprxANJKsn11I3OUtjP20l9jRonD+uTNHLQddu9O+YgcnrEp2fv26 JUnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cy66sKvC; 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 s38-20020a05622a1aa600b003b693ee1a1bsi12484860qtc.96.2023.02.21.14.57.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Feb 2023 14:57:06 -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=cy66sKvC; 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 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-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_Benn=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_Le_Goater?= , Eduardo Habkost , Bin Meng , Bastian Koppelmann , Palmer Dabbelt , Marcel Apfelbaum , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Aleksandar Rikalo , Paolo Bonzini , =?utf-8?q?Alex_Benn=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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;