From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694501933; cv=none; d=zohomail.com; s=zohoarc; b=AXB2zsJu06LyJMrFrm8+MbEXM36tlwtJ3OFii9Ce2nd64UiH/uXxTa32HAoGje/sFamG6v2rXnJ46Od+P/7v8aGlD096mu7iNCF+ONmCQl824qFvk/J+foyhQGqZ9OKJ+XoSRcKQ/KQT77lQJ8rQOtetzGjFbLzrJLjwYPhbFCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694501933; 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; bh=95QVNg5HPZWQUU3gv/yGVv9Jo3t2dmNs4n1dgqSbSvE=; b=FniN+mEo+7FJ6sFajsj7mA4DQJYNZ83bQkA8WluLCU9bxKdpyihbH5ZtY2ginrr6zddMSKVPGtTuwyh89vrI3ZO8cCnzZe5ObUiyBhGt1tBtLDhQ0Tw2/FbKcx0ZUW2398YaIT6Cl+hvukToRiWhvi8mPsKLHmdpvrirLpo9t3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694501933334341.84912970583025; Mon, 11 Sep 2023 23:58:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxLw-0000NM-Nw; Tue, 12 Sep 2023 02:58:28 -0400 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 1qfxLu-0000KJ-5g for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:26 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxLo-0007RX-Ts for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:24 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-26f3e26e55aso4148987a91.3 for ; Mon, 11 Sep 2023 23:58:20 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501899; x=1695106699; darn=nongnu.org; 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=95QVNg5HPZWQUU3gv/yGVv9Jo3t2dmNs4n1dgqSbSvE=; b=BExj3Mwr+t6oVjUxfHXNY59BdT6gAVocQrKbf5bmMwlTmxLoRIQOF2xqPk84TRto/i ElvoYzPCFVcc1nK+ueMYmXRngLhg5fVr6W7F14htwY/ZXXXgqeIxs68CbxVdOOdCzSRH HIJ2F+rD/SHpZfO439W4/JvNgL05M85JMidzNfcpoi2mOx/xePI5RnS0jkMWy3+1oSOl rxYK4YsBfyUT9JZ0wbvT2V7/Ci/OKbkVGLF3Ad2JUG1LWsivXi9oZwKksaUUztHXm4iN yc0vO2t5nIUyjH/r5IRe7Mt4e2Ov1F3OzU4bNmne17Ml0wlyjlj43rVoi8w0kC0U/Lkr XxtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501899; x=1695106699; 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=95QVNg5HPZWQUU3gv/yGVv9Jo3t2dmNs4n1dgqSbSvE=; b=D2lNa70e2yRxIDLfZ+sLHjYzgAGceyIVlQVICIrvU5O39Q9hX4HiXOGr0tw/uU5ea/ NecunSElsNeEGmT00zVDs99/tBRoD8bC9lbtcjAtV0Z7u85pTFJeGEz6IIXOIF1w+gfy 9STIDizLtGiqzYz4ePZNjzZDjW3CxCCFO7BcnoT95A3bAkL2o/uFAJKIUlYGUciJ4+GE i1acjOAc619LUV/L6H6ExjEQr0pnK/+C4qwplymmof2O23x1PqMt2hsY/f17kgAgdD4q TDey+3emomlVoiXGSIWRsTo4dFxGuHbS46MNHxBrKVNOjsyq2CuBYM4eCj/e8Gty18yr MvYA== X-Gm-Message-State: AOJu0Yw5dwFefriW2AIva69a8/v8rv3Rap0/DEd2toJ3FQScln+zbfhk VdYjvbXMmmoTC8FGeuxw9Q9lHi1+IsrfsosY0Zg= X-Google-Smtp-Source: AGHT+IEYdAUwOFXmuQlEYsLpfeBlNpCUKVA7JrtlQPqTCHSrEHBb92xLEVqp/PC16xG+5EaVx7ty5g== X-Received: by 2002:a17:90b:3910:b0:26b:5ba4:4948 with SMTP id ob16-20020a17090b391000b0026b5ba44948mr9838725pjb.12.1694501899736; Mon, 11 Sep 2023 23:58:19 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/11] gdbstub: Fix target_xml initialization Date: Tue, 12 Sep 2023 15:57:56 +0900 Message-ID: <20230912065811.27796-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::1033; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694501935544100003 Content-Type: text/plain; charset="utf-8" target_xml is no longer a fixed-length array but a pointer to a variable-length memory. Fixes: 56e534bd11 ("gdbstub: refactor get_feature_xml") Signed-off-by: Akihiko Odaki --- gdbstub/softmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index 9f0b8b5497..42645d2220 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -292,7 +292,7 @@ static int find_cpu_clusters(Object *child, void *opaqu= e) assert(cluster->cluster_id !=3D UINT32_MAX); process->pid =3D cluster->cluster_id + 1; process->attached =3D false; - process->target_xml[0] =3D '\0'; + process->target_xml =3D NULL; =20 return 0; } --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694501928; cv=none; d=zohomail.com; s=zohoarc; b=OJY/ybupiNgFbA7Mxb13tiLAKAqNzajkAHM2be3FVveEkuU3imhjUskrwgxiDjoaEyuzjkeJQQiC/FgFR8SGMjkNEBlM27KNhYiqpMjoiJcBOaglKBrgQsweSNVZNV03E0DQ01nHKxqW+dkE/1iWtXX4zRElf6E2p0WHnLtOKAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694501928; 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; bh=Owf73A2jtbtMsGA7cBmEhb5GKITEmhQO9JJT6nRhMFY=; b=C0l9zbqpzR1cUcyy9xye0Z41CAyZSjN55v7cyv0rH2ijk7E5pMHpsmShDjaIkcpusSUzSJNvwjTQTzRA1TblJagtfG3U/8IhYBamH6qMWtcGglQQJDn1RyvMD359MK+XFHp293aYB5tGLQdsYoqVdfh1gnKV8NYFBJje9kH9xKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169450192850990.56945707776231; Mon, 11 Sep 2023 23:58:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxLv-0000Lj-8T; Tue, 12 Sep 2023 02:58:27 -0400 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 1qfxLu-0000KK-5b for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:26 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxLr-0007St-0H for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:24 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-565334377d0so4469617a12.2 for ; Mon, 11 Sep 2023 23:58:22 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501902; x=1695106702; darn=nongnu.org; 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=Owf73A2jtbtMsGA7cBmEhb5GKITEmhQO9JJT6nRhMFY=; b=E+cfDBW8+2iR6ZccePdKoc7BKP7W+xZknkljYGnh5vClRN5vXbG36cgEH2XKKlEYTu G6BH7KOAvUkjDiEeXleoUjwBzl6SGfASGKco15EF8e2Jxnk86NjVcZ14lfkgsaKIEAml BFsvL0nFNd2rjZXdOmX5xIIoiBGFzCuFbTs2Mp87gGNUH8AuB34Uvp8U2ubDZLspVLfY /C9BP+ki0q/levhRAWSoUNVe9SYgPD1h5XU+yNvXDPnqlUr28idNxW0KKOIKQ+I9rtSB 1ikqB2/Q2XDEilCMXdJyrliqR4Htyu9+f4bd0z89h2cb6cGvrzkdAcp2hB88nfDlT2G+ 21wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501902; x=1695106702; 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=Owf73A2jtbtMsGA7cBmEhb5GKITEmhQO9JJT6nRhMFY=; b=lO5hbqW4lbKTyBfo3WV3fJcPm4MqBWD9/71osRQJtZXjkXs+1OpcG13mcbcAaew2na uWsocHmT5k5P28n6iN7g3utrnmo82MF0/ozFOiNIOiitxqS87pu4ZqbxKhWieXqiLNai NLgqrFFPazV3e7kV3DTXG94MqjorxeIMdRXEWaY6Q5Pggw3UIL9bBxUAyNDrw8+IlcPA +CqvgBz2OLGNHtFbbgkjlOjd+DxekdBCrHOeYPnMv3ubwZ8RMulZCTi/wa/AAGrEIIdt DDQM6vGfHi+HQHISx0Hu0LHwtNKWZDdY34OeqozejPdqBMwDL5U1BwvBS5Gp1b+fyyA1 Sbpw== X-Gm-Message-State: AOJu0YwFlqMyG2lNt4NzKiWaQeMtBtosStG6VRapH5SLY7k17f504Nbq Aol50iMVj/kzRUJh64igXyX1pw== X-Google-Smtp-Source: AGHT+IHSF8ORWAyNs5qL+G5QIsSfyYVf+7q8gZ2v36J4GETyOEJt+GNOPOlubty2FlDSCSI2uRFOzg== X-Received: by 2002:a17:90a:2ac5:b0:273:cec7:23ee with SMTP id i5-20020a17090a2ac500b00273cec723eemr11088426pjg.37.1694501901805; Mon, 11 Sep 2023 23:58:21 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 02/11] gdbstub: Fix target.xml response Date: Tue, 12 Sep 2023 15:57:57 +0900 Message-ID: <20230912065811.27796-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::536; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x536.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694501929327100001 Content-Type: text/plain; charset="utf-8" It was failing to return target.xml after the first request. Fixes: 56e534bd11 ("gdbstub: refactor get_feature_xml") Signed-off-by: Akihiko Odaki --- gdbstub/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 349d348c7b..384191bcb0 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -396,8 +396,8 @@ static const char *get_feature_xml(const char *p, const= char **newp, g_string_append(xml, ""); =20 process->target_xml =3D g_string_free(xml, false); - return process->target_xml; } + return process->target_xml; } /* Is it dynamically generated by the target? */ if (cc->gdb_get_dynamic_xml) { --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694502005; cv=none; d=zohomail.com; s=zohoarc; b=XFmsGAN5doJGR8eJXnCkUkA6yscV2FFGK46a75sBKWBl6A4Tp9lQbIT0xB+LMMXXRikQoEaoLh2FfY/evoTh9vf6MIhItrrtihrYz6GKG6Z3s7EbQYWnLg5mAWjj7j1eLCLnUgM6b18yAB9KmKd86VCV1T9ZL7HFUX0Dl6Oywi8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694502005; h=Content-Type: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; bh=2Hs61unU0rT5Xs/IozPbclEmnlWYOJEOWqFw7vuLJvQ=; b=SINPt9Cbh+QfCWAb6qardrGdUtpoZGGZf81U4kCtX6VSmUIXFQUAK0imhZsf5ZZhNCF4ufKkELCJDWWDQqa1cmDrRydAcHAZDJVLGhZyblfdtOpdjqEUGhf09tIK8ahThEAPoO5RV0qiBqXaaTtH89lQlIVf9X8ijmac3JWuAQc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694502005794390.459594407346; Tue, 12 Sep 2023 00:00:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxLy-0000OP-AO; Tue, 12 Sep 2023 02:58:30 -0400 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 1qfxLv-0000MR-Nc for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:27 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxLt-0007TO-Fu for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:27 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-26f9521de4cso3711317a91.0 for ; Mon, 11 Sep 2023 23:58:25 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501904; x=1695106704; darn=nongnu.org; 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=2Hs61unU0rT5Xs/IozPbclEmnlWYOJEOWqFw7vuLJvQ=; b=OpCt3XPKFoXqE1ljaRunsk/2+xlEl6ENjGFMBQGmJm/C/oFT19DZd2x/eH4BtAdIj1 p12a1yMV7QOa7NM7Uz0+rrzsMRpRew2xTuZQzU84eNKag4Z51FnOB9TBl9h8dLuMobOg Sn1Nf5ZgHmpGIp9Y4lEMqpxdbosD3uWbCz7IxFSlkUPKc4XruBnWTUIBtMMvOWYOej9T uV/I9ZQwz4PbCCHmSUEZqT/KqGsQgL3ukqsX00Yqtnm+QS9X8jJ95VZOH5DlFnNZZTLR bPFHzwYU27DCGbysLhXAqZ3CUP3xj0xxN46V/gpYW9iCr8ULUwAmfIpFeAYRBoyfzjHn Md/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501904; x=1695106704; 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=2Hs61unU0rT5Xs/IozPbclEmnlWYOJEOWqFw7vuLJvQ=; b=n9UuBYvrFM/CnT/R1OHy7RnhqTWMgV0gRR2ev7PtzCAaAMp8Bbm8Bvp2gvpN9UQMBf qdMp7bFigvSQGyZlvREzY8bLgQpXMnCSCccPR3l7V1U8+jnVynYTT+1pH2Gp2XcBFj/Y RD5O3rWokx3jKNBVAmqxs54kN525odV/FtGIa75+H9HzzjXzC8iWkzXW4fP+61LTdA4B 2nHBrOepkeIRyBnH8V20d1c+PwdlEbKGMDejaKprphTxu1aWWtLduKDKzrNnbB4umbrL fBxISDlRsJKhuqJmrGvdPQfNp9XgCiyOaNaWkDHuWt1FxrX1zHn9XWZFLTsC12wejD16 dRxA== X-Gm-Message-State: AOJu0YykyVEuaYAEYC/UUTQbT4oFhmX6Q1Zj7iSku5PwyrDZ1iXWeS31 kKHN4KFdADdynhCzSDjgo5o+RpjXmlDAsAVEwik= X-Google-Smtp-Source: AGHT+IHnFOoC4oAXqxcReWOWhhKQZok/pSMDGoyXh3WwLPNnP8r6kYmINNfWWF7ow+4Bm0myfKeL7g== X-Received: by 2002:a17:90a:aa85:b0:268:1e95:4e25 with SMTP id l5-20020a17090aaa8500b002681e954e25mr9287013pjq.17.1694501904059; Mon, 11 Sep 2023 23:58:24 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , Alexandre Iooss , Mahmoud Mandour Subject: [PATCH v2 03/11] contrib/plugins: Use GRWLock in execlog Date: Tue, 12 Sep 2023 15:57:58 +0900 Message-ID: <20230912065811.27796-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::1032; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694502007907100002 execlog had the following comment: > As we could have multiple threads trying to do this we need to > serialise the expansion under a lock. Threads accessing already > created entries can continue without issue even if the ptr array > gets reallocated during resize. However, when the ptr array gets reallocated, the other threads may have a stale reference to the old buffer. This results in use-after-free. Use GRWLock to properly fix this issue. Fixes: 3d7caf145e ("contrib/plugins: add execlog to log instruction executi= on and memory access") Signed-off-by: Akihiko Odaki Reviewed-by: Alex Benn=C3=A9e --- contrib/plugins/execlog.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index 7129d526f8..82dc2f584e 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -19,7 +19,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGI= N_VERSION; =20 /* Store last executed instruction on each vCPU as a GString */ static GPtrArray *last_exec; -static GMutex expand_array_lock; +static GRWLock expand_array_lock; =20 static GPtrArray *imatches; static GArray *amatches; @@ -28,18 +28,16 @@ static GArray *amatches; * Expand last_exec array. * * As we could have multiple threads trying to do this we need to - * serialise the expansion under a lock. Threads accessing already - * created entries can continue without issue even if the ptr array - * gets reallocated during resize. + * serialise the expansion under a lock. */ static void expand_last_exec(int cpu_index) { - g_mutex_lock(&expand_array_lock); + g_rw_lock_writer_lock(&expand_array_lock); while (cpu_index >=3D last_exec->len) { GString *s =3D g_string_new(NULL); g_ptr_array_add(last_exec, s); } - g_mutex_unlock(&expand_array_lock); + g_rw_lock_writer_unlock(&expand_array_lock); } =20 /** @@ -51,8 +49,10 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin= _meminfo_t info, GString *s; =20 /* Find vCPU in array */ + g_rw_lock_reader_lock(&expand_array_lock); g_assert(cpu_index < last_exec->len); s =3D g_ptr_array_index(last_exec, cpu_index); + g_rw_lock_reader_unlock(&expand_array_lock); =20 /* Indicate type of memory access */ if (qemu_plugin_mem_is_store(info)) { @@ -80,10 +80,14 @@ static void vcpu_insn_exec(unsigned int cpu_index, void= *udata) GString *s; =20 /* Find or create vCPU in array */ + g_rw_lock_reader_lock(&expand_array_lock); if (cpu_index >=3D last_exec->len) { + g_rw_lock_reader_unlock(&expand_array_lock); expand_last_exec(cpu_index); + g_rw_lock_reader_lock(&expand_array_lock); } s =3D g_ptr_array_index(last_exec, cpu_index); + g_rw_lock_reader_unlock(&expand_array_lock); =20 /* Print previous instruction in cache */ if (s->len) { --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694501921; cv=none; d=zohomail.com; s=zohoarc; b=LwDxA2bTzVQrSIkmQWYE8tDATM0V3MNojBVFj1OSfQqz9fnlIGkMUIqGyo1W4Wq9Wx98qQ5af0ZwUyaSkRINe1x7qUvMFOb5Fav4HnTQHDmHS1z96zKN6OWbWhu+cWX//jlwC+H1xdwAo+AL531FO8NbX6viQv4Hyw7qLJuzIB8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694501921; h=Content-Type: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; bh=CedVxHJ+oz37gJfW0cEaF8Er5xU6ptIC3yEdTuWYIg0=; b=YLTBd7j0z2KuBNtf+DmwM3kMy17g/CIJRqjJZnc9oEqt1qAh/4SpHwz8kBOwXq1aKq4kQR5ay6ruDEV60zM4sRJJeJp738FlxzApLAtCj2L4Jc+BNhG1CXyAyToQXejLTspdprhC8wtRcfoBTTuarC/V3Gd6wjfzusKuslANvTA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694501921279169.7523198323322; Mon, 11 Sep 2023 23:58:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxM0-0000P7-Vb; Tue, 12 Sep 2023 02:58:33 -0400 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 1qfxLz-0000Od-Gj for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:31 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxLw-0007Tw-MA for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:31 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-565e54cb93aso2998042a12.3 for ; Mon, 11 Sep 2023 23:58:28 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501907; x=1695106707; darn=nongnu.org; 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=CedVxHJ+oz37gJfW0cEaF8Er5xU6ptIC3yEdTuWYIg0=; b=v/AqskeEGLk/XoooilNZhvW058/TJY78tv2N1vuGcd5kDHPwLx3C1VdSGWMvZHhNLF lnft8DBOoSpeb19R7e7wsTyS/DT2QR5VSvuyQfNUKZ5WHLAlghUsbrDJIEc8g5E5izyR 3fk5cLk9JLzQuVjS3ot2wK5bsCx8hZ2FvPglkdCmRY+yT8fPkB1OvbPMfNBdTCJTgZF4 nEbZLtMl3RDz8m9BvcQLPR5cs/uuhdbH2HM5XjMrfuQHwvRBBc7S7Lg/OmI0TpXFX0Xi ofUMZ3fFqTP8W9eMbibKj8qu/NBSQ57XYHcYu4kzVTwT+6fAJR3Lp1YzT+WAySWSLX2A Ug8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501907; x=1695106707; 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=CedVxHJ+oz37gJfW0cEaF8Er5xU6ptIC3yEdTuWYIg0=; b=w6xX+GncBCvg2J80DiOTCNyn2m9EH7ODdiSTnwxSEJXzoMu8ua7+WKKPN3/NA2gVI7 5Bq90Wr9NK5vyOZJmr3AuTgwa74J0VuR33s9yditk5TEdJdUGWzB1YUvJLLmDk0Y0RMC cZw1SPPVKKnVCx3+P+7UxPK/kzsXd2+yF4ToqswLdRIE6ETMGrokoFBRqi9eDbunSuXS se3h6NwCrD4Ujh4dYdy4DLCujPpENsXewblL1cy2yZF9jcyeHRmfdBFWMzvXAhFZTW7g XSzCJen9lbjY8obt+fznB+Upapsmu90TlQZFus60j41+lfUf+Nv9R4cgVk0GRQk9CHu+ eyQg== X-Gm-Message-State: AOJu0YwrOQG6o+8sJvrFxPQYZqkJ5jTt7d9V0YmhIswMitdBZK60nXzB D1Z4N1nmq1y7jmxqOMrV8wvhVA== X-Google-Smtp-Source: AGHT+IHTSDVmQW1msMTCE3IPCc+nfrZY51MCZqqPeRmWl0fkjeoXOqSyLQ/X9CbrY6cpslWUOeO+fQ== X-Received: by 2002:a17:90a:da06:b0:262:ff1c:bc33 with SMTP id e6-20020a17090ada0600b00262ff1cbc33mr9524059pjv.13.1694501907377; Mon, 11 Sep 2023 23:58:27 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , John Snow , Cleber Rosa Subject: [PATCH v2 04/11] gdbstub: Introduce GDBFeature structure Date: Tue, 12 Sep 2023 15:57:59 +0900 Message-ID: <20230912065811.27796-5-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::52d; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694501923081100003 Before this change, the information from a XML file was stored in an array that is not descriptive. Introduce a dedicated structure type to make it easier to understand and to extend with more fields. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- MAINTAINERS | 2 +- meson.build | 2 +- include/exec/gdbstub.h | 9 ++++-- gdbstub/gdbstub.c | 6 ++-- stubs/gdbstub.c | 6 ++-- scripts/feature_to_c.py | 48 ++++++++++++++++++++++++++++ scripts/feature_to_c.sh | 69 ----------------------------------------- 7 files changed, 63 insertions(+), 79 deletions(-) create mode 100755 scripts/feature_to_c.py delete mode 100644 scripts/feature_to_c.sh diff --git a/MAINTAINERS b/MAINTAINERS index 6111b6b4d9..61ff9234d3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2826,7 +2826,7 @@ F: include/exec/gdbstub.h F: include/gdbstub/* F: gdb-xml/ F: tests/tcg/multiarch/gdbstub/ -F: scripts/feature_to_c.sh +F: scripts/feature_to_c.py F: scripts/probe-gdb-support.py =20 Memory API diff --git a/meson.build b/meson.build index 98e68ef0b1..5c633f7e01 100644 --- a/meson.build +++ b/meson.build @@ -3683,7 +3683,7 @@ common_all =3D static_library('common', dependencies: common_all.dependencies(), name_suffix: 'fa') =20 -feature_to_c =3D find_program('scripts/feature_to_c.sh') +feature_to_c =3D find_program('scripts/feature_to_c.py') =20 if targetos =3D=3D 'darwin' entitlement =3D find_program('scripts/entitlement.sh') diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 16a139043f..705be2c5d7 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -10,6 +10,11 @@ #define GDB_WATCHPOINT_READ 3 #define GDB_WATCHPOINT_ACCESS 4 =20 +typedef struct GDBFeature { + const char *xmlname; + const char *xml; +} GDBFeature; + =20 /* Get or set a register. Returns the size of the register. */ typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg); @@ -48,7 +53,7 @@ void gdb_set_stop_cpu(CPUState *cpu); */ bool gdb_has_xml(void); =20 -/* in gdbstub-xml.c, generated by scripts/feature_to_c.sh */ -extern const char *const xml_builtin[][2]; +/* in gdbstub-xml.c, generated by scripts/feature_to_c.py */ +extern const GDBFeature gdb_static_features[]; =20 #endif diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 384191bcb0..12f4d07046 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -408,11 +408,11 @@ static const char *get_feature_xml(const char *p, con= st char **newp, } } /* Is it one of the encoded gdb-xml/ files? */ - for (int i =3D 0; xml_builtin[i][0]; i++) { - const char *name =3D xml_builtin[i][0]; + for (int i =3D 0; gdb_static_features[i].xmlname; i++) { + const char *name =3D gdb_static_features[i].xmlname; if ((strncmp(name, p, len) =3D=3D 0) && strlen(name) =3D=3D len) { - return xml_builtin[i][1]; + return gdb_static_features[i].xml; } } =20 diff --git a/stubs/gdbstub.c b/stubs/gdbstub.c index 2b7aee50d3..580e20702b 100644 --- a/stubs/gdbstub.c +++ b/stubs/gdbstub.c @@ -1,6 +1,6 @@ #include "qemu/osdep.h" -#include "exec/gdbstub.h" /* xml_builtin */ +#include "exec/gdbstub.h" /* gdb_static_features */ =20 -const char *const xml_builtin[][2] =3D { - { NULL, NULL } +const GDBFeature gdb_static_features[] =3D { + { NULL } }; diff --git a/scripts/feature_to_c.py b/scripts/feature_to_c.py new file mode 100755 index 0000000000..bcbcb83beb --- /dev/null +++ b/scripts/feature_to_c.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later + +import os, sys + +def writeliteral(indent, bytes): + sys.stdout.write(' ' * indent) + sys.stdout.write('"') + quoted =3D True + + for c in bytes: + if not quoted: + sys.stdout.write('\n') + sys.stdout.write(' ' * indent) + sys.stdout.write('"') + quoted =3D True + + if c =3D=3D b'"'[0]: + sys.stdout.write('\\"') + elif c =3D=3D b'\\'[0]: + sys.stdout.write('\\\\') + elif c =3D=3D b'\n'[0]: + sys.stdout.write('\\n"') + quoted =3D False + elif c >=3D 32 and c < 127: + sys.stdout.write(c.to_bytes(1, 'big').decode()) + else: + sys.stdout.write(f'\{c:03o}') + + if quoted: + sys.stdout.write('"') + +sys.stdout.write('#include "qemu/osdep.h"\n' \ + '#include "exec/gdbstub.h"\n' \ + '\n' + 'const GDBFeature gdb_static_features[] =3D {\n') + +for input in sys.argv[1:]: + with open(input, 'rb') as file: + read =3D file.read() + + sys.stdout.write(' {\n') + writeliteral(8, bytes(os.path.basename(input), 'utf-8')) + sys.stdout.write(',\n') + writeliteral(8, read) + sys.stdout.write('\n },\n') + +sys.stdout.write(' { NULL }\n};\n') diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh deleted file mode 100644 index c1f67c8f6a..0000000000 --- a/scripts/feature_to_c.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -# Convert text files to compilable C arrays. -# -# Copyright (C) 2007 Free Software Foundation, Inc. -# -# This file is part of GDB. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . - -if test -z "$1"; then - echo "Usage: $0 INPUTFILE..." - exit 1 -fi - -for input; do - arrayname=3Dxml_feature_$(echo $input | sed 's,.*/,,; s/[-.]/_/g') - - ${AWK:-awk} 'BEGIN { n =3D 0 - printf "#include \"qemu/osdep.h\"\n" - print "static const char '$arrayname'[] =3D {" - for (i =3D 0; i < 255; i++) - _ord_[sprintf("%c", i)] =3D i - } { - split($0, line, ""); - printf " " - for (i =3D 1; i <=3D length($0); i++) { - c =3D line[i] - if (c =3D=3D "'\''") { - printf "'\''\\'\'''\'', " - } else if (c =3D=3D "\\") { - printf "'\''\\\\'\'', " - } else if (_ord_[c] >=3D 32 && _ord_[c] < 127) { - printf "'\''%s'\'', ", c - } else { - printf "'\''\\%03o'\'', ", _ord_[c] - } - if (i % 10 =3D=3D 0) - printf "\n " - } - printf "'\''\\n'\'', \n" - } END { - print " 0 };" - }' < $input -done - -echo -echo '#include "exec/gdbstub.h"' -echo "const char *const xml_builtin[][2] =3D {" - -for input; do - basename=3D$(echo $input | sed 's,.*/,,') - arrayname=3Dxml_feature_$(echo $input | sed 's,.*/,,; s/[-.]/_/g') - echo " { \"$basename\", $arrayname }," -done - -echo " { (char *)0, (char *)0 }" -echo "};" --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694501984; cv=none; d=zohomail.com; s=zohoarc; b=X0SQxhPMqV/ySGlN+v7b5MM6ihA+LI3CD2SymqhNWlAbeY6T1nqUl4DBRD6jxKT7d4KVZ5J++t9Ji0RsbnA6Dhh9of6wM3/ghCdSrn+GsGpiMsXFGXYVzj1i2736s5RNYgDpyBlEgVgxwgQSLmu6KfzYt76xfb6cVfWTw3wPw0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694501984; 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; bh=H0ux6zXnF8QbZYj0sOR52aBDTFuqL60bkneT20E5OaM=; b=jKt4rt+8zlU5fUEd2i8aBeSrm6rJvtSu0mEw3w6rP25MLAUrRVzovcMTLOs103DXiJ1J3r9utfPSchTwG4brhELIykE3crlu8yHpvqTyB4LKe/NM2m8cFek8fAdqFLYyzhAI9WwV5XtFueyr1L31KgGWatULE7teDqAetFSZxMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694501984108386.50778629716854; Mon, 11 Sep 2023 23:59:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxM3-0000UK-NJ; Tue, 12 Sep 2023 02:58:35 -0400 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 1qfxM1-0000QT-HB for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:33 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxLy-0007UW-SQ for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:33 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-26d49cf1811so3515425a91.0 for ; Mon, 11 Sep 2023 23:58:30 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501910; x=1695106710; darn=nongnu.org; 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=H0ux6zXnF8QbZYj0sOR52aBDTFuqL60bkneT20E5OaM=; b=p6XN0WYp9vAh5uCE07mlBWyW0Gx5HFG3LD0fvxsT6ZqzYdur2WnBtYWnHSwx5OC7xm qqzXGwJcn1FL1dRjBN26YofU+G1kJvCklOpZcJ10spz+zfocg44RzCjYNIodzEuFFyNd 6yBMyD7ixS+tNQDLi9flyxHcnNbEJCYp4439BtFFtkgiHv85/jBdK5U1EWf3pi1zXuZ5 +f+iI8XzNZFFXCsaTKd9tNK5t0svLENz1ffxl3snvgqaZuUqEN+ODkJ96r3oUzA10K5R cWz6JVEaqz35v5hNiU3pYU0LOY3ltpGz7QBFPA+RYYGg8cW25eWbPk3DSBX1iiWp1eGC w8WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501910; x=1695106710; 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=H0ux6zXnF8QbZYj0sOR52aBDTFuqL60bkneT20E5OaM=; b=pw2gYS3b7eVAX2x16jkByN9gyEpCi7UeEZ4WSTtFoDkePz1vp/hopp1fAkYs2AdvH1 LkcDmi0aWPSImHTv0nhG5djO6iIjmtlAmAISufubHV6JjjnM14ckcZoA6Ak6T0527cD8 3gMCYH/g1Kj2u+uFjuCr1cQB1Lz8UMK2IvIV6M0yPAFqk0QEVrh34NKkNdSWcvsus6gp kYede8eBKxE/nNezKiIY4mh7UI3YONQc7t3QYYeYxnIrXBerBpdczA4MOSCCqFlxoJCA gPHwYJdK9u74Mu9CtK7uuE4kbVTF3Yw3U0fqLSPeAHXnuLVIQia7anAnjRZwg90Fu2Ac rL3A== X-Gm-Message-State: AOJu0YwayRExKpWL6XugwQjzdwGeT1cO65S0KjyVyyinVnHnEcgckhgx TtdZYllL/6RYIfvcd3oFchKd0Q== X-Google-Smtp-Source: AGHT+IE9BmXdH2WuD83XTg3yQOLtHh+/54bugNv/vjSDhlSJPZa/LsXSxhUA9w90AtnU/ar34m6nNA== X-Received: by 2002:a17:90b:150:b0:273:d42e:50f5 with SMTP id em16-20020a17090b015000b00273d42e50f5mr9743278pjb.46.1694501909795; Mon, 11 Sep 2023 23:58:29 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , Richard Henderson , Peter Maydell , qemu-arm@nongnu.org (open list:ARM TCG CPUs) Subject: [PATCH v2 05/11] target/arm: Move the reference to arm-core.xml Date: Tue, 12 Sep 2023 15:58:00 +0900 Message-ID: <20230912065811.27796-6-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::1033; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694501984624100001 Content-Type: text/plain; charset="utf-8" Some subclasses overwrite gdb_core_xml_file member but others don't. Always initialize the member in the subclasses for consistency. This especially helps for AArch64; in a following change, the file specified by gdb_core_xml_file is always looked up even if it's going to be overwritten later. Looking up arm-core.xml results in an error as it will not be embedded in the AArch64 build. Signed-off-by: Akihiko Odaki Reviewed-by: Richard Henderson --- target/arm/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 0bb0585441..6ff6ff2d55 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2389,7 +2389,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void = *data) cc->sysemu_ops =3D &arm_sysemu_ops; #endif cc->gdb_num_core_regs =3D 26; - cc->gdb_core_xml_file =3D "arm-core.xml"; cc->gdb_arch_name =3D arm_gdb_arch_name; cc->gdb_get_dynamic_xml =3D arm_gdb_get_dynamic_xml; cc->gdb_stop_before_watchpoint =3D true; @@ -2411,8 +2410,10 @@ static void arm_cpu_instance_init(Object *obj) static void cpu_register_class_init(ObjectClass *oc, void *data) { ARMCPUClass *acc =3D ARM_CPU_CLASS(oc); + CPUClass *cc =3D CPU_CLASS(acc); =20 acc->info =3D data; + cc->gdb_core_xml_file =3D "arm-core.xml"; } =20 void arm_cpu_register(const ARMCPUInfo *info) --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694502075; cv=none; d=zohomail.com; s=zohoarc; b=nO6ws+S5onR3hP7FKZDsxdqnturKW6PWPQkbH+62gilGa6Z+R3jr6POiKbJNW2pn4tlInVWZBiAEozY5/W+KvMzH3OCg4CdnJfYmdab2+zJub7vst3LEc3oa8zKZn1VZzWOf2uvcI/g35ySSBFFgKZEX8Qxv8uWcVE8u8OQDFDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694502075; h=Content-Type: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; bh=XaH1p6td5igBD+rwAYNP4i5cRkpL7NUdBgICYmg3X1o=; b=G5Daw0Jtua95F72ShVLBygrF3lg+Nww26a7B6ewRR+mlK7IX+6Nu1FNNprfxgPGFP/IrEhADJMiHJOkTjB9R4gUCtiyM3ILg5xUZ/5BRzB3Uvz0PTA9dxf5bVNmnmDXBAMNhUTHQadRJC0PQVjRyO43HjlJTBMJwmX26NSK0gJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694502075390512.6553375824476; Tue, 12 Sep 2023 00:01:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxMN-0000ua-NH; Tue, 12 Sep 2023 02:58:57 -0400 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 1qfxM9-0000hg-TH for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:44 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxM6-0007WR-7G for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:40 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-271b0a8e7ecso3501958a91.3 for ; Mon, 11 Sep 2023 23:58:37 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501916; x=1695106716; darn=nongnu.org; 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=XaH1p6td5igBD+rwAYNP4i5cRkpL7NUdBgICYmg3X1o=; b=abSh3bzxdBWGx3WKrWg6PHrDLW/3QWZK38EhuhIgIla7+moms9hjBNgUGoOHgEFjYQ m6a5CFQZ1eVFMn6Rq6cW7qlIK0QdHOYXhUXlK7hvQB9T1WZQzbLNHitA/M8xDqlIfmVj KIHnnTw+LSZeoW2qY1G7GvYrlvMaLwx4s1UdReJxNJDMPEwGxaT85EreWUm7OS0hhCwH kyJlSIVkO5LRuUr8gT0zhhN7XN1jRXKmLdYG1CVf0CE3VQehg+tNsT4yxCk56bigpJ7j yrCViI4NQnQJVY2pNreSjwKNDGLOpyT7d5JpysE8K/EqmOdye/fEOUGdt3QC97mFpzZR AJ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501916; x=1695106716; 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=XaH1p6td5igBD+rwAYNP4i5cRkpL7NUdBgICYmg3X1o=; b=msNMWEpNWZ1PBjR2TrYoTbCkmXdYyBDse/JH6ttidup/jJvTQ8JspBmY2yY2XKNhkz V3lT/YjqCPKVupOo/hV92no7DI6han6IY/qYGqaPb8E1d2IICDj7o2K0mogIjaYzfLDx 5PW9TY4cZNA+487vGYEq/lOIIv8tAnbk1pr1DkiFAm6Ne9iug5eMF1/Rarjx6/VVkwKF QUHWlgxjb1n3aIXQQW6Hk46z40CWWpiYvctLcq+VGon0QfmFwW/Zxa4txnfy08Gaswk0 R+Pq6a/pVgEDYku7GiIpb3Ej/xUFvzmrpLfFIljRMknGK9kjflm6H9fAqSTdyJGdZxnn +SHQ== X-Gm-Message-State: AOJu0YzdzGMcPxDccnShsmyxzEGw8CXlVOfCufp6qEwxKoXv0NR8tg+g W9t3It0YGXu1g/AuEB0b7AvLDg== X-Google-Smtp-Source: AGHT+IEnjhjFdWuEbSi5GgA5MA2TboEgZIKXEeA1FFazX0X7GpuZPRgCXfG4mWnmMpexRB4DwEnJzg== X-Received: by 2002:a17:90a:dd81:b0:268:2543:723 with SMTP id l1-20020a17090add8100b0026825430723mr9337806pjv.5.1694501916676; Mon, 11 Sep 2023 23:58:36 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Tokarev , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Peter Maydell , Song Gao , Xiaojuan Yang , Daniel Henrique Barboza , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Greg Kurz , Nicholas Piggin , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , Bastian Koppelmann , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs), qemu-riscv@nongnu.org (open list:RISC-V TCG CPUs), qemu-s390x@nongnu.org (open list:S390 TCG CPUs) Subject: [PATCH v2 06/11] hw/core/cpu: Return static value with gdb_arch_name() Date: Tue, 12 Sep 2023 15:58:01 +0900 Message-ID: <20230912065811.27796-7-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::1030; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694502077849100001 All implementations of gdb_arch_name() returns dynamic duplicates of static strings. It's also unlikely that there will be an implementation of gdb_arch_name() that returns a truly dynamic value due to the nature of the function returning a well-known identifiers. Qualify the value gdb_arch_name() with const and make all of its implementations return static strings. Signed-off-by: Akihiko Odaki Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-By: Michael Tokarev --- include/hw/core/cpu.h | 2 +- target/ppc/internal.h | 2 +- gdbstub/gdbstub.c | 3 +-- target/arm/cpu.c | 6 +++--- target/arm/cpu64.c | 4 ++-- target/i386/cpu.c | 6 +++--- target/loongarch/cpu.c | 8 ++++---- target/ppc/gdbstub.c | 6 +++--- target/riscv/cpu.c | 6 +++--- target/s390x/cpu.c | 4 ++-- target/tricore/cpu.c | 4 ++-- 11 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index fdcbe87352..4f5c7eb04e 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -164,7 +164,7 @@ struct CPUClass { vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr); =20 const char *gdb_core_xml_file; - gchar * (*gdb_arch_name)(CPUState *cpu); + const gchar * (*gdb_arch_name)(CPUState *cpu); const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname= ); =20 void (*disas_set_info)(CPUState *cpu, disassemble_info *info); diff --git a/target/ppc/internal.h b/target/ppc/internal.h index 57acb3212c..974b37aa60 100644 --- a/target/ppc/internal.h +++ b/target/ppc/internal.h @@ -221,7 +221,7 @@ void destroy_ppc_opcodes(PowerPCCPU *cpu); =20 /* gdbstub.c */ void ppc_gdb_init(CPUState *cs, PowerPCCPUClass *ppc); -gchar *ppc_gdb_arch_name(CPUState *cs); +const gchar *ppc_gdb_arch_name(CPUState *cs); =20 /** * prot_for_access_type: diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 12f4d07046..9db4af41c1 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -380,10 +380,9 @@ static const char *get_feature_xml(const char *p, cons= t char **newp, ""); =20 if (cc->gdb_arch_name) { - g_autofree gchar *arch =3D cc->gdb_arch_name(cpu); g_string_append_printf(xml, "%s", - arch); + cc->gdb_arch_name(cpu)); } g_string_append(xml, "gdb_core_xml_file); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 6ff6ff2d55..a13c609249 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2316,15 +2316,15 @@ static Property arm_cpu_properties[] =3D { DEFINE_PROP_END_OF_LIST() }; =20 -static gchar *arm_gdb_arch_name(CPUState *cs) +static const gchar *arm_gdb_arch_name(CPUState *cs) { ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; =20 if (arm_feature(env, ARM_FEATURE_IWMMXT)) { - return g_strdup("iwmmxt"); + return "iwmmxt"; } - return g_strdup("arm"); + return "arm"; } =20 #ifndef CONFIG_USER_ONLY diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 96158093cc..6b91aab6b7 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -743,9 +743,9 @@ static void aarch64_cpu_finalizefn(Object *obj) { } =20 -static gchar *aarch64_gdb_arch_name(CPUState *cs) +static const gchar *aarch64_gdb_arch_name(CPUState *cs) { - return g_strdup("aarch64"); + return "aarch64"; } =20 static void aarch64_cpu_class_init(ObjectClass *oc, void *data) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 00f913b638..5678b52472 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5914,12 +5914,12 @@ static void x86_cpu_load_model(X86CPU *cpu, X86CPUM= odel *model) memset(&env->user_features, 0, sizeof(env->user_features)); } =20 -static gchar *x86_gdb_arch_name(CPUState *cs) +static const gchar *x86_gdb_arch_name(CPUState *cs) { #ifdef TARGET_X86_64 - return g_strdup("i386:x86-64"); + return "i386:x86-64"; #else - return g_strdup("i386"); + return "i386"; #endif } =20 diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 27fc6e1f33..f88cfa93ce 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -763,9 +763,9 @@ static void loongarch_cpu_class_init(ObjectClass *c, vo= id *data) #endif } =20 -static gchar *loongarch32_gdb_arch_name(CPUState *cs) +static const gchar *loongarch32_gdb_arch_name(CPUState *cs) { - return g_strdup("loongarch32"); + return "loongarch32"; } =20 static void loongarch32_cpu_class_init(ObjectClass *c, void *data) @@ -777,9 +777,9 @@ static void loongarch32_cpu_class_init(ObjectClass *c, = void *data) cc->gdb_arch_name =3D loongarch32_gdb_arch_name; } =20 -static gchar *loongarch64_gdb_arch_name(CPUState *cs) +static const gchar *loongarch64_gdb_arch_name(CPUState *cs) { - return g_strdup("loongarch64"); + return "loongarch64"; } =20 static void loongarch64_cpu_class_init(ObjectClass *c, void *data) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 2ad11510bf..778ef73bd7 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -589,12 +589,12 @@ static int gdb_set_vsx_reg(CPUPPCState *env, uint8_t = *mem_buf, int n) return 0; } =20 -gchar *ppc_gdb_arch_name(CPUState *cs) +const gchar *ppc_gdb_arch_name(CPUState *cs) { #if defined(TARGET_PPC64) - return g_strdup("powerpc:common64"); + return "powerpc:common64"; #else - return g_strdup("powerpc:common"); + return "powerpc:common"; #endif } =20 diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 6b93b04453..ef8faaaff5 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1939,17 +1939,17 @@ static Property riscv_cpu_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 -static gchar *riscv_gdb_arch_name(CPUState *cs) +static const gchar *riscv_gdb_arch_name(CPUState *cs) { RISCVCPU *cpu =3D RISCV_CPU(cs); CPURISCVState *env =3D &cpu->env; =20 switch (riscv_cpu_mxl(env)) { case MXL_RV32: - return g_strdup("riscv:rv32"); + return "riscv:rv32"; case MXL_RV64: case MXL_RV128: - return g_strdup("riscv:rv64"); + return "riscv:rv64"; default: g_assert_not_reached(); } diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index df167493c3..cf4b5e43f2 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -284,9 +284,9 @@ static void s390_cpu_initfn(Object *obj) #endif } =20 -static gchar *s390_gdb_arch_name(CPUState *cs) +static const gchar *s390_gdb_arch_name(CPUState *cs) { - return g_strdup("s390:64-bit"); + return "s390:64-bit"; } =20 static Property s390x_cpu_properties[] =3D { diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 133a9ac70e..44e3ba6f0e 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -29,9 +29,9 @@ static inline void set_feature(CPUTriCoreState *env, int = feature) env->features |=3D 1ULL << feature; } =20 -static gchar *tricore_gdb_arch_name(CPUState *cs) +static const gchar *tricore_gdb_arch_name(CPUState *cs) { - return g_strdup("tricore"); + return "tricore"; } =20 static void tricore_cpu_set_pc(CPUState *cs, vaddr value) --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694501990; cv=none; d=zohomail.com; s=zohoarc; b=Q9/xS7zYogfRRaL3beScVHJ9Ayj3um8+fEYdGd1HslTjkm+S0z/E02LZ7Jgze8qVMA/9UA/iH1klsU2bRElpmB6zMhbGymYiEHsexZQLZRUWyWdUbg/gvuaiRzkHL74BHVgzViT+9tC9Oe36Wt9KXmQU5d3TEkhs6Tx+g0nIJgk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694501990; 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; bh=Gn8CX4mhnvAoaMxtFet23WVmn0SlXVQfcTqFqfgAkrg=; b=OODgmzJD+ml83S5YumY+JHOMPSYmH+JYr5csZGTKT6okWgbMnAysMjrJ+18yjlwHWaJara+BFEgcpCd9ZZWWyaEfBSj9iafCcbEOCkGz407S7GBVWwImP8dF2v3CD0jaLYioBoXSXcYMBASkBdFv2j9d5SsIiJTRAbU1HY9maZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694501990750483.3645119881178; Mon, 11 Sep 2023 23:59:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxMV-0001I0-4E; Tue, 12 Sep 2023 02:59:03 -0400 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 1qfxMA-0000kl-Rl for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:45 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxM8-0007Wt-Aa for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:42 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-57767b2058cso1089383a12.1 for ; Mon, 11 Sep 2023 23:58:40 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501919; x=1695106719; darn=nongnu.org; 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=Gn8CX4mhnvAoaMxtFet23WVmn0SlXVQfcTqFqfgAkrg=; b=CxGcXoADwVWvMgcpuxQoZxGVhVMkx1W4YqrAXXNmB0Gk5koijWZbnha6tqOoKz8Q3C HUuOb36Dm4VALV6xvsVww1lbKQkboIg9uM7cfTkKWU+5oB8WqFaFaKzKFdiaOHR54gM9 gwCBxvi0Lopapvm8q0rW2p0HnbC+MOp8PG8W/QfzELn9QxK+TQbBnLXOhW+HPf+lxnW2 /SmR6/rK4rhk/LTgEz+cQZyNZefvzlxK10yNb0xaKCKpOpdgsuDnoNbySb8HjSA9NTiC ZE8J+jGXfo8gyuB3ZQw4PbiDea+DVvxk1MxAHY9NnB/EH79w8G+lp5YkxecNvV8DPTUh ueBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501919; x=1695106719; 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=Gn8CX4mhnvAoaMxtFet23WVmn0SlXVQfcTqFqfgAkrg=; b=odiAnt7vwcBPDKRZUVbEqoIkWHDADDlsoix5kBUuPR+oCxLCDjvp1CHWrWQuaW2qyy L04foI5HSA81Mcb85B4it3G+r9/Mq6CjFJyMPgPYAiQQyBLVGKZmgfktByLzEh4VKJAc JB7cTGEspj2K9PbBt6MV+WoKlBubxk6UF9tMPckM9vsAtaF34RJz2ntrI+xPfiaibg+W E0Vg2copqe9TpEYYy1OcZAZFI1UzKth1sBetZX/7o61sVIjTYSdd6QCUgTqfUzld/7zU oZ/7um7pXJnYI/8PudQqe+F+Rj2rxVb7LQv9OwPSL7U5001ka9EscTCWZi0PPdpDWI+a xsKw== X-Gm-Message-State: AOJu0YxgfvpjR3YOMTaCeTncmjm4YLeYceb3Nh/AdIC20a9ynEoSoa9A gicTLaHuPdKqmJA5cSMhS/J5FQ== X-Google-Smtp-Source: AGHT+IFMCf+fNdIvi+z60eVgXBq9cAFmn0zd+RTFXAkFx4wehH6RabH76HHB/RfBWQVf7UtaSsSmAQ== X-Received: by 2002:a17:90a:db4a:b0:263:e423:5939 with SMTP id u10-20020a17090adb4a00b00263e4235939mr10481477pjx.28.1694501918945; Mon, 11 Sep 2023 23:58:38 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 07/11] gdbstub: Use g_markup_printf_escaped() Date: Tue, 12 Sep 2023 15:58:02 +0900 Message-ID: <20230912065811.27796-8-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::52d; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694501991509100001 Content-Type: text/plain; charset="utf-8" g_markup_printf_escaped() is a safer alternative to simple printf() as it automatically escapes values. Signed-off-by: Akihiko Odaki --- gdbstub/gdbstub.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 9db4af41c1..a4f2bf3723 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -373,28 +373,34 @@ static const char *get_feature_xml(const char *p, con= st char **newp, if (strncmp(p, "target.xml", len) =3D=3D 0) { if (!process->target_xml) { GDBRegisterState *r; - GString *xml =3D g_string_new(""); + g_autoptr(GPtrArray) xml =3D g_ptr_array_new_with_free_func(g_= free); =20 - g_string_append(xml, - "" - ""); + g_ptr_array_add( + xml, + g_strdup("" + "" + "")); =20 if (cc->gdb_arch_name) { - g_string_append_printf(xml, - "%s", - cc->gdb_arch_name(cpu)); + g_ptr_array_add( + xml, + g_markup_printf_escaped("%s", + cc->gdb_arch_name(cpu))); } - g_string_append(xml, "gdb_core_xml_file); - g_string_append(xml, "\"/>"); + g_ptr_array_add( + xml, + g_markup_printf_escaped("", + cc->gdb_core_xml_file)); for (r =3D cpu->gdb_regs; r; r =3D r->next) { - g_string_append(xml, "xml); - g_string_append(xml, "\"/>"); + g_ptr_array_add( + xml, + g_markup_printf_escaped("", + r->xml)); } - g_string_append(xml, ""); + g_ptr_array_add(xml, g_strdup("")); + g_ptr_array_add(xml, NULL); =20 - process->target_xml =3D g_string_free(xml, false); + process->target_xml =3D g_strjoinv(NULL, (void *)xml->pdata); } return process->target_xml; } --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694502057; cv=none; d=zohomail.com; s=zohoarc; b=WFd2PKmq4C/5NWOhmlCviRvfkbkIZ7BisGJrsLTcehZtAhQrnzR2+2vm9OkQvCTG6lfSbKziptZrEPbEM9Ai8O1lvhR1LuOlCTMfp+BeoVujM+dpNsXhEeu++DaNiPFIeY2dBL8hB2XGfTzjxJETPg3WDe3vJK+FQdWzy4GBsNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694502057; h=Content-Type: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; bh=qUVjTcjkNZmdhwavklqNnzqJkSIaiyxihMzM0GkWlyU=; b=UsnIFcrwdpPPXDx4019XZELjHDk5vnF2e47xoD8bxwKdOI2UHsd8Sj+NhvfFzCNBVfQyl4YIWga7nqQ6lylIxBhBPQT5V/4Vb3Mrmdx2y+4/FfaFTgVAPXMX7IKhRTkY8hqjWK6Daz9CfZtjtZNTX8pEBfQAfXNq3rFicG79Ow4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16945020572541013.0441836730266; Tue, 12 Sep 2023 00:00:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxMX-0001Li-1S; Tue, 12 Sep 2023 02:59:05 -0400 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 1qfxMC-0000l6-IY for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:48 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxMA-0007XQ-9W for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:44 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-271c700efb2so3483776a91.0 for ; Mon, 11 Sep 2023 23:58:41 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501921; x=1695106721; darn=nongnu.org; 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=qUVjTcjkNZmdhwavklqNnzqJkSIaiyxihMzM0GkWlyU=; b=Zi7vS9s5jEZPEkPPXCsiZy8ikCDOOAtQqeGMrmnFWW31R9GvN+iFl3b2xE03l89jLJ ow0drjs5qO0LtU4PFXafNTikCyoc0Q45WU3Pk0vJpy3fKhx5Cku6Ds/8A6R8r48njuLh MIQhe6H+DYQrH7yw9dcs7/b6+vMwYhiG7GtG5uGH19QzA3wkyu2b0zSsJPLEaOQTUF2m cnAaA1HuZbKZdhYeznGLf/YwuopM2/NqKxqSneHpGJDDdu2C7seAv8oh48e3pqbxhkCT K43Nq+XWuN8nHHLcELv3czkxnMebIR0l4cNStySUJxxSHqqUIW8YWw2SbGzfi0p/a3PC ShMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501921; x=1695106721; 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=qUVjTcjkNZmdhwavklqNnzqJkSIaiyxihMzM0GkWlyU=; b=r8g+UOo2AY4g/CN+IPZvvSDeagiXx0ZEQe2Hu9QZQeOrEee65H/tQDJ2AKZ/5QoMwd A9l0tDM73xy0BMEa0/olMY/ORuwe4INrk3ph3fm34uFttWVwiUoKaspID0tXeMWP5UFL K0K5WO4YKTbbFa06bfXnVb0pzX1XgT3dZZR1m+pOofVacmna26sjL9ssLx+Ik3QZUiGf xo31hbPRiV+Z7ZQf9xoYNdl/xvh3SsspGiLhHEHMrtFH0wHH2S63iYt3JaO+2fbwh0qQ bAoW1TkKj6+PqOT2xqbeJ1bKzZyMVh2Mixeo99cZ4aLihL+SXfpHEZa+UZ+0RK6vaLRu Bvnw== X-Gm-Message-State: AOJu0YxXBxWmtGM/E6R3bIhDDEi7KDyacBEyZj/oTeXe7bYJ6zFXciNS mSN4+Op9ND9lalXLGrdjpoaTtKeRd48M0CDzRI0= X-Google-Smtp-Source: AGHT+IEugFWzGyIJbgfzMAWZi8kFoV7blGP2kP/el/CE65Q22wACUuhF50orAYjH+Es7z+1uVi5USQ== X-Received: by 2002:a17:90a:72c3:b0:273:b0bd:343b with SMTP id l3-20020a17090a72c300b00273b0bd343bmr9158534pjk.41.1694501921213; Mon, 11 Sep 2023 23:58:41 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , Peter Maydell , qemu-arm@nongnu.org (open list:ARM TCG CPUs) Subject: [PATCH v2 08/11] target/arm: Remove references to gdb_has_xml Date: Tue, 12 Sep 2023 15:58:03 +0900 Message-ID: <20230912065811.27796-9-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::1034; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694502058462100001 GDB has XML support since 6.7 which was released in 2007. It's time to remove support for old GDB versions without XML support. Signed-off-by: Akihiko Odaki Acked-by: Alex Benn=C3=A9e --- target/arm/gdbstub.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index 8fc8351df7..b7ace24bfc 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -46,21 +46,7 @@ int arm_cpu_gdb_read_register(CPUState *cs, GByteArray *= mem_buf, int n) /* Core integer register. */ return gdb_get_reg32(mem_buf, env->regs[n]); } - if (n < 24) { - /* FPA registers. */ - if (gdb_has_xml()) { - return 0; - } - return gdb_get_zeroes(mem_buf, 12); - } - switch (n) { - case 24: - /* FPA status register. */ - if (gdb_has_xml()) { - return 0; - } - return gdb_get_reg32(mem_buf, 0); - case 25: + if (n =3D=3D 25) { /* CPSR, or XPSR for M-profile */ if (arm_feature(env, ARM_FEATURE_M)) { return gdb_get_reg32(mem_buf, xpsr_read(env)); @@ -100,21 +86,7 @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *m= em_buf, int n) env->regs[n] =3D tmp; return 4; } - if (n < 24) { /* 16-23 */ - /* FPA registers (ignored). */ - if (gdb_has_xml()) { - return 0; - } - return 12; - } - switch (n) { - case 24: - /* FPA status register (ignored). */ - if (gdb_has_xml()) { - return 0; - } - return 4; - case 25: + if (n =3D=3D 25) { /* CPSR, or XPSR for M-profile */ if (arm_feature(env, ARM_FEATURE_M)) { /* --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694502088; cv=none; d=zohomail.com; s=zohoarc; b=cdBuLfO4Bpb39C4IVIvqIxFaabikZxteNqdY2lwOyW84lKTxJ1qRrTYo5I1VR7yoQd65FCIB417liFSs6AhSw3SpnE8YBwGNnGPSamYbwxAWq/gIw98pWsOjoe3tmVkaYh/kt6OALqxIcwAy23xk5QWnwFpDAnGPSA60+2DiQE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694502088; 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; bh=VSSZHlR4v/0tPaKsbN/N18QMFmibLFOOUdSapeItbE0=; b=SJEjpNzeilqA0BxBDTyJH1QQ+aY6qjOE5ywd4/SfOnURmtdA8Ej61ukQQ91vZiCq3XFlFc4ghWbOfAwSZF1yFs89qRx7/ZSCUhFotcM7XcO53RR4VkUzPlGCovxcFTwvvEi9EyWmSyOhEru7Ppc3rbONbOoEYF1F2Zs+y+tkShE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169450208808984.33696980592936; Tue, 12 Sep 2023 00:01:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxMQ-00015a-VY; Tue, 12 Sep 2023 02:58:59 -0400 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 1qfxMF-0000ll-IA for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:49 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxMD-0007Zs-BF for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:47 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-273d10d3df3so3305399a91.3 for ; Mon, 11 Sep 2023 23:58:45 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501924; x=1695106724; darn=nongnu.org; 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=VSSZHlR4v/0tPaKsbN/N18QMFmibLFOOUdSapeItbE0=; b=fspo7+cZefvEd7edNeH1AZKuMyv2Svk6uIulDCigG/0NHuKhPFbUzDY1y8ZMNaWb+J 4KqY7XuVEMMdj8+4osU6UBQ/2nv4KZp/SW7XjPHHwMLwPFahacz4DMnRbArmQZk9i0pe WM/+ENV0/b4d+gVQWJVVg+vy2R88OA7GArtCOCasWXrydmGnnL8N2/ZtBTfWTGOMA7xY ljXzvj3wMtNeLn/i1zTLCcHJIW8qk500E9O2T27wjVRGXd2IHEAHhC5/+xkSA0ehCkBl hBbVJAjhynMqh2zciBW5QiY4iolnTtcqV/QbAMOwiYh/Hbz0DllU58zD7iVEcUAJmswv 6t0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501924; x=1695106724; 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=VSSZHlR4v/0tPaKsbN/N18QMFmibLFOOUdSapeItbE0=; b=WVBdOe7quHDqcPsuSbMi3JvptCk3lsGjk0moTcNqGsYEu1ISIawPlpuiXIUhZEkKL7 jjBtZ0j+V7cN7zxZ9nMpY7WAgNrgxXdz4SN3YqER4lKly/fViuL2uHG+T6VLBxilmIow sKZigfgS2dwsyneYv9sxiSVStBtZ3psJrYaL7osoF7Nw41qgaOcYvwSsDHKjh3mcEfWP mDOUdfHBS2lZCGKgiChyi35OYlCDBCbF7W1Ukr4PAStjTXVT1J+Elh1rl1etOGWJnjnu rHoiAMRujHCfJ/+5TNRoLLd1IoooBqs0f8o1FpoaA40U3u2NTvTlHajA2wdpVZAKT520 BT8Q== X-Gm-Message-State: AOJu0Yz4OFLH/PMtRokX032CmhtBfTKuWcrJWFoHpRYzEbY1FrwgdxNl Nof7VP+On7HHyJhaDNXansx2Cg== X-Google-Smtp-Source: AGHT+IFMOF/StadjCUpDR9Vh5s4LrV40FLLuB+y3rDhhWYUrwbQm8/Md02jRedBw5UC+tl8KCkLFHQ== X-Received: by 2002:a17:90a:430d:b0:26d:5cd0:979f with SMTP id q13-20020a17090a430d00b0026d5cd0979fmr9088969pjg.43.1694501924180; Mon, 11 Sep 2023 23:58:44 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , Daniel Henrique Barboza , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Greg Kurz , Nicholas Piggin , qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs) Subject: [PATCH v2 09/11] target/ppc: Remove references to gdb_has_xml Date: Tue, 12 Sep 2023 15:58:04 +0900 Message-ID: <20230912065811.27796-10-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::1030; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694502089948100001 Content-Type: text/plain; charset="utf-8" GDB has XML support since 6.7 which was released in 2007. It's time to remove support for old GDB versions without XML support. Signed-off-by: Akihiko Odaki --- target/ppc/gdbstub.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 778ef73bd7..ec5731e5d6 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -54,12 +54,6 @@ static int ppc_gdb_register_len(int n) case 0 ... 31: /* gprs */ return sizeof(target_ulong); - case 32 ... 63: - /* fprs */ - if (gdb_has_xml()) { - return 0; - } - return 8; case 66: /* cr */ case 69: @@ -74,12 +68,6 @@ static int ppc_gdb_register_len(int n) case 68: /* ctr */ return sizeof(target_ulong); - case 70: - /* fpscr */ - if (gdb_has_xml()) { - return 0; - } - return sizeof(target_ulong); default: return 0; } @@ -132,9 +120,6 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray = *buf, int n) if (n < 32) { /* gprs */ gdb_get_regl(buf, env->gpr[n]); - } else if (n < 64) { - /* fprs */ - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32)); } else { switch (n) { case 64: @@ -158,9 +143,6 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray = *buf, int n) case 69: gdb_get_reg32(buf, cpu_read_xer(env)); break; - case 70: - gdb_get_reg32(buf, env->fpscr); - break; } } mem_buf =3D buf->data + buf->len - r; --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694502094; cv=none; d=zohomail.com; s=zohoarc; b=S9ApInrszMVP7OpCiB2h5KFjLSA/SOARFohcQenc2gyrX+eUJrs+s19TdR4qm8E5hD7sCpzesRaPzJ6jQRbqy2MJepCHFtBF+v5NpXOeFlZJRgynPXPd6pmRw5qqEjZPPnwDPW6meU0OOuh0D5JlmS/+alCkhCJzSMxRGqU9J6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694502094; 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; bh=pN7w6OyUOseMxgrm0jA21wfUfRH3D26uspX8jJXC++8=; b=avaK9z2xHNL0rg4XnZg9iC6pus2I8SbPXpUUp4kt/0sq9Q9htFFn64bYRJ/zHo4tvCQQju+XuBksWlQ0SBK1HkVmknR6eeGh0HWxgVXQeAFN225dNIVqH+wYbukiOsmELApw14AqWaJe+86EnSdIaQv8WThP82q0yVGPaihCHjM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694502094204162.0004740828457; Tue, 12 Sep 2023 00:01:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxMQ-00013B-KR; Tue, 12 Sep 2023 02:58:58 -0400 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 1qfxMI-0000p5-45 for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:52 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxMF-0007aK-QG for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:49 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-564b6276941so4072448a12.3 for ; Mon, 11 Sep 2023 23:58:47 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501926; x=1695106726; darn=nongnu.org; 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=pN7w6OyUOseMxgrm0jA21wfUfRH3D26uspX8jJXC++8=; b=V/di7ZQzwZ6VlCbpoeLRglt/Y2thEM2CmZJc9GlfylVEozx9p8eNoMY01MhuLlhtxU 4XfF8ec5nukWmdSnomimU34QuKDm6WdC/1rJwNOAAB+pdQqsfezfMTE7unGHTsWpEdL6 SVRR5YosxddgGZb2m5E6+6A6YyTk1X2ZPHaI6/+J8uaVPqkhvIAclMNMuho/xYXds7uO 5BQRM1cQIujUvQPTrO3FEBeGPPoprG33/gbi0o/Vs+ph6y0Wx0j/2dvK6PG45Tvabfp4 XMmInA0NuN229Oa4kQ+Qd3mlrxCQIOrALsrEnxG7ipcxy1PDAR8pzJ57P1adwKs8+qoV KWbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501926; x=1695106726; 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=pN7w6OyUOseMxgrm0jA21wfUfRH3D26uspX8jJXC++8=; b=DGe7WEFRoZ4P2P/1TpcmKYHOIdrRzHhdWFo0tT4Ui9zJLPnYDpT+/zqlmJ/gejyztB ZAwkEtrezn0bu+5Rbxqx14fudraedvAcd4vpKBTST7pHqJelisUXUjEsb/pN51PdDZVe 63n5pdM2YF9bZ/Fy0al6lkYHgUa1ZkOaLc3uOUbvRS0PDHOuW/BIDxuSnlmns3Dug3tt LJw57AhEaDUrenYlMFujH56zCGW06W1sOWenIrZHSP6b21DiBLVNyQwdctK3v+tgNFIn R9qe58RVw4nYZdBfZrLDeEPz9Mx3Reaajcq3vosInqBuACBhdXzwDzSkYSQ2+e2kxdbZ l/Cw== X-Gm-Message-State: AOJu0YykFYL3RvjXdQuywn92/UC+KGS5d+DZOJEK7knAT8dckv37INzR wRObgcEddSqmqbGoRoM+djw7TA== X-Google-Smtp-Source: AGHT+IGwECa4TMfyHURoPKAeqQiZd40WRnQmltCATfeIioh4Bn3UiIZnRadk+Zl5lfBhu3EVEBHvfw== X-Received: by 2002:a17:90a:8b8b:b0:262:fe45:860b with SMTP id z11-20020a17090a8b8b00b00262fe45860bmr10921372pjn.0.1694501926407; Mon, 11 Sep 2023 23:58:46 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 10/11] gdbstub: Remove gdb_has_xml variable Date: Tue, 12 Sep 2023 15:58:05 +0900 Message-ID: <20230912065811.27796-11-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::52f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694502096138100003 Content-Type: text/plain; charset="utf-8" GDB has XML support since 6.7 which was released in 2007. It's time to remove support for old GDB versions without XML support. Signed-off-by: Akihiko Odaki --- gdbstub/internals.h | 2 -- include/exec/gdbstub.h | 8 -------- gdbstub/gdbstub.c | 15 --------------- 3 files changed, 25 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index fee243081f..7128c4aa85 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -32,8 +32,6 @@ enum { typedef struct GDBProcess { uint32_t pid; bool attached; - - /* If gdb sends qXfer:features:read:target.xml this will be populated = */ char *target_xml; } GDBProcess; =20 diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 705be2c5d7..1a01c35f8e 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -45,14 +45,6 @@ int gdbserver_start(const char *port_or_device); =20 void gdb_set_stop_cpu(CPUState *cpu); =20 -/** - * gdb_has_xml() - report of gdb supports modern target descriptions - * - * This will report true if the gdb negotiated qXfer:features:read - * target descriptions. - */ -bool gdb_has_xml(void); - /* in gdbstub-xml.c, generated by scripts/feature_to_c.py */ extern const GDBFeature gdb_static_features[]; =20 diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index a4f2bf3723..177dce9ba2 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -349,11 +349,6 @@ static CPUState *gdb_get_cpu(uint32_t pid, uint32_t ti= d) } } =20 -bool gdb_has_xml(void) -{ - return !!gdb_get_cpu_process(gdbserver_state.g_cpu)->target_xml; -} - static const char *get_feature_xml(const char *p, const char **newp, GDBProcess *process) { @@ -1086,11 +1081,6 @@ static void handle_set_reg(GArray *params, void *use= r_ctx) { int reg_size; =20 - if (!gdb_get_cpu_process(gdbserver_state.g_cpu)->target_xml) { - gdb_put_packet(""); - return; - } - if (params->len !=3D 2) { gdb_put_packet("E22"); return; @@ -1107,11 +1097,6 @@ static void handle_get_reg(GArray *params, void *use= r_ctx) { int reg_size; =20 - if (!gdb_get_cpu_process(gdbserver_state.g_cpu)->target_xml) { - gdb_put_packet(""); - return; - } - if (!params->len) { gdb_put_packet("E14"); return; --=20 2.42.0 From nobody Sat May 11 22:15:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1694502003; cv=none; d=zohomail.com; s=zohoarc; b=X1rQRxul/z7q4hsasda5f+1TuRsLNDUnwhrHxfAd9Rud3VGP/bqcts7xELztPjirzR8V1YBFHccVJtNEpMd+ZmXvBbGJmmAQcoldjp0/BZVpbfxA0kT6EYprMZMqAZuYJl+XN4zTSu+17JBw461zC4c4yAWI2FvR/M79dmqCbgo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694502003; 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; bh=YR6f2ljT/PkMnpwGwuqVmtD8rXDReW0mqLVfL5y4OQE=; b=J6sj95jWXg8dkJH9Y7vnHUWiC7pJ5O2p2gadiP3FwubElFMC59YtFB0cYX6gm8uudbtPtZ2ldmzwiroPNrRBJ9dfJdQgHsJYgEASrlzPUOcAl5EHIA+kPncVSQ6N1fU/qkVZZuxP/uNPniUIQx0Xpfh9NfXvqiQfZ6xgQmChCow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694502003932641.856160051296; Tue, 12 Sep 2023 00:00:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxMS-00018J-5m; Tue, 12 Sep 2023 02:59:00 -0400 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 1qfxMM-0000ul-Oh for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:55 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfxMK-0007as-FN for qemu-devel@nongnu.org; Tue, 12 Sep 2023 02:58:54 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-273d10d3df3so3305444a91.3 for ; Mon, 11 Sep 2023 23:58:50 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id i8-20020a17090a2ac800b002696aeb72e5sm9315058pjg.2.2023.09.11.23.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1694501929; x=1695106729; darn=nongnu.org; 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=YR6f2ljT/PkMnpwGwuqVmtD8rXDReW0mqLVfL5y4OQE=; b=OM+of/Y48FEkCqJOufpI9t1/OzCNnJdKc3O13Eqc3MP++EFysxbREvC0onTvkP8HEk 1Zra+OC+fUy1+faCeFIXigP56MQ3HvGBxZXB0PL855XPJYidwbpMErzbt3oXaqY3QCRQ fR5Ytlzomxdbale4OKwLYI/bL9ea/i6d4A1kSFOqyR2hkRQZFcW8ZjHI0Q3WefSZ5F1H ryN2/fgehZjn1LfySy0liPd/4JjCd/s1f7fNmanzEhORKLxY/CY/hqq9s7D2qVTr7ymC j9zoqSdHTVTQpsDRyIOjLf79qNzF8W9RidZOAUW2k6qNUXf87w+LlGzwaakQ5FBepj3r VhCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694501929; x=1695106729; 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=YR6f2ljT/PkMnpwGwuqVmtD8rXDReW0mqLVfL5y4OQE=; b=SCuK62SxWyM/cRl8HFfNq4bVjN0zglLlNg0u9EcQ8dm/8dxKyHC8iKApENk9aka0BF VUEXJdlCfL7mDKXnXMxnSwjqxpyvj/KnMlOy69HdKItVxtviCFTjmCcO3zc1y3DR2YPf mUHd49r+lOU3DDK83dvNIGv9VmOUsP6VSGHMuHNjJFCeh7PrM3vpvfbKIiJ34ZNDqUXp 7ojZhfwgZQ4A6+EdIv2KWUlPCVoCAbdu0XZaNOnMHO8jPfnZNiCjbB/+YABBPzQZhpiR WsCPudq0vwIY/Kq6skoXPGfQQZJ4adIe44Q4FUP67isbT5IldZOoFyDO74c7izwtcikc ZY6w== X-Gm-Message-State: AOJu0YxhXJLJJjV09fBNcp7gtq/Lzuz+DaIFqR8uktx2Qhv7LC4oaNE2 aT9WVjfZfEXTHQeFbCJKsPUEhA== X-Google-Smtp-Source: AGHT+IF9TOgQPUhoOgxLskBgRqjhDi4h3eqOseqbEVO+VnHesztNvq+S0N4PgK4b1DJ9DyTzhXr8Jw== X-Received: by 2002:a17:90b:1488:b0:268:ac99:4bb4 with SMTP id js8-20020a17090b148800b00268ac994bb4mr9709232pjb.46.1694501929190; Mon, 11 Sep 2023 23:58:49 -0700 (PDT) From: Akihiko Odaki To: Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Mikhail Tyutin , Aleksandr Anenkov , qemu-devel@nongnu.org, Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PATCH v2 11/11] gdbstub: Replace gdb_regs with an array Date: Tue, 12 Sep 2023 15:58:06 +0900 Message-ID: <20230912065811.27796-12-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230912065811.27796-1-akihiko.odaki@daynix.com> References: <20230912065811.27796-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=2607:f8b0:4864:20::1034; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1694502005137100001 Content-Type: text/plain; charset="utf-8" An array is a more appropriate data structure than a list for gdb_regs since it is initialized only with append operation and read-only after initialization. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 2 +- gdbstub/gdbstub.c | 34 ++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4f5c7eb04e..c84c631242 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -375,7 +375,7 @@ struct CPUState { =20 CPUJumpCache *tb_jmp_cache; =20 - struct GDBRegisterState *gdb_regs; + GArray *gdb_regs; int gdb_num_regs; int gdb_num_g_regs; QTAILQ_ENTRY(CPUState) node; diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 177dce9ba2..9810d15278 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -51,7 +51,6 @@ typedef struct GDBRegisterState { gdb_get_reg_cb get_reg; gdb_set_reg_cb set_reg; const char *xml; - struct GDBRegisterState *next; } GDBRegisterState; =20 GDBState gdbserver_state; @@ -386,7 +385,8 @@ static const char *get_feature_xml(const char *p, const= char **newp, xml, g_markup_printf_escaped("", cc->gdb_core_xml_file)); - for (r =3D cpu->gdb_regs; r; r =3D r->next) { + for (guint i =3D 0; i < cpu->gdb_regs->len; i++) { + r =3D &g_array_index(cpu->gdb_regs, GDBRegisterState, i); g_ptr_array_add( xml, g_markup_printf_escaped("", @@ -430,7 +430,8 @@ static int gdb_read_register(CPUState *cpu, GByteArray = *buf, int reg) return cc->gdb_read_register(cpu, buf, reg); } =20 - for (r =3D cpu->gdb_regs; r; r =3D r->next) { + for (guint i =3D 0; i < cpu->gdb_regs->len; i++) { + r =3D &g_array_index(cpu->gdb_regs, GDBRegisterState, i); if (r->base_reg <=3D reg && reg < r->base_reg + r->num_regs) { return r->get_reg(env, buf, reg - r->base_reg); } @@ -448,7 +449,8 @@ static int gdb_write_register(CPUState *cpu, uint8_t *m= em_buf, int reg) return cc->gdb_write_register(cpu, mem_buf, reg); } =20 - for (r =3D cpu->gdb_regs; r; r =3D r->next) { + for (guint i =3D 0; i < cpu->gdb_regs->len; i++) { + r =3D &g_array_index(cpu->gdb_regs, GDBRegisterState, i); if (r->base_reg <=3D reg && reg < r->base_reg + r->num_regs) { return r->set_reg(env, mem_buf, reg - r->base_reg); } @@ -461,17 +463,22 @@ void gdb_register_coprocessor(CPUState *cpu, int num_regs, const char *xml, int g_pos) { GDBRegisterState *s; - GDBRegisterState **p; - - p =3D &cpu->gdb_regs; - while (*p) { - /* Check for duplicates. */ - if (strcmp((*p)->xml, xml) =3D=3D 0) - return; - p =3D &(*p)->next; + guint i; + + if (cpu->gdb_regs) { + for (i =3D 0; i < cpu->gdb_regs->len; i++) { + /* Check for duplicates. */ + s =3D &g_array_index(cpu->gdb_regs, GDBRegisterState, i); + if (strcmp(s->xml, xml) =3D=3D 0) + return; + } + } else { + cpu->gdb_regs =3D g_array_new(false, false, sizeof(GDBRegisterStat= e)); + i =3D 0; } =20 - s =3D g_new0(GDBRegisterState, 1); + g_array_set_size(cpu->gdb_regs, i + 1); + s =3D &g_array_index(cpu->gdb_regs, GDBRegisterState, i); s->base_reg =3D cpu->gdb_num_regs; s->num_regs =3D num_regs; s->get_reg =3D get_reg; @@ -480,7 +487,6 @@ void gdb_register_coprocessor(CPUState *cpu, =20 /* Add to end of list. */ cpu->gdb_num_regs +=3D num_regs; - *p =3D s; if (g_pos) { if (g_pos !=3D s->base_reg) { error_report("Error: Bad gdb register numbering for '%s', " --=20 2.42.0