From patchwork Thu Mar 2 19:08:34 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: 658153 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp68621wrb; Thu, 2 Mar 2023 11:19:01 -0800 (PST) X-Google-Smtp-Source: AK7set/VO7YVVcUjBtbfJw0MAoMKc1WUl/18uza31Q8mGCnhFHDHQwI0g67kTtCIM9boZEH70PrQ X-Received: by 2002:a05:622a:186:b0:3bf:d4c3:365d with SMTP id s6-20020a05622a018600b003bfd4c3365dmr19810087qtw.14.1677784741054; Thu, 02 Mar 2023 11:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677784741; cv=none; d=google.com; s=arc-20160816; b=Ywx9X6kbnEi/4ZAawJQKGLlexW0kXYNd/vcm2nrg08btCerc8k3r06vYVU6dySHPiy cDOnGtTJZy8PnAVOy/nhDghek+bEY4d0putWhmE5+1vZ65CQg9x3DW2i+TuR4UiePwbP 40B0mt5mS7f8fJXBGvaXDOiFCj67yiaqjVEonMv9m4XcbNM+ACh+UZYPIpru8ZqkB2ea Ep7wewSXIRPdRhrCeUTAl6I4ZgOMSP010CN2Zkq+QynGnYiaLBwKRPGOMvKcMqXF2F0X bJZn0UNbqVQyjvXml6IAAdukZHOLduMQfIghxHudP0T4IFn9vNX4UoNeNzkpAgAjHhC7 undA== 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=hPckY1i9/afyDgbEgGvXK1gW63TVchEE6fBLm/0KY9U=; b=IzR6MDLtrbw0rI5WByECiihUtFHU75Hopu94ZBzvQfdLJ5CfJXvpcGlM25dIh/im3t Vml4XStLpW8i54wIOag8OffvMkbcOmjc3KD3VfwBDE6hRqXh9L0CrqvjiXZG/om10NKz nMcHFBX1Pr55zhksgWKC4SFnJoMNfb2QM7jkdaS8aoGJBCnI6d/94PzARaVE8RHKSE0I fkvZgYHvVdkkBEa346rMAfnQ6BJELv8yG/Z9fyrc5Dul/Vnn1xJ32fsB9JAcwQx9r8us e0NL36xtK1fLvmLkBENU7kF4LaxduAW3o2lXhX00kzQZ5Q0AAWXynOwChhgXYnbg64QX WlQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N+KnOEUB; 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 e21-20020ac84e55000000b003b86c80c129si225023qtw.685.2023.03.02.11.19.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 11:19:01 -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=N+KnOEUB; 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 1pXoO8-0007f4-5v; Thu, 02 Mar 2023 14:14:48 -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 1pXoNz-00079A-Vq for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:14:40 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXoNo-0000n8-NY for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:14:39 -0500 Received: by mail-wm1-x32e.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso2569647wmb.0 for ; Thu, 02 Mar 2023 11:14:25 -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=hPckY1i9/afyDgbEgGvXK1gW63TVchEE6fBLm/0KY9U=; b=N+KnOEUBoGC/1nIkicXd5l1SOjqX1TKqBCd6X9BCF5PvOmhg8hQQsf76J1FgTBhn9i 0YfaCyhmP9+XTknmV7jzdRVtD7aXqXBldUOx3tmOqNq6Kj1EB1FZIWYX2NtebKYBJp/7 hDqQbdh/SlPVDDDhXLBnBQGjxYj9/b3QQzDN7iK4UYsC22Z9p6/2QSITDfKxGf01j2s+ E32z5Oh4HVVnWgYaneyGfz9g+y5zCUMAME5WuQncSPioHTjSWOlDksbPJLzGamRlU5eU uBZTqryWMS8kpnj3QoGRWIpldwfax64K6UIrncN9dpWIPMLqtPGzVk/aFFE8ASANDfWu m8Xg== 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=hPckY1i9/afyDgbEgGvXK1gW63TVchEE6fBLm/0KY9U=; b=tay2IriVyPdWnPTJIu3VtrPbOiMBQghJV2c1V7Y6VBxbhR6flgKqTq/3dclNjhVFZC EzrX/KALNFQIRZOB07iGZ8hwU9b1Hgv5V9F0H4N+eaYVela85C2LX0ajmLvEHQxsQ1aE us2UZvkKexgkez4uz8k8nGshvRz5bHCcsp8GVLI3fQMJQKOgx3EBtmWFGXuTAbm/AaFS s8cmLh8WIzx0UBl/nejLnjU8IoRknBOVajl3nT1pymM3GENDlddYdaCwHko7OhPaGWa2 mZG67g+T2E1LNkos01USMimY60DY1YD2uejrIYUMReA9xqjvTrNQ+sKMcZHTcVejZPwL JA+A== X-Gm-Message-State: AO0yUKVdPn/DDlWf5GSJPhfLjIgHfEZ7AAnyIKygXHLM8jOwTr3zXrPb 40mfGaIXj5VlzcQEB06hatjIWg== X-Received: by 2002:a05:600c:310c:b0:3eb:395b:8b62 with SMTP id g12-20020a05600c310c00b003eb395b8b62mr9248096wmo.39.1677784464419; Thu, 02 Mar 2023 11:14:24 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f2-20020a5d50c2000000b002c704271b05sm144559wrt.66.2023.03.02.11.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 11:14:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 86ABC1FFC3; Thu, 2 Mar 2023 19:08:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Weiwei Li , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Palmer Dabbelt , Laurent Vivier , nicolas.eder@lauterbach.com, Ilya Leoshkevich , kvm@vger.kernel.org, "Edgar E. Iglesias" , David Gibson , Max Filippov , Sunil Muthuswamy , qemu-s390x@nongnu.org, Stafford Horne , Bin Meng , Marek Vasut , Greg Kurz , Song Gao , Aleksandar Rikalo , Liu Zhiwei , Alistair Francis , Chris Wulff , qemu-riscv@nongnu.org, Michael Rolnik , qemu-arm@nongnu.org, Cleber Rosa , Artyom Tarasenko , Marcel Apfelbaum , Eduardo Habkost , Yoshinori Sato , Alexandre Iooss , Daniel Henrique Barboza , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , mads@ynddal.dk, Mark Cave-Ayland , qemu-ppc@nongnu.org, Richard Henderson , John Snow , Xiaojuan Yang , Thomas Huth , Paolo Bonzini , Mahmoud Mandour , Aurelien Jarno , Bastian Koppelmann , Yanan Wang , David Hildenbrand , Taylor Simpson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v4 14/26] gdbstub: specialise handle_query_attached Date: Thu, 2 Mar 2023 19:08:34 +0000 Message-Id: <20230302190846.2593720-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230302190846.2593720-1-alex.bennee@linaro.org> References: <20230302190846.2593720-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.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 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;