From nobody Thu Nov 28 06:42:29 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=1693715557; cv=none; d=zohomail.com; s=zohoarc; b=izL6l1kZ++kT/x9Gc3koSUy08B9n9zYoy+SD5XT5hVqd3fu3JYFwQ+tiSeT5B/EeA+cqiYxPY0PQcrT//Mk7iKcJ2hhhgEPGlFvctaIbhsEc4JB8ul9guJ9HjADFkLK+TMvv/c3cKD/glVsSeetLasXqRiF5vN5oMTDEFnaGDG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715557; 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=ildd3BaoAevAEhZtdUXhQmey61Eypa8Qctpi+inOt9Gd+ATVFriKXIq9huxiznk/xuZenRCfAmwlfbegiAOCF9bhwq6ZQWtRrGhMIWttAHpboblbv8pIeikpf4EQPq6ygdZEvSwsYb9FscC2SUe74gNXOSRMWdSmi/XAUr25KMA= 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 1693715557132409.5414444232681; Sat, 2 Sep 2023 21:32:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcem0-0002Ec-9o; Sun, 03 Sep 2023 00:31:45 -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 1qcelf-0002Ap-HY for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:23 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qceld-0006nx-2Y for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:23 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c0bae4da38so2111675ad.0 for ; Sat, 02 Sep 2023 21:31:19 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715478; x=1694320278; 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=DOjlg1TBOFZIDvwJEWHFTRR6o4M5Ed67nbauoNcPKe2sbNTJRxQl8g4g1ygqq+WY3a N5NUcm+Q61NsVLeWMmV4gZMGublAvBdvg0QV99pGGsUQBTRuwMoyxU7p3RU7ZoNohGxp dHu2fHzBCQwGfD8rUIIeeEzfcoX9or0ZcRBDff6ywhDbeH8UPk+M9DDSObtNIV7nDIf/ KYffO8COlFEEKm40w5PsCmg13o1VZyBJKeP04SXZcZzBix3vpTw8DDSHq+PabuMdJLeZ Uopv7U1AUGF3YYqrs9OcPzZL0FaDWOFFWxd/iUiPR4YlFRpGvpo2f7u7ljsAn36qlxWf 5CEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715478; x=1694320278; 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=ORba22sWC65VOfleKUqUUYdMP4AuRuKd6Deu2+kUH/UsfibBnC6TjC8aftGPnDfOm9 RdvkGGK7wgHas/Fx1laTQYJbUtyiZLrLFRW4MZjamGIF51nqQ7w/acDykGM9+UV6iPYV AUP6L5Qc+ubGD4OcXTqGQ+Q8GoT4GH2q+djQ/JpgyIiiqeslZrbq8e7yPRUMsAROY70I D0lNaSMIRuPIlX/avKj/iXWTavrOgQ/bT0BHzlkYVlp1kQ2UM/tmYfvfHEmXOwVppRC4 ZVfJozghQG9/Ywazank20k6zWJHdaxVn/UcT++CXx/pVSqTpAIMjPNZyYVcrqUozi03s DkLg== X-Gm-Message-State: AOJu0YzdC568SwOA7gKtwtlfZ4hdJkR+Ti0Ck7mKeKYEJb3Ha1XnOJ61 UTAw0fyEKSDI88gkrHHMxJv+Sg== X-Google-Smtp-Source: AGHT+IH8qzb6UjiEf5BGZdY1AOhxyxpCLqDSifqBg4gw201nEsKgoxM2C5hJnacsoXhsjaS/PWhCTQ== X-Received: by 2002:a17:902:b782:b0:1b5:674d:2aa5 with SMTP id e2-20020a170902b78200b001b5674d2aa5mr7081958pls.13.1693715478525; Sat, 02 Sep 2023 21:31:18 -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 1/8] contrib/plugins: Use GRWLock in execlog Date: Sun, 3 Sep 2023 13:30:11 +0900 Message-ID: <20230903043030.20708-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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::62e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62e.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: 1693715557930100001 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 Thu Nov 28 06:42:29 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=1693715534; cv=none; d=zohomail.com; s=zohoarc; b=Eo3MeWDbziZnfk85C/JuOeGYGXQTjmDY1NAIUhIdTljHXSj2Z1sxZCoXLoOQoPbWfQ8kBm9IJIUvowY9k0Sa5CRpA7f3KIPuCzFteVxzv+BZsNwNYcs/XmK3bHnSezU/0XrhnuUJwncTFjc8Cuu2mdw/p/QSt3NWQeHSaK93dpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715534; 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=RZQXbCNxDHIujONx3PLPXTvpqp/0QLYa35wG6AhFq4M=; b=E4lFWtQNS323UeiC95Z6DNHEfd8d86fFmlqE2B0UkDia/9jTLF0lStLd+tWm8hV2QDUNMDetvnGlxXsWZfhsnqFMuUpz5plnbfq7cXOKnHVXdIfpO2EwWNuEA6ce7jQtl1uIidVTE1zCezrY2+lR4/nOII58cJnC1XAvRQnFZYI= 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 1693715533915463.71033197425845; Sat, 2 Sep 2023 21:32:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcell-0002By-0e; Sun, 03 Sep 2023 00:31:29 -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 1qceli-0002BG-Oq for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:27 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcelf-0006pn-Tb for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:26 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-56b0c5a140dso297625a12.0 for ; Sat, 02 Sep 2023 21:31:23 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715482; x=1694320282; 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=RZQXbCNxDHIujONx3PLPXTvpqp/0QLYa35wG6AhFq4M=; b=1y4j/zxKlsPs+vsDl8OUgVk97V+GOQFfWU8g0TMUdI5tYhL4apHStJf+Wj6cg+xkbF macjTrcngLcP8GxVPCn2bQBcNczBVV4/69GO/jNOMRSE02YN1siplfGe5BcX3PWy1l8F UQtbKuor1lTAhGbRzqcpQqrGJT2VwHn8fL35cRQmPlhRuL5RDw2D82+D8a3TdAt+8ZgW Mm2lthYwxZT+ZZKJjXv8fn7Veqq02xbNukcJnt1xDCuUdbFoNnyQw5b95+JLS+NA5tiQ 5YBe89aE5/qR+he+oDu/kh2jAWgrDwqJpvySLhOfFAtIMIJviiEEZ+IiR8fqtS8lx1ct K03A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715482; x=1694320282; 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=RZQXbCNxDHIujONx3PLPXTvpqp/0QLYa35wG6AhFq4M=; b=ipbVDLZHxuYU0sB1eoVHshCMtibwL4QfWiPoqGZgKUXTnMuowoFNjYXumbnWLJV5hd +JlYBCb1tw51UM3cW/FiTnmDE/82+3XK9UnlPYnhf7FvT6J5N5Ofuz+f8fttrnuc+PEP AOCi2jT6U2TFl8k+EwJsVrIXRD3T1YA2okGqc/z8NkhkPgFnLlAFLXUmWviemYQ/qo/5 KmmRCmGlod+E0HbqWlheOSIwvL4Uzh/bkKOIxX9XjlJYc/lFGTaKyAobE9X38EOpt0Wv vSr+L4r5WPzhXsntevKEmvEEzA/kMuH9dNiYZPU6wEksrTjI/7GTnv3IdOzQ0p5FU1pa rRbQ== X-Gm-Message-State: AOJu0YyeVbq65EJdAt0LHaT/WFzcUsbdEq/4X5QUue2MOCUqln8OfdnT DV5RbYJB8eBfo18nyvQFDRdCuQ== X-Google-Smtp-Source: AGHT+IHqmdC0JxIJB8jQgrGWCbh5/umNdna0LCQ+NXzF0UoZ6LOqfVkAGWhW31oZG+ppaxLYRBHMnw== X-Received: by 2002:a17:902:7449:b0:1c1:fe87:f550 with SMTP id e9-20020a170902744900b001c1fe87f550mr6903294plt.7.1693715482232; Sat, 02 Sep 2023 21:31:22 -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 2/8] gdbstub: Introduce GDBFeature structure Date: Sun, 3 Sep 2023 13:30:12 +0900 Message-ID: <20230903043030.20708-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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::52c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52c.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: 1693715535625100001 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 | 4 +-- stubs/gdbstub.c | 6 ++-- scripts/feature_to_c.py | 48 ++++++++++++++++++++++++++++ scripts/feature_to_c.sh | 69 ----------------------------------------- 7 files changed, 62 insertions(+), 78 deletions(-) create mode 100755 scripts/feature_to_c.py delete mode 100644 scripts/feature_to_c.sh diff --git a/MAINTAINERS b/MAINTAINERS index 12e59b6b27..514ac74101 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 7d743fe1e9..3f08093321 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); @@ -38,7 +43,7 @@ void gdb_set_stop_cpu(CPUState *cpu); */ extern bool gdb_has_xml; =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 6911b73c07..2772f07bbe 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -407,11 +407,11 @@ static const char *get_feature_xml(const char *p, con= st char **newp, } } for (i =3D 0; ; i++) { - name =3D xml_builtin[i][0]; + name =3D gdb_static_features[i].xmlname; if (!name || (strncmp(name, p, len) =3D=3D 0 && strlen(name) =3D= =3D len)) break; } - return name ? xml_builtin[i][1] : NULL; + return name ? gdb_static_features[i].xml : NULL; } =20 static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) 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 Thu Nov 28 06:42:29 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=1693715534; cv=none; d=zohomail.com; s=zohoarc; b=Ikfl55BlV6uY/VUEIQmF/6sL6G05AcGR63TDWo8gXAZ3hCUchOvA/x//Zc63zj/y55+AnZAflTlIEPfkbMl5USdQ8DIUYkPi9lToANExuOky/WepgUO/fVKEYkJNREV1v7BhRzY5GoqNK9GIeVqTR0Ge6jCB9AzEPyV2ZgyrGbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715534; 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=f1OoGlAFSrsHe5yxYX+ZMvZlZQ825ETdOqmrQ0CIV6k=; b=mEh6EJ1OG3uDgqW9XQCQExnQNVXWGJMD/g9Mxfc5vK7Qz+/KgOVw2V/SuHqdDLs+jwlbcWdhsNba/B2YtVF8ZSFHXTOXbdQ9Di81XmyCgG8l6tH2+vRRgK3ePg10CC+YV8ZsvUoK8NuFL9yX5rueajHDy6dqtAsEE09ZegRHApM= 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 1693715533936335.0449532340225; Sat, 2 Sep 2023 21:32:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcelp-0002Ch-4n; Sun, 03 Sep 2023 00:31: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 1qcelk-0002Bb-9H for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:28 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qceli-0006qH-40 for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:28 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bf11b1c7d0so7491685ad.0 for ; Sat, 02 Sep 2023 21:31:25 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715485; x=1694320285; 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=f1OoGlAFSrsHe5yxYX+ZMvZlZQ825ETdOqmrQ0CIV6k=; b=kA4M3398WlSF5p2S3z6dHSLu+W19S67s9Sj/c15Cooqx4EdWUdXHOC12zULCKXbsyh PExPSTTEYWRJh/8DHD46f5bkOhV3SqLhiPPod05aWrK8F5Dvp/Wop/YQZRNyJTRt6/Fi TSNN53U3MW8ju2BsqP9YW4ybLiEeQhoYCxLUKebUw4EeZ+syuLaJJ4fUM9aipIJCWBPs mwTNze8OCLnLBAbMPsJrXvqs9DezF54rkAkchP1fqDwfAtK+6gRG7/MdctmXmtAiMKCk WTE3IXZ/uvDa0AWtHB7a4JH2Ol6RkVM/e9AnfK/phCWFnekrvdZxlqbL7yQ6i8Zd9Vg/ u8DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715485; x=1694320285; 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=f1OoGlAFSrsHe5yxYX+ZMvZlZQ825ETdOqmrQ0CIV6k=; b=jzHlHpKekEALbncjmJhnf8p6ygjQ+c0E7UY8e9YDhnQ9Ub4LFbSqbcp+MUa+6vKU91 jOnej/tjo6UQ24DcTRVuLXmvCxUGBFBUbcEzmhsAt+ocD8dYsmjIphTAtksVpM6XkJgs uZ8z6qziR5QKRmkhDnXZOmmKNyK7+Ug3bjZeTai2QeYvddPC9aYCD0jS4kA15kE1AWbK oQbqXey1lYaaP+W/bxAlUmQUBbC4QMzmFGGV2frSNFUL2cGYphyt7Fw4YojvSzkuLdAn 6CGGkJZF1+K9ldnrdsStr/Udixpm6JCBe79FesKQZpTKQUVyLxuU9P0zyi6scyr57Fz1 VLlA== X-Gm-Message-State: AOJu0YzKUk19usVJ4m6X5wITlDElMLkq/Rt0RrxdU+tsz/w3Z2uVVYvX BIA2uv+CeCGEyQNk2ZaXD9CRYg== X-Google-Smtp-Source: AGHT+IGdm0kRAJURqufTgnNRidPox8bHlYkKt/8voSC1xGfWCJaCI3aeIWpP1XeXTFJk5XvdAstKBQ== X-Received: by 2002:a17:902:d2c5:b0:1c2:193e:1126 with SMTP id n5-20020a170902d2c500b001c2193e1126mr8068868plc.28.1693715484818; Sat, 02 Sep 2023 21:31: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 , Richard Henderson , Peter Maydell , qemu-arm@nongnu.org (open list:ARM TCG CPUs) Subject: [PATCH 3/8] target/arm: Move the reference to arm-core.xml Date: Sun, 3 Sep 2023 13:30:13 +0900 Message-ID: <20230903043030.20708-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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::636; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x636.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: 1693715535874100005 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 93c28d50e5..d71a162070 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2354,7 +2354,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; @@ -2376,8 +2375,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 Thu Nov 28 06:42:29 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=1693715643; cv=none; d=zohomail.com; s=zohoarc; b=aHAZaj2S1n10lwQsPOodUK/WpN73oJrFP6OVHiU/ThSqJ40s6icAMqcgQ2C97FX4gWfG8NxG0BFwpr7hSJx8GE11U4Hsn2iLjBeLj1KcnmtXavgmf5Cc/gLdNQRuNYMutzgG+yRV/wGhyxJSf1RJnYNquzcKn8mLXSe5L3VC7Mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715643; 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=frehclFszcwfB9vSGB44IhmZy3iPQA9K18ZglgMoRmU=; b=TCcEUbr5qbDebrkiFI1cSuYLEo3vfytIk1UC4CwirWMfsM/Sdd0/ERjqCCIFZo4a7BxwM6YSm3XqO7tfoCYPghU7Wz9mehAhFYQScYMR7MpWvgH8hgU9/3yxIPWU+maT2UMZdRno5ITO4kr1+abM9vOT17myWsnK9ctDHSurUZU= 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 1693715643547628.5063306809639; Sat, 2 Sep 2023 21:34:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcem6-0002Hv-RF; Sun, 03 Sep 2023 00:31:50 -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 1qcelt-0002D3-Ns for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:41 -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 1qcelo-0006uO-Pi for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:36 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-56c2e840e70so268691a12.3 for ; Sat, 02 Sep 2023 21:31:32 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715491; x=1694320291; 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=frehclFszcwfB9vSGB44IhmZy3iPQA9K18ZglgMoRmU=; b=Qz3j31K/vxqitUpXQPsJDk+rEfW2IOSPiK/DEqTE29YTGYFLUGKyPP5AG+Tc1ghUWy cXhfm9VVicK750iCIlw8T8C0iOjsHNiyDrHg5QWGP7NDbKuLOGuDBZFSbacFHBJj6Pwk yHbTXF6lHONB9y8T49/8IGC8scxYMw9pWWIfbi9oH9cBIObrJpmdbj99FFHxxnW8ujzh wNr2Wq7Mke80uYE4eTqyKY8g/b1fUdMicF4Ph28foVIMc/a3P5bTNjtVi1mW76DsyW6F TeKvD7UN0Jrsbqau9ZyuFKBDZzU0/megEMuYUmd6jG9VUdutCYnt9UWIRRihkx4EKvWd vLNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715491; x=1694320291; 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=frehclFszcwfB9vSGB44IhmZy3iPQA9K18ZglgMoRmU=; b=bbVJWMSAyS/cgdZ35OfVWn++r87N/fw1MLJcm2FP6kCluwa40uS6WZl4p/HgFJiD8/ PsWxaPxjxvhhCF+ytNw+Dm1B79ua6XdyxYGjVxdbzmMAI3dSAz5AoVt4bOM+JL+3Zql8 g/wRsuF1oLsFVQOEFqHgZ2xFrDWU4pRHTxYEvHnBCgIv4v98eawSiai9WrwHkduztf0T a8ZflT1ZmUeBhCU1en0/1yrHa0L/VzUBqW/XZnl2ebdkDCtqIJbdWw9ip4Ub572QD22c G8fKPpiQRX5KsrRxYKdf4z/KYVWElFUeCQ2r2P/GKkBslojPP7ZS88QpwTgBf9Zld5U9 30dQ== X-Gm-Message-State: AOJu0Yy6XuZea+sE80pXGjxM+0RNayqQUwEUagU36ITO0ItsHe6l5IRq f5so4yLjP9/44svG5E5la549fw== X-Google-Smtp-Source: AGHT+IFqi74KMZZIJBsU51vq7BtAop99Ju4EwXVlAvsyYxpn7DYQpdQxhwjWybwpk4U+0C5PCDmdoQ== X-Received: by 2002:a17:902:748a:b0:1c0:e014:90c1 with SMTP id h10-20020a170902748a00b001c0e01490c1mr7192189pll.48.1693715491599; Sat, 02 Sep 2023 21:31:31 -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 , 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 4/8] hw/core/cpu: Return static value with gdb_arch_name() Date: Sun, 3 Sep 2023 13:30:14 +0900 Message-ID: <20230903043030.20708-5-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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: 1693715645993100001 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: Michael Tokarev Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/cpu.h | 2 +- target/ppc/internal.h | 2 +- gdbstub/gdbstub.c | 4 +--- target/arm/cpu.c | 6 +++--- target/arm/cpu64.c | 4 ++-- target/i386/cpu.c | 6 +++--- target/loongarch/cpu.c | 4 ++-- target/ppc/gdbstub.c | 6 +++--- target/riscv/cpu.c | 6 +++--- target/s390x/cpu.c | 4 ++-- target/tricore/cpu.c | 4 ++-- 11 files changed, 23 insertions(+), 25 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 2772f07bbe..78711801db 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -379,11 +379,9 @@ static const char *get_feature_xml(const char *p, cons= t char **newp, "" ""); if (cc->gdb_arch_name) { - gchar *arch =3D cc->gdb_arch_name(cpu); pstrcat(buf, buf_sz, ""); - pstrcat(buf, buf_sz, arch); + pstrcat(buf, buf_sz, cc->gdb_arch_name(cpu)); pstrcat(buf, buf_sz, ""); - g_free(arch); } pstrcat(buf, buf_sz, "gdb_core_xml_file); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index d71a162070..4147c19597 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2281,15 +2281,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 97ad229d8b..68bea8d3f0 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5910,12 +5910,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 ad93ecac92..49565da3fa 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -692,9 +692,9 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = =3D { }; #endif =20 -static gchar *loongarch_gdb_arch_name(CPUState *cs) +static const gchar *loongarch_gdb_arch_name(CPUState *cs) { - return g_strdup("loongarch64"); + return "loongarch64"; } =20 static void loongarch_cpu_class_init(ObjectClass *c, void *data) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index ca39efdc35..72df36ca06 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 Thu Nov 28 06:42:29 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=1693715634; cv=none; d=zohomail.com; s=zohoarc; b=hccrSh461tQgLxRkOOtUyGMR7SWfXs1fdFQGu4xzaKgGD3TEdL1nlr3xESrwhQVF1IL+ziILW7pp/xTV9bAVZAx0HhLAayhEQ/VzcQAzbqkf9VnjEJxBgeTa4KOyimskiK9romrnPBq9n3gkx5I6xDcw63SfTZANCgroG56Zm7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715634; 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=z/aZ16AuCEo7wpubooP4JHdg7IKFA98mYu/To/TblDc=; b=PVIEmEyNTLBRFv0I4uT2MYlDJYODx8JNgD1d7xVKfe6e2jz/7TkV5gLJNJEOkb2RJBWqwbKxAVNLT8TmWmAyxHew3yeKERQyHdRNqkp3G3hX6oCATzaHVEnFUVMGknMwKjWzToh4YT7m2+hjVJMJ5a06JjU4eCwVr+rB51q0mRs= 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 1693715634373826.4851969698284; Sat, 2 Sep 2023 21:33:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcem2-0002Eu-9n; Sun, 03 Sep 2023 00:31:46 -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 1qcelu-0002DJ-UW for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:42 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcelr-0006va-4K for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:38 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-26f3975ddd4so270213a91.1 for ; Sat, 02 Sep 2023 21:31:34 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715493; x=1694320293; 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=z/aZ16AuCEo7wpubooP4JHdg7IKFA98mYu/To/TblDc=; b=0npzz2ObQNRkZi4Eh38hHblL59dVrtwiw2oQClBOrUmpDWuqBo/47ygOCJ3Ab9J5O5 DX2SZMekHBClpSlGIR5qOQPqAbpsXGz4QXS16Y2gVG5GTbzmd2AVfd878z0goGzkGW2V IrhpQ5BmTILRwMDlHtMsIDl77O7+FmE7BcTvwSmr1GZRfY94cqVKKqqbW1d7oGw7cnSf 8BENLVoMPQDJSurPCEraZzg6IIZs/wBcyvsaOseLkuintGhHpBrgc5wbSwV8ONdPORit 8uL5kx1sBmy1mbvpfTNzZXcUy49PsF8U6yYRA27cHpBNRFeEE8W/IVMZW/s7CmKcJsLu 301w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715493; x=1694320293; 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=z/aZ16AuCEo7wpubooP4JHdg7IKFA98mYu/To/TblDc=; b=XKBLeM8el1JH7GXPcZPUvXiGcuimPe4FuYuOnSAGRHn6K+eLeFwPSZiChTtnfHOVCy 5pQfAy5QIIljurO/0+u9xLG+YM05+HdlEgEefYfbZ32xp4W8cSubbC9/ETUnxHH7SBJh PKJoZUXGtvUx2WcRDfBvjZjIP6Zkb/v6yLiKMA+mLc7CpcDncGr05xeec3bEdT/lbkGC 4YIB76o4/X3fyVb10sqUD0coOlHp8Z+/RWWGdwuBq4rQ7agXDY7HbsrUnUBJk43vp3CM EQrbikzUdneMyTpICOO1Fu9rI6XRyhN9kTZ7XxTz1nDi4jMDk769NdhJas31/PXj2wj+ 0nqQ== X-Gm-Message-State: AOJu0YwPksWtG4YzI7LIRcwfZ2kWVE+AfN6jR/te02L3RQuB7HZICr55 /pdFJWRKKt4fAZQrefuBUC6+Ew== X-Google-Smtp-Source: AGHT+IGpUlqXdUGU543EtzTNpwbZyZkf86NKdkwWU8r8yW+vJCJ61u2R3VbTHYN/X8Ykc9YUKIDPgg== X-Received: by 2002:a17:90b:33d1:b0:25e:a8ab:9157 with SMTP id lk17-20020a17090b33d100b0025ea8ab9157mr5715886pjb.22.1693715493660; Sat, 02 Sep 2023 21:31:33 -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 5/8] gdbstub: Dynamically allocate target.xml buffer Date: Sun, 3 Sep 2023 13:30:15 +0900 Message-ID: <20230903043030.20708-6-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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::1035; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x1035.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: 1693715634748100001 There is no guarantee that target.xml fits in 1024 bytes, and the fixed buffer length requires tedious buffer overflow check. Dynamically allocate the target.xml buffer to resolve these problems. Suggested-by: Alex Benn=C3=A9e Signed-off-by: Akihiko Odaki --- gdbstub/internals.h | 2 +- gdbstub/gdbstub.c | 44 ++++++++++++++++++++++++-------------------- gdbstub/softmmu.c | 2 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index f2b46cce41..4876ebd74f 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -33,7 +33,7 @@ typedef struct GDBProcess { uint32_t pid; bool attached; =20 - char target_xml[1024]; + char *target_xml; } GDBProcess; =20 enum RSState { diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 78711801db..3f97dc66e5 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -367,33 +367,37 @@ static const char *get_feature_xml(const char *p, con= st char **newp, =20 name =3D NULL; if (strncmp(p, "target.xml", len) =3D=3D 0) { - char *buf =3D process->target_xml; - const size_t buf_sz =3D sizeof(process->target_xml); - /* Generate the XML description for this CPU. */ - if (!buf[0]) { + if (!process->target_xml) { + g_autoptr(GPtrArray) a =3D g_ptr_array_new_with_free_func(g_fr= ee); GDBRegisterState *r; =20 - pstrcat(buf, buf_sz, - "" - "" - ""); + g_ptr_array_add( + a, + g_strdup("" + "" + "")); if (cc->gdb_arch_name) { - pstrcat(buf, buf_sz, ""); - pstrcat(buf, buf_sz, cc->gdb_arch_name(cpu)); - pstrcat(buf, buf_sz, ""); + g_ptr_array_add( + a, + g_markup_printf_escaped("%s", + cc->gdb_arch_name(cpu))); } - pstrcat(buf, buf_sz, "gdb_core_xml_file); - pstrcat(buf, buf_sz, "\"/>"); + g_ptr_array_add( + a, + g_markup_printf_escaped("", + cc->gdb_core_xml_file)); for (r =3D cpu->gdb_regs; r; r =3D r->next) { - pstrcat(buf, buf_sz, "xml); - pstrcat(buf, buf_sz, "\"/>"); + g_ptr_array_add( + a, + g_markup_printf_escaped("", + r->xml)); } - pstrcat(buf, buf_sz, ""); + g_ptr_array_add(a, g_strdup("")); + g_ptr_array_add(a, NULL); + process->target_xml =3D g_strjoinv(NULL, (void *)a->pdata); } - return buf; + return process->target_xml; } if (cc->gdb_get_dynamic_xml) { char *xmlname =3D g_strndup(p, len); @@ -2199,6 +2203,6 @@ void gdb_create_default_process(GDBState *s) process =3D &s->processes[s->process_num - 1]; process->pid =3D pid; process->attached =3D false; - process->target_xml[0] =3D '\0'; + process->target_xml =3D NULL; } =20 diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index f509b7285d..5282324764 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -293,7 +293,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 Thu Nov 28 06:42:29 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=1693715633; cv=none; d=zohomail.com; s=zohoarc; b=EIE7Z5PN2sjbFXcOTXR5xYiJNxupnyrdAvG3aR1dn8j0XihQNSoSnWieaDkinF/sPEZ4Viuqr9/YvOeXiQgbTeww0tyqxbe1FP0XOUa/8PDurSZamtzxBGJ1LFdrmdO1RDkDEC4xS8aem4ugIb3OinNbGcwKm2MVOo49ziL24LQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715633; 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=imQ9qzdcJDtD/a1jypCsLu37Mc6AwMqkJVAfloEAGmU=; b=BkB64FslgLaAVU8SL7YH+gXnoE2dEhbH1joS4zzcoRzm2Hb1nvuo6myKUatgesWS9BsmjpcMXnJ0TYC7VElc+gFqP+HCmOkyDFYKDfmo6vHE6R7qrfgftxCrL2clB0n4PfKz6VoGi/+hDydgukp8kpAnPgRswJ0FXm40DCQhEiY= 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 1693715633638540.8577657849787; Sat, 2 Sep 2023 21:33:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcem5-0002HE-UH; Sun, 03 Sep 2023 00:31:49 -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 1qcelw-0002DS-Br for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:43 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcelt-0006yb-7O for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:40 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1bf11b1c7d0so7491945ad.0 for ; Sat, 02 Sep 2023 21:31:36 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715496; x=1694320296; 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=imQ9qzdcJDtD/a1jypCsLu37Mc6AwMqkJVAfloEAGmU=; b=ZOaqrIgYfOjAUpmEYR1gPQ6qKUahRgpXYvqaRVD8DfDjXIhbCLYS1FFLzR48cIp+oC H2JLDVkys11YHcx7tQbtlgA+IAGsC939pHnLd/+e20HQ/yIJvBzqt+J1VxrRAbM+MMqu v3dzO6Wn8A4yXPdBAzQxEO5pm37F/4FrDXnVLA1K++4pT2F51V8+1/NBPUDkaAEfWY6c G71cg2r6nYLqCTJORV342pGFKlFc9HmEciV0+SfrHu/VEV9iSumKpF8pMxqlUKdYbg18 tzDDtxrfX8ERqx/3lrjBOh61fWe7zdZcmGOAVya5/O0mDp3BbzwC3ceWNOK2Vs9IOslo STsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715496; x=1694320296; 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=imQ9qzdcJDtD/a1jypCsLu37Mc6AwMqkJVAfloEAGmU=; b=LLJ7S2yKxwxZ/0xKNYpd98HTm6aI7cEOjYHGz79gk7kuMPlwjtAWGxzL5CiQmr2NkW LgCajPnTeHLbcqYSmeGkqa9PoFfwTUtO1YAxtkuytkvkwF/ld1MFdpvkR18+nnWfp0O/ YQqq2jw+OCSq5hu9SVavkjuo5W0G6RVXnfYZFRRKeAUf9AJ0hkh/H/xF1EjfjhFaqyJX kN/P5u2bLNlpXGWMnd97+rQa2MGusSJlndw61GxQk1ssBZCS8ndEusIJT37k3lJOd/x4 SuSqEe8OVD1aAmbLXLW/au0IycVlA7BRaxxb6b0sYGmhcZ6bDKI7jA0XkDkZQouLrpWP hIdA== X-Gm-Message-State: AOJu0YxQvGTWjceVW9zgpCfRK0+v8Wwu/BAnuJutGeojL9a6u+my12Uy NGAKYD7ZtyQ1vN9ChEpTu3K7BCa5G7i4B5qKcHQ= X-Google-Smtp-Source: AGHT+IGMbfp+G5QcVXO4jcvTYCcJ830aRAKEId2e0w6AbOvdHewaqNTukLG+W6rYVP9xPtXB7o9eTQ== X-Received: by 2002:a17:902:ec84:b0:1bf:7aeb:c488 with SMTP id x4-20020a170902ec8400b001bf7aebc488mr9373299plg.29.1693715495898; Sat, 02 Sep 2023 21:31:35 -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 6/8] target/arm: Remove references to gdb_has_xml Date: Sun, 3 Sep 2023 13:30:16 +0900 Message-ID: <20230903043030.20708-7-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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::629; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x629.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: 1693715635272100006 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 f421c5d041..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 Thu Nov 28 06:42:29 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=1693715579; cv=none; d=zohomail.com; s=zohoarc; b=Q4DXaUWXxLQ150qomXv+yCrKE6HhN9HHrp+NtCq9+lB1zu+VhdlH4ZXISJaKAQ6MLIas5c6ddjiBceL8IiQN5eXp22sJ+TGBaX4yPhZO741AzIuc5P6tG9cHVEoh40yVdG26k6KNIeYitu4+GZZ+nW5M7q9pi86dW6dGpsc6x0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715579; 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=JGIx5VmKC+qEqkrX7A0VzIiIuVMOabzMZ9XhVHygWtw=; b=VdR4cwBeGQT8vpoW90pBVYjAZN2YKHHZhXcc5jWdQpZuEMmSGsNIChnAD8WMXsPbZTcKy1bISwI3a3p25wEOZ1MNVBxMdW4gPprbz4G0JoxsMjy3w43tLu/G12H8omVhS92wTTvP+KR/NkGMyz4b8qQ2a/t0pCLcd7gQfjxljYE= 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 169371557943457.89514460258772; Sat, 2 Sep 2023 21:32:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcem4-0002GB-UV; Sun, 03 Sep 2023 00:31:49 -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 1qcem1-0002Et-JV for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:45 -0400 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcelv-0006zr-UR for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:45 -0400 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6bcb5df95c5so383727a34.1 for ; Sat, 02 Sep 2023 21:31:39 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715499; x=1694320299; 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=JGIx5VmKC+qEqkrX7A0VzIiIuVMOabzMZ9XhVHygWtw=; b=nh0ZP+w7OjM1poJUNbqrJZ0QpD6tk/yYiQX4QHgzsMSUMRXw4+NONJH81DMqEaxYdU +ELScZmISITmQ+S+ebT5a6esJyInG+XSZfWb9ZNkTLetuAg90KDEe5l8KAKWU5Nss973 e4ysDPBFLIEEcGN0udrssKOjyQc59WDWIuZYkh1tmwP7g7o5C1yISda5lUdpTLPf1C58 L7XWs5Sj1g4RaJSAwsN6E4cnaKW9u7zffMDICUi301vmpnno0AjTYduEA8IM0EXqcx2r UwmcNfmWMOne93TB6+5H1CR6ZYF/hNYhk7zkvGgNiokvHII6OLaja2r+krpgwVPGYxIn XMxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715499; x=1694320299; 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=JGIx5VmKC+qEqkrX7A0VzIiIuVMOabzMZ9XhVHygWtw=; b=EL/afcrGHgPq9+hcEYSyFmUFKiY9TSiMJ0tUuaJHl7UImMDLXNjO4tlB3Rba6H4GeK jtcQ8DL+aPQZ5iF64AKKPRPuCe7GAEORAuYo8t5m8kkNuIizWhHFY67J1hG6wF6g9877 92bhCU70nqhz2EQvYtpjZD6vdI6gLlH9byc7tltaaePBSsuKZ6pClLGrZbh2wHJHJiKL Y/BGnVJ2uRJ9540XEOiieHy7+mEW4N7gqaAWoBNjJDDpU8JabkOv6nmOL9nUsmaXctnr yc1wsWxdDM4SFJCEsmJG01Bes5M/0HlNOdma22a+lubFqUTBslifCXgA/OIrAZa0leFN RHTg== X-Gm-Message-State: AOJu0YzAkxL4DwpQpboIcVgek7HITTo7XhH8lW26rNDwhCaviUHtn1pf hY2qlDT3Lgyb6+rCvLonqsgHbg== X-Google-Smtp-Source: AGHT+IFQkakJ8PSvZSCptRrZmoLdXYWhZchavzY3Bbjb9riKNDi8Uw0rJR7gGrV4tpZInEngFR6ecg== X-Received: by 2002:a54:4e81:0:b0:3a7:2570:dcfc with SMTP id c1-20020a544e81000000b003a72570dcfcmr7919345oiy.43.1693715498840; Sat, 02 Sep 2023 21:31: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 , 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 7/8] target/ppc: Remove references to gdb_has_xml Date: Sun, 3 Sep 2023 13:30:17 +0900 Message-ID: <20230903043030.20708-8-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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::330; envelope-from=akihiko.odaki@daynix.com; helo=mail-ot1-x330.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no 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: 1693715580055100001 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 72df36ca06..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 Thu Nov 28 06:42:29 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=1693715596; cv=none; d=zohomail.com; s=zohoarc; b=bWvt9xkPnaYmRpfqXdbuMG2FD5UddXfYx/GOObfwsAF+W/Tcy3/IOM0yaMM/Xx9gS6IyszvmoIceA6gqRBLWUCeJOrtlllR53i8lnpfBpHgqjJHE+oMkIZm4EKby1yqGbyPEwGXHDfqUXFgiHX/t0NeNJhNW47r5FRs6MmKmyEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693715596; 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=VEpkefa+vwrcbEzUpVuiGVWFL+7pW2dZSw9F43I190M=; b=QgT8CrOqT/sRd6nDkVPYSuz83EOcVV4gCFMRrMnccFOnBc0XkUFR3GuAm1P5KwYk+DXjEDIlVsN38czNtl26yXFt7gCXMyOCQKey0zTfl9mMDuxtZmc3h1JV7nO79T4SjNdTZX9dsp2x4GVIBjNR/Sx/Divb5NuJfKarMcJEc1Y= 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 169371559616826.749367231604424; Sat, 2 Sep 2023 21:33:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcem8-0002IB-Ne; Sun, 03 Sep 2023 00:31:52 -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 1qcem0-0002Ep-RP for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:45 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcely-00070G-BH for qemu-devel@nongnu.org; Sun, 03 Sep 2023 00:31:44 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-56c2e840e70so268747a12.3 for ; Sat, 02 Sep 2023 21:31:42 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id iz2-20020a170902ef8200b001bb9f104328sm5295792plb.146.2023.09.02.21.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 21:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1693715501; x=1694320301; 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=VEpkefa+vwrcbEzUpVuiGVWFL+7pW2dZSw9F43I190M=; b=piHSXw+43F7E7TGvLNqsL84Tg8UAHzpuxPzUuyBQSAPvdXkj1AbZf55qxtQwqCcM1z nB1QODNUHV86by+FPyPulWdQsYwnbEswq+PKbGQzsvg+b+hjFEsXEQb96WbGyLR13h8g Jz+vNt9u7CrUjbBsAkb5Yba8ruhDz9APRg/PiVqSVUWXj0YTbzqplhoCa3NT8VJq+hGA y49j7mYtV8eHWYjMh/KiEWKiLGJrsq79as31PfGXqEJ8pCCuXtMFzw52SeC/HMwB7bPa ZYaJXuVKA/SLIaa36aNpg/CUgLl4x36un5ATbHBYkzZFkh01CGMjNffM+gQ7uG/goAKm Ch2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693715501; x=1694320301; 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=VEpkefa+vwrcbEzUpVuiGVWFL+7pW2dZSw9F43I190M=; b=JTGxcsK2QuCOmmJYraWVcz3Pc5iXE+7NuavYWWpHaWC7JKT4n7omPfSfHZ1RQeLlkN t2nPZ0cudc69UjCq/dUJGYh6yH1TFhFbyC5tVguGQy03f/JwzUE5hQHIlsPTtT7ZjnC7 a9l48mBj24ILSRtyWxj2dMyASD8/qecH4K9AaZaleoJ39ZT5Twg/4bXXWLvScfeD4lJG mNrk/5gGaPmR0Vwc1aoU9cZv/O2A1Q/MGLDo6evMBvZUjThCmPhBTnhe5YN+VTSdkPE4 CV9JTEmajwVEXk4dcRfyEBl2laEcR1KdZeMSexPlqjunTmfvVfFoQot5MrzDylC+aayC Nv5Q== X-Gm-Message-State: AOJu0YxRnUN4/EXoam6gavqQDvvvR5Z0HErxlAWeSe1bgD08PcTRPeqL J6o1gAGHRip0Sfzhv5QhBzwLrw== X-Google-Smtp-Source: AGHT+IGgh+1VfKLQaHmCsegaxJ/N/F1rIFb0Lzv4WKdJJBl902/x/DzzoZawowmQ7cAg86Skg0i2QA== X-Received: by 2002:a17:902:d3d5:b0:1b6:c229:c350 with SMTP id w21-20020a170902d3d500b001b6c229c350mr7414253plb.18.1693715501143; Sat, 02 Sep 2023 21:31: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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 8/8] gdbstub: Remove gdb_has_xml variable Date: Sun, 3 Sep 2023 13:30:18 +0900 Message-ID: <20230903043030.20708-9-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230903043030.20708-1-akihiko.odaki@daynix.com> References: <20230903043030.20708-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::532; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x532.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: 1693715596622100001 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 --- include/exec/gdbstub.h | 8 -------- gdbstub/gdbstub.c | 13 ------------- gdbstub/softmmu.c | 1 - gdbstub/user.c | 1 - 4 files changed, 23 deletions(-) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 3f08093321..ecbc60a934 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -35,14 +35,6 @@ int gdbserver_start(const char *port_or_device); =20 void gdb_set_stop_cpu(CPUState *cpu); =20 -/** - * gdb_has_xml: - * This is an ugly hack to cope with both new and old gdb. - * If gdb sends qXfer:features:read then assume we're talking to a newish - * gdb that understands target descriptions. - */ -extern bool gdb_has_xml; - /* 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 3f97dc66e5..61c811f42b 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -75,8 +75,6 @@ void gdb_init_gdbserver_state(void) gdbserver_state.sstep_flags &=3D gdbserver_state.supported_sstep_flags; } =20 -bool gdb_has_xml; - /* writes 2*len+1 bytes in buf */ void gdb_memtohex(GString *buf, const uint8_t *mem, int len) { @@ -1054,11 +1052,6 @@ static void handle_set_reg(GArray *params, void *use= r_ctx) { int reg_size; =20 - if (!gdb_has_xml) { - gdb_put_packet(""); - return; - } - if (params->len !=3D 2) { gdb_put_packet("E22"); return; @@ -1075,11 +1068,6 @@ static void handle_get_reg(GArray *params, void *use= r_ctx) { int reg_size; =20 - if (!gdb_has_xml) { - gdb_put_packet(""); - return; - } - if (!params->len) { gdb_put_packet("E14"); return; @@ -1542,7 +1530,6 @@ static void handle_query_xfer_features(GArray *params= , void *user_ctx) return; } =20 - gdb_has_xml =3D true; p =3D get_param(params, 0)->data; xml =3D get_feature_xml(p, &p, process); if (!xml) { diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index 5282324764..42645d2220 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -97,7 +97,6 @@ static void gdb_chr_event(void *opaque, QEMUChrEvent even= t) =20 vm_stop(RUN_STATE_PAUSED); replay_gdb_attached(); - gdb_has_xml =3D false; break; default: break; diff --git a/gdbstub/user.c b/gdbstub/user.c index 5b375be1d9..7ab6e5d975 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -198,7 +198,6 @@ static void gdb_accept_init(int fd) gdbserver_state.c_cpu =3D gdb_first_attached_cpu(); gdbserver_state.g_cpu =3D gdbserver_state.c_cpu; gdbserver_user_state.fd =3D fd; - gdb_has_xml =3D false; } =20 static bool gdb_accept_socket(int gdb_fd) --=20 2.42.0