From patchwork Fri Nov 3 19:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 740707 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp8178wrr; Fri, 3 Nov 2023 13:02:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLquPUWy448l5lYr857+B3m+gknnk3w6wF8nuyBf0M9/PLO1/GO7mRw1IYonVJr9n8tBi3 X-Received: by 2002:a05:620a:29d4:b0:767:f1de:293c with SMTP id s20-20020a05620a29d400b00767f1de293cmr24992732qkp.59.1699041751557; Fri, 03 Nov 2023 13:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699041751; cv=none; d=google.com; s=arc-20160816; b=Zeb3MOa5cnNiFxE4c/YrTrz1gsly6VRS4YHV0gqAGIMH5fFfMMIYtWywxMaQvoWEhp R4bKrQ+Gv8lQZ1W40ukSEyex0PTNRE7oqH43sQUwGWXa3veA3XbeOP6itMdWxs4+7XD4 M4igKTF0mfxgJ3SwKClfn/tOmGcytgtNcSkgjb67dk0N+uK9TXS5aetbC5HqVgokjtJz KzRZQ4MTBxfxRGPSv8uKGazNibGSRU+LAigyYyTemPRe634QgUasPaa0IkDt2/qTtbgL C2TMGmFBTCn50+tAK43fXZZ4svm9JOrzRLyAsXfjqd2XIrFq/q5hoX1iS+IZDMdtXZBH ZkaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=PagTFhtGro2QGC99VR/E/0PR8y9aQjyT8Q40jlAqxEQ=; fh=Kx2XI2Yx2wBtcq6Uh/oWjWfpY5DZOGguZfb2uQrLFXM=; b=yCnt9vS0RHFVM/UOrvEOuRrLECxOqniqhayZZwMwg9E8ikSTlwHsY/FxAFqMrayQRI mrzme9IH5hubg8SXP5YOQj7Kyco12JrargxRstaYhEM5sGge1AeQ/GE2ciPz/x8adiKE iC3I8g6tQHNVMfPboqfdbhQP+udunjewS6Gx25fqgUGxewVGC1E7opuqy+Ie2B5mfILG 3KPJ8E5OGMuUBmEoCUNM8R1/1zMNym6cRdRdtwhqqiQYU0w8SnqfzCix4ONloqZS0gv4 pswBPuv9xpWMeuJZr2h54hlKNDaWIrtTk7k897qnje7LvWf3oJ/7jO5KUR8VlO0wzTqR DfMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dbSNcBIL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v25-20020a05620a091900b0076d9ca72d0esi1981479qkv.699.2023.11.03.13.02.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Nov 2023 13:02:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dbSNcBIL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qz0Ku-00086i-M9; Fri, 03 Nov 2023 16:00:08 -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 1qz0Kr-000847-Df for qemu-devel@nongnu.org; Fri, 03 Nov 2023 16:00:05 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qz0Km-0005KB-0L for qemu-devel@nongnu.org; Fri, 03 Nov 2023 16:00:05 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40859c464daso17976205e9.1 for ; Fri, 03 Nov 2023 12:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699041598; x=1699646398; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PagTFhtGro2QGC99VR/E/0PR8y9aQjyT8Q40jlAqxEQ=; b=dbSNcBILQLYCmxmaQckcCyEGiF9dp0gVYsUcNnUhF2xFot3ZDECk2DhYIE6ikEdq3P NcXjNpOp1IoIDg4NFfiANtbzl5B4w0LAF0cqDyy15as03+W7A6MMWUwSOJ6Vh/bmdXQ4 SRvvWmohRDMZIdGMfs45VTfq5iDIhU2PO7ij60YhZDLk8YopFKSV90ku9ck5o5vh+hCy FOUqvRLAmp+F6HFV/ajBx6z/qFkLx/KUPYc45cgp+RCDzKdv1FSKZrkDmOD2hNkzpqzr m4F+0t/SC9ImBFHVk4fSGPvfiACi0gvRaAvgu1HySOu5H9oQsQ8ahB4OeJNUc7VbbTQb 0+Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699041598; x=1699646398; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PagTFhtGro2QGC99VR/E/0PR8y9aQjyT8Q40jlAqxEQ=; b=WUFoqbIL4e0EtXnUvHlQrYmgEU+n4HWKH1dNPWEh20E1PTWE5HDTlwOn4Dmj6zPFCS UFvAbuvyxRkEqvCCBrVdjGXNY6z9AFm5I57bsOEOjcyR/fgBHtKi21P8rvsD+ype/FSS tpC1b1Sjg8R2WSDJsS7ZVNm6xSJisWyHi06eUk3t6QJFGU7W47NNcWwHQQLCZbQm/Gsz gFMC92Vsg4RzSAAHQ/cfjM1HXMn0cmsSzXllgXbFNZlZU3IdU4co6fYxl/PskygD89N2 XB47X0v1ggPFy9EAacSf1BFxdub9swlYF7/fjreJ1SMp0bqZWstnCn6Gx6OabJztEWU3 9KvA== X-Gm-Message-State: AOJu0Ywzz5BDdMsXC5L419WHg26QcuY2kfDNdgG0OwmVCilsOEKFKwTG bBi69YUWCMgRnrbGkSy49AWqxA== X-Received: by 2002:a05:600c:358a:b0:408:59d4:f3d8 with SMTP id p10-20020a05600c358a00b0040859d4f3d8mr19375356wmq.18.1699041597730; Fri, 03 Nov 2023 12:59:57 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id y23-20020a05600c341700b00406408dc788sm3402021wmp.44.2023.11.03.12.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 12:59:57 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id AAAC9656E5; Fri, 3 Nov 2023 19:59:56 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , "Edgar E. Iglesias" , Song Gao , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Wainer dos Santos Moschetta , Weiwei Li , Marcel Apfelbaum , Ilya Leoshkevich , Daniel Henrique Barboza , Yanan Wang , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?C=C3=A9dri?= =?utf-8?q?c_Le_Goater?= , Paolo Bonzini , David Hildenbrand , Brian Cain , qemu-ppc@nongnu.org, Palmer Dabbelt , qemu-riscv@nongnu.org, Eduardo Habkost , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Liu Zhiwei , Cleber Rosa , qemu-s390x@nongnu.org, Laurent Vivier , Yoshinori Sato , Nicholas Piggin , Thomas Huth , John Snow , Alexandre Iooss , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Mahmoud Mandour , Daniel Henrique Barboza , Bin Meng , Beraldo Leal , Richard Henderson , Michael Rolnik Subject: [PATCH 00/29] gdbstub and plugin read register and windows support Date: Fri, 3 Nov 2023 19:59:27 +0000 Message-Id: <20231103195956.1998255-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Here are my final updates for the 8.2 cycle which I can hopefully merge if we get enough review. Aside from the usual tweaks and fixes there are two new features: TCG Plugin Register Access This is based on Akihiko's previously posted series with some changes by myself. I wasn't keen on the plugin facing API so I've re-written it to use an opaque handle and hide the gdb details from the plugin. I think this allows for potential future improvements as well as being ready for up-coming heterogeneous support. The new API allowed for making the execlog register tracking a bit more flexible and able to track multiple registers. Windows Support This fairly late breaking patch finally adds support for Windows to the TCG plugins subsystem. I'm pretty pleased with Greg's approach which improves on previous attempts by avoiding re-implementing a linker for POSIX targets. I don't have access to Windows though so I'm calling on Windows users to test the solution. The following patches still need review: contrib/plugins: extend execlog to track register changes plugins: add an API to read registers gdbstub: expose api to find registers tests/avocado: update the tcg_plugins test tests/tcg: add an explicit gdbstub register tester target/arm: hide aliased MIDR from gdbstub target/arm: hide all versions of DBGD[RS]AR from gdbstub target/arm: hide the 32bit version of PAR from gdbstub gdb-xml: fix duplicate register in arm-neon.xml Akihiko Odaki (16): default-configs: Add TARGET_XML_FILES definition gdbstub: Add num_regs member to GDBFeature gdbstub: Introduce gdb_find_static_feature() gdbstub: Introduce GDBFeatureBuilder target/arm: Use GDBFeature for dynamic XML target/ppc: Use GDBFeature for dynamic XML target/riscv: Use GDBFeature for dynamic XML gdbstub: Use GDBFeature for gdb_register_coprocessor gdbstub: Use GDBFeature for GDBRegisterState gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb gdbstub: Simplify XML lookup gdbstub: Infer number of core registers from XML hw/core/cpu: Remove gdb_get_dynamic_xml member gdbstub: Add members to identify registers to GDBFeature cpu: Call plugin hooks only when ready plugins: Use different helpers when reading registers Alex Bennée (9): gdb-xml: fix duplicate register in arm-neon.xml target/arm: hide the 32bit version of PAR from gdbstub target/arm: hide all versions of DBGD[RS]AR from gdbstub target/arm: hide aliased MIDR from gdbstub tests/tcg: add an explicit gdbstub register tester tests/avocado: update the tcg_plugins test gdbstub: expose api to find registers plugins: add an API to read registers contrib/plugins: extend execlog to track register changes Greg Manning (4): plugins: add dllexport and dllimport to api funcs plugins: make test/example plugins work on windows plugins: disable lockstep plugin on windows plugins: allow plugins to be enabled on windows docs/devel/tcg-plugins.rst | 10 +- configure | 9 +- configs/targets/loongarch64-linux-user.mak | 1 + meson.build | 5 + accel/tcg/plugin-helpers.h | 3 +- include/exec/gdbstub.h | 121 +++++++- include/hw/core/cpu.h | 7 +- include/qemu/plugin.h | 1 + include/qemu/qemu-plugin.h | 104 ++++++- target/arm/cpu.h | 27 +- target/arm/internals.h | 14 +- target/hexagon/internal.h | 4 +- target/microblaze/cpu.h | 4 +- target/ppc/cpu-qom.h | 4 +- target/ppc/cpu.h | 2 - target/riscv/cpu.h | 5 +- target/s390x/cpu.h | 2 - accel/tcg/plugin-gen.c | 43 ++- contrib/plugins/execlog.c | 180 +++++++++--- contrib/plugins/win32_linker.c | 34 +++ cpu-target.c | 11 - gdbstub/gdbstub.c | 273 +++++++++++++----- hw/core/cpu-common.c | 15 +- plugins/api.c | 114 +++++++- target/arm/cpu.c | 2 - target/arm/cpu64.c | 1 - target/arm/debug_helper.c | 8 +- target/arm/gdbstub.c | 230 +++++++-------- target/arm/gdbstub64.c | 122 ++++---- target/arm/helper.c | 4 +- target/avr/cpu.c | 1 - target/hexagon/cpu.c | 4 +- target/hexagon/gdbstub.c | 10 +- target/i386/cpu.c | 2 - target/loongarch/cpu.c | 2 - target/loongarch/gdbstub.c | 13 +- target/m68k/cpu.c | 1 - target/m68k/helper.c | 26 +- target/microblaze/cpu.c | 6 +- target/microblaze/gdbstub.c | 9 +- target/ppc/cpu_init.c | 7 - target/ppc/gdbstub.c | 114 ++++---- target/riscv/cpu.c | 15 - target/riscv/gdbstub.c | 139 +++++---- target/rx/cpu.c | 1 - target/s390x/cpu.c | 1 - target/s390x/gdbstub.c | 105 ++++--- contrib/plugins/Makefile | 26 +- gdb-xml/arm-neon.xml | 2 +- plugins/meson.build | 17 ++ plugins/qemu-plugins.symbols | 2 + scripts/feature_to_c.py | 58 +++- tests/avocado/tcg_plugins.py | 28 +- tests/plugin/meson.build | 14 +- tests/tcg/multiarch/Makefile.target | 11 +- tests/tcg/multiarch/gdbstub/registers.py | 188 ++++++++++++ .../multiarch/system/Makefile.softmmu-target | 13 +- 57 files changed, 1577 insertions(+), 598 deletions(-) create mode 100644 contrib/plugins/win32_linker.c create mode 100644 tests/tcg/multiarch/gdbstub/registers.py