From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407379; cv=none; d=zohomail.com; s=zohoarc; b=D+nQgxxCpBMjdhsjzahBViXl4+VntVeJBV/H494juCdvMA1e+2j713vxPFM+b6YsZ6FAABYrAhkWNjIkmaB5gfF3dFSdBB9u5IB2u7hWloQf5ArdXECJYeV5iWe0l0ZWvAJA19JUw9KvLOWaSEr/ac4O3DoEAM1SJuQNRA9+E20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407379; 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:To; bh=+KwLHI/E94Q26mI+rQkt5YQi8gKeSm5LiWqohZsEnUk=; b=gDbAbqQAm1AQEtauC8daQyek+jKBQ6TXxdSn7hwW3HrEigxnTHGIPeJBirzG4Ris/YXQ16Ufi9HPBAg3hhenXX3FSc6cNa5x5uEBOpwo0U2wUmgkP3TiB6lVYdn7lP8KEUryrUB6C6OVbADJNDEmHk1VswiB6nS28cIRdaigMx8= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407379810371.9391655840885; Wed, 30 Aug 2023 07:56:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaH-0001BF-Tm; Wed, 30 Aug 2023 10:54:17 -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 1qbMaE-00019B-0O for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:14 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaA-0000jH-7P for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:13 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-401d67434daso19356305e9.2 for ; Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id c10-20020adfef4a000000b0031773e3cf46sm16855458wrp.61.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:08 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BC3961FFBC; Wed, 30 Aug 2023 15:54:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407249; x=1694012049; 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=+KwLHI/E94Q26mI+rQkt5YQi8gKeSm5LiWqohZsEnUk=; b=Klhxh32atk0WUQpqDJ1B/ZVCP0/0YgcKjlVHmHCsOLwXIEVrR3Vm/j8vZvSk8/48Bc LBum1jkeag2alKroT7Fnu1JHQq+7JZAm7s+G2zzaJCrfK1d1YnH7AHcjswWV4zKmFLeF LORIHarKujVATleqYtbYHjm+kJZ94a2e0G8FcFNZDVK9puPfRWUd6Mpc5cLzfd3DI/1r ErfdTX8jWllOusNE0fG+Y+KPl89FiUCoHX36kd+GmCQR9Ciqia9Z6KCb38EHOqmgZfcc hbKMAXK9T+39EwgPEwhFM4DGia6erwIrH+WjWtybMR3R4ciIxSEOi+T2977o7DIPgLi9 Na1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407249; x=1694012049; 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=+KwLHI/E94Q26mI+rQkt5YQi8gKeSm5LiWqohZsEnUk=; b=eEg/wiMMoPGC2lBi8SfcnngZr9tWJlaNtLb5tyOZW+bgM6z3cFGWt7qe45LFT1X+Jg LZCEPYhn1R/TwgZ0FLsCop9kZPzaSgAoR6ys0lEAfWTCMTYDyrGzm9xfR+NU9FkjfqTd +eFJZu0Guky6dLdbUSbP2qZflKlQnKfnDkl7IPiZ8LhAjpzWf13MNxZ5TPe0BPDv8AWm Cre3Z+hJfdcRwD1q62EWHh5YcONaPjwNr+J2EdD66Uq4xLrUdc6rzeYc6kRDzsVpL4U2 BSiK5MuSy+xQWrhgxpsxnRmeQBICQcWRUNjLk3RfjdUdQrQUU5XTrMsvCyjbQTEs5aFS 6DVQ== X-Gm-Message-State: AOJu0Yx4hmTt4Ptx2J/m6yY09f8DBCHrbUrZtiQv4/sPlL9T81pfwfKp DaemUXt16rAG5qvnwqmmlJDjkWipX989aOq7kpo= X-Google-Smtp-Source: AGHT+IHGtc8eDAO1fFXKqLCXPMt6CmJEaOOF/6ASSylHO21VsBYJRQW9ol0t0IIoxhJuE/Ktcw92mg== X-Received: by 2002:a5d:4845:0:b0:319:666e:b466 with SMTP id n5-20020a5d4845000000b00319666eb466mr2042696wrs.42.1693407248574; Wed, 30 Aug 2023 07:54:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Yonggang Luo Subject: [PULL 01/12] gitlab: enable ccache for many build jobs Date: Wed, 30 Aug 2023 15:53:56 +0100 Message-Id: <20230830145407.3064249-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407381148100003 From: Daniel P. Berrang=C3=A9 The `ccache` tool can be very effective at reducing compilation times when re-running pipelines with only minor changes each time. For example a fresh 'build-system-fedora' job will typically take 20 minutes on the gitlab.com shared runners. With ccache this is reduced to as little as 6 minutes. Normally meson would auto-detect existance of ccache in $PATH and use it automatically, but the way we wrap meson from configure breaks this, as we're passing in an config file with explicitly set compiler paths. Thus we need to add $CCACHE_WRAPPERSPATH to the front of $PATH. For unknown reasons if doing this in msys though, gcc becomes unable to invoke 'cc1' when run from meson. For msys we thus set CC=3D'ccache gcc' before invoking 'configure' instead. A second problem with msys is that cache misses are incredibly expensive, so enabling ccache massively slows down the build when the cache isn't well populated. This is suspected to be a result of the cost of spawning processes under the msys architecture. To deal with this we set CCACHE_DEPEND=3D1 which enables ccache's 'depend_only' strategy. This avoids extra spawning of the pre-processor during cache misses, with the downside that is it less likely ccache will find a cache hit after semantically benign compiler flag changes. This is the lesser of two evils, as otherwise we can't use ccache at all under msys and remain inside the job time limit. If people are finding ccache to hurt their pipelines, it can be disabled by setting the 'CCACHE_DISABLE=3D1' env variable against their gitlab fork CI settings. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230804111054.281802-2-berrange@redhat.com> Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-2-alex.bennee@linaro.org> diff --git a/docs/devel/ci-jobs.rst.inc b/docs/devel/ci-jobs.rst.inc index 3f6802d51e..4c39cdb2d9 100644 --- a/docs/devel/ci-jobs.rst.inc +++ b/docs/devel/ci-jobs.rst.inc @@ -188,3 +188,10 @@ If you've got access to a CentOS Stream 8 x86_64 host = that can be used as a gitlab-CI runner, you can set this variable to enable the tests that require this kind of host. The runner should be tagged with both "centos_stream_8" and "x86_64". + +CCACHE_DISABLE +~~~~~~~~~~~~~~ +The jobs are configured to use "ccache" by default since this typically +reduces compilation time, at the cost of increased storage. If the +use of "ccache" is suspected to be hurting the overall job execution +time, setting the "CCACHE_DISABLE=3D1" env variable to disable it. diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-t= emplate.yml index f3e39b7eb1..4fbfeb6667 100644 --- a/.gitlab-ci.d/buildtest-template.yml +++ b/.gitlab-ci.d/buildtest-template.yml @@ -2,11 +2,21 @@ extends: .base_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG + cache: + paths: + - ccache + key: "$CI_JOB_NAME" + when: always before_script: - JOBS=3D$(expr $(nproc) + 1) script: + - export CCACHE_BASEDIR=3D"$(pwd)" + - export CCACHE_DIR=3D"$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE=3D"500M" + - export PATH=3D"$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build + - ccache --zero-stats - ../configure --enable-werror --disable-docs --enable-fdt=3Dsystem ${TARGETS:+--target-list=3D"$TARGETS"} $CONFIGURE_ARGS || @@ -20,6 +30,7 @@ then make -j"$JOBS" $MAKE_CHECK_ARGS ; fi + - ccache --show-stats =20 # We jump some hoops in common_test_job_template to avoid # rebuilding all the object files we skip in the artifacts diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild= -template.yml index d97611053b..3e5f4d9cd8 100644 --- a/.gitlab-ci.d/crossbuild-template.yml +++ b/.gitlab-ci.d/crossbuild-template.yml @@ -2,10 +2,20 @@ extends: .base_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG + cache: + paths: + - ccache + key: "$CI_JOB_NAME" + when: always timeout: 80m script: + - export CCACHE_BASEDIR=3D"$(pwd)" + - export CCACHE_DIR=3D"$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE=3D"500M" + - export PATH=3D"$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build + - ccache --zero-stats - ../configure --enable-werror --disable-docs --enable-fdt=3Dsystem --disable-user $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS --target-list-exclude=3D"arm-softmmu cris-softmmu @@ -18,6 +28,7 @@ version=3D"$(git describe --match v[0-9]* 2>/dev/null || git rev-par= se --short HEAD)"; mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi + - ccache --show-stats =20 # Job to cross-build specific accelerators. # @@ -29,7 +40,15 @@ stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG timeout: 30m + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" script: + - export CCACHE_BASEDIR=3D"$(pwd)" + - export CCACHE_DIR=3D"$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE=3D"500M" + - export PATH=3D"$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build - ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS @@ -40,7 +59,14 @@ extends: .base_job_template stage: build image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG + cache: + paths: + - ccache/ + key: "$CI_JOB_NAME" script: + - export CCACHE_BASEDIR=3D"$(pwd)" + - export CCACHE_DIR=3D"$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE=3D"500M" - mkdir build - cd build - ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml index cd7622a761..12a987cd71 100644 --- a/.gitlab-ci.d/windows.yml +++ b/.gitlab-ci.d/windows.yml @@ -5,13 +5,14 @@ - windows - windows-1809 cache: - key: "${CI_JOB_NAME}-cache" + key: "$CI_JOB_NAME" paths: - msys64/var/cache + - ccache when: always needs: [] stage: build - timeout: 80m + timeout: 100m variables: # This feature doesn't (currently) work with PowerShell, it stops # the echo'ing of commands being run and doesn't show any timing @@ -72,6 +73,7 @@ bison diffutils flex git grep make sed $MINGW_TARGET-capstone + $MINGW_TARGET-ccache $MINGW_TARGET-curl $MINGW_TARGET-cyrus-sasl $MINGW_TARGET-dtc @@ -101,11 +103,18 @@ - Write-Output "Running build at $(Get-Date -Format u)" - $env:CHERE_INVOKING =3D 'yes' # Preserve the current working directory - $env:MSYS =3D 'winsymlinks:native' # Enable native Windows symlink + - $env:CCACHE_BASEDIR =3D "$env:CI_PROJECT_DIR" + - $env:CCACHE_DIR =3D "$env:CCACHE_BASEDIR/ccache" + - $env:CCACHE_MAXSIZE =3D "500M" + - $env:CCACHE_DEPEND =3D 1 # cache misses are too expensive with preproc= essor mode + - $env:CC =3D "ccache gcc" - mkdir build - cd build + - ..\msys64\usr\bin\bash -lc "ccache --zero-stats" - ..\msys64\usr\bin\bash -lc "../configure --enable-fdt=3Dsystem $CONFIG= URE_ARGS" - ..\msys64\usr\bin\bash -lc "make" - ..\msys64\usr\bin\bash -lc "make check MTESTARGS=3D'$TEST_ARGS' || { c= at meson-logs/testlog.txt; exit 1; } ;" + - ..\msys64\usr\bin\bash -lc "ccache --show-stats" - Write-Output "Finished build at $(Get-Date -Format u)" =20 msys2-64bit: diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker b/tests/d= ocker/dockerfiles/debian-hexagon-cross.docker index 153fc7cfb3..7c38d7c9e4 100644 --- a/tests/docker/dockerfiles/debian-hexagon-cross.docker +++ b/tests/docker/dockerfiles/debian-hexagon-cross.docker @@ -15,6 +15,7 @@ RUN apt-get update && \ # Install common build utilities apt-get install -y --no-install-recommends \ curl \ + ccache \ xz-utils \ ca-certificates \ bison \ @@ -27,7 +28,12 @@ RUN apt-get update && \ python3-wheel && \ # Install QEMU build deps for use in CI DEBIAN_FRONTEND=3Dnoninteractive eatmydata \ - apt build-dep -yy --arch-only qemu + apt build-dep -yy --arch-only qemu && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc =20 RUN /usr/bin/pip3 install tomli =20 @@ -35,6 +41,7 @@ ENV TOOLCHAIN_INSTALL /opt ENV TOOLCHAIN_RELEASE 16.0.0 ENV TOOLCHAIN_BASENAME "clang+llvm-${TOOLCHAIN_RELEASE}-cross-hexagon-unkn= own-linux-musl" ENV TOOLCHAIN_URL https://codelinaro.jfrog.io/artifactory/codelinaro-toolc= hain-for-hexagon/v${TOOLCHAIN_RELEASE}/${TOOLCHAIN_BASENAME}.tar.xz +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" =20 RUN curl -#SL "$TOOLCHAIN_URL" | tar -xJC "$TOOLCHAIN_INSTALL" ENV PATH $PATH:${TOOLCHAIN_INSTALL}/${TOOLCHAIN_BASENAME}/x86_64-linux-gnu= /bin --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407272; cv=none; d=zohomail.com; s=zohoarc; b=UrRbfQtdCCK6yA0O1PtEqmiLYu+v24Nkb2VMeh/V5PuLKv3R52mc0xqX5z0d089OdNIr2WDKc3qPIRnaQLhsXEwCCDwnIDfzOFUKAYmIpcR39plgx/fqUU/GSHggEuXb8wPuJT3+zk7vcXmNw7bGIYEYstFjdjjc8OG5H1ms+Ek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407272; 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:To; bh=8cg7lXi99py9TiXtzqC5JVNbbz3iUJEdseyNMZLjwS8=; b=OhEoC0hmoba8UMfxaZllRbdNHuonW8EIdoj32/V3npC6Zn6jfx/+ShpLkjNaqNx90VBAOZ+rThjNtERgvzDMu1x9PXhop/mHAgd8NUTCe4HxZ0bDxZaoa1kveZOKGwkQHH8/I00l180oEkqDAnhBF6xVCAXYJ5MV98wZSmgWDjE= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407272230483.7714289874722; Wed, 30 Aug 2023 07:54:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaE-00019X-HR; Wed, 30 Aug 2023 10:54:14 -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 1qbMaD-00018p-Am for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:13 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaA-0000jM-Ud for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:13 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-401da71b85eso15324605e9.1 for ; Wed, 30 Aug 2023 07:54:10 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id n8-20020a1c7208000000b003fefaf299b6sm2514008wmc.38.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:08 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D23081FFBD; Wed, 30 Aug 2023 15:54:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407249; x=1694012049; 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=8cg7lXi99py9TiXtzqC5JVNbbz3iUJEdseyNMZLjwS8=; b=jH1sPRJBNvm62X8el2msjoKnfgLwRH130boP4EAALgG8cc9cliNlKBjHaaleqS8FrT D6c/nItcm4nLTLEek3vsuTG8gESIiTFuT5UqTyDniEmmPv78OJA47rg3af8Jh5Jqa8+t +5yI88k2iTJDcUjS5zvTh4mmzPoLwNzY08XfnQ9+18224il4cnvl/GOL5JpJuFcYJvKH PefLkwajFdhtAOw9pqERIYGHU0mLPOBxbPzpJh7/dTBDODBEHd6b0M54q/cGiGDw6Z4d Fue7faVEDeD3evv4wU4oyqdrbmFO5pBm7hqG2KC+Y+qj667WdBIOOyGeYa/XQgIJNA2o Y3IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407249; x=1694012049; 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=8cg7lXi99py9TiXtzqC5JVNbbz3iUJEdseyNMZLjwS8=; b=d6mp69TyBmxFXkqT47w/mC0AusQI9x3erLbPkmBcjW5LicH4CTxktN/D8raoMu1GHL nfUKbqmavXZ8NQ0163TiXrLQZ5zmuFqdrJKrrFNWn9WjaojnXvxNMlL6Egj0m7hXeYJU w6Y933poXkrWnksb8FeL6vR8ASYff5OwDOSb/AdmQ7Dv+PE4sy8YTRigtj2U9F5VlQve 4QwW99aSimQQJZmkmelzjuigcQEjfaeMayLAFI9+3qInEVE+791otS7VJxugHZzVbVdW xPdCq8PasfPvtxaUV4ZM05G6uImEhIu/qYvOs3dQSZl1KfBtuY+kkdkaZqaOP9VOlgp4 i3gQ== X-Gm-Message-State: AOJu0YwoH2p4mKTLHU9LN68+Qbujpu5NmaV0Bd4bMJED85WldqbkB6DK k8hcy1SoHDYbLj4yDobHo9tpwg== X-Google-Smtp-Source: AGHT+IH/9EU/f3219IHvXZr74GlKohrBK8NMP+kvq+Mn4BAiFVzRnCwj8E9N6dGP07vxNZF8czJaIQ== X-Received: by 2002:a05:600c:3b10:b0:401:daf2:273b with SMTP id m16-20020a05600c3b1000b00401daf2273bmr2329760wms.12.1693407248751; Wed, 30 Aug 2023 07:54:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PULL 02/12] tests/docker: cleanup non-verbose output Date: Wed, 30 Aug 2023 15:53:57 +0100 Message-Id: <20230830145407.3064249-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407273798100003 Even with --quiet docker will spam the sha256 to the console. Avoid this by redirecting stdout. While we are at it fix the name we echo which was broken during 0b1a649047 (tests/docker: use direct RUNC call to build containers). Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-3-alex.bennee@linaro.org> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 142e8605ee..dfabafab92 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -46,9 +46,9 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker --build-arg BUILDKIT_INLINE_CACHE=3D1 \ $(if $(NOUSER),, \ --build-arg USER=3D$(USER) \ - --build-arg UID=3D$(UID)) \ - -t qemu/$* - < $<, \ - "BUILD", $1) + --build-arg UID=3D$(UID)) \ + -t qemu/$* - < $< $(if $V,,> /dev/null),\ + "BUILD", $*) =20 # Special rule for debootstraped binfmt linux-user images docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407298; cv=none; d=zohomail.com; s=zohoarc; b=iYAZtSJffxL05jMTSsj/jwBf8tOlyUWhn6+MbrmAny032SwYAimqyv+FTYF2wQqExSo4Cvnm+u4coSO8z6xafIuNcbyZp8uUSGBPZpSDIfWSX5aIQnChBDK5COI1OthdjkJYulCAcJJBMRapH5D7SI7IEYknwdcDDkWN33v7o60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407298; 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:To; bh=P7ocu0L6Gz7VaIaqOkaO8eCcLjZTZ6F0+6GPe6A31H0=; b=dE+xqhxHyxjTq7v1RqjdEKSHTxWC374506vQluCdg/gNbb6jIyBdTVMSJu7tvGSXZfU//3A0bIQk+lyC2d64UEDci4UmaWmsYYZGUjROrhfeGRqE322Mj30HwUmiplmKxKOI0xTK2Rf4v52fDzmzo/5XXBx/8J01Zpdc0LVKqhI= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407298094488.8933649713895; Wed, 30 Aug 2023 07:54:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaG-0001AL-3g; Wed, 30 Aug 2023 10:54:16 -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 1qbMaF-00019i-6N for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:15 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaB-0000jZ-9R for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:14 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-31dd10c2b8bso2255747f8f.3 for ; Wed, 30 Aug 2023 07:54:10 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id g26-20020a7bc4da000000b003fee8502999sm2503436wmk.18.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:08 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EA9CC1FFBE; Wed, 30 Aug 2023 15:54:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407249; x=1694012049; 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=P7ocu0L6Gz7VaIaqOkaO8eCcLjZTZ6F0+6GPe6A31H0=; b=KJ6MUdJoa2eP2Wnrycw3mU+326ngTNZoxro/jQrvgdXJefVcPh479IbR61D9co7eRL 9urY4Xww571f7s2FGEmjwn29xNm1kPmxtaw0FbvpswAoY6uAaWHln1zICeShf9RKBgFm /ZtzuGZLQRsrYdCnFbkhIHgtn5FnrTg73bBjC3viMyOd9BoKnIGdht7fy11UNEPnDwUN wR7d5+9Juk30OfoQe9EOJ72JJsRTO57WJ/C7QKZgsi+JLsq/g8UZ8Gq5jKuGnbgdUnQ9 0XZPhVSZWYGF+OQe59dY5gkjtE2M4dNEdRaviVjLopqCQkkLIYKCaHVaOx+Vc/+dBzJm MgRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407249; x=1694012049; 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=P7ocu0L6Gz7VaIaqOkaO8eCcLjZTZ6F0+6GPe6A31H0=; b=W/Aw8TiYTikr10hWRhLbpaZ2zNCXtA/uXb5ysAnzfblR1Wqf5pqU9CkvdQ/ZGKsF0y +0u/7e+Qpi5DfxBra6B3oOXBHDsWZQfTCqc9hw1wifQktf/ynalFDUgRFME1j7GBzq5m rzfbX8y1pd1rsd3jR9IVQoBGSDEceF7MBweHOn8KHOZdqzY6Ei1OSQX0I/Ja98WHgxm6 mouDMKuMp8x123ccXqWAH6a3Nn98CQ/m7hogQSbuoG85251mNQC7oJBDBUEG/i+RhoFq 48dszxwcloUTw0sYB2/4SgMolAY2xSVMM3WHL7RuH8BKxP/L3YqrhoMREisARs6vFyZ6 8gpQ== X-Gm-Message-State: AOJu0YxHLb6RK8immqtleqBH1xfemBG6LuqswnguofP96+o1LGuJttfd q36l+Y2G/0zThBI6G20Umq76Lw== X-Google-Smtp-Source: AGHT+IHsuF+eBolsm6ALx4+CpiRDr+0TcgVaQl6EsyW0fAzzihtKqRMfTxJfdXXQHHp+UEMX8ckCbA== X-Received: by 2002:a5d:595f:0:b0:317:5b32:b2c3 with SMTP id e31-20020a5d595f000000b003175b32b2c3mr1949401wri.6.1693407249796; Wed, 30 Aug 2023 07:54:09 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Peter Maydell , qemu-arm@nongnu.org (open list:ARM TCG CPUs) Subject: [PULL 03/12] tests/tcg: remove quoting for info output Date: Wed, 30 Aug 2023 15:53:58 +0100 Message-Id: <20230830145407.3064249-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1693407300452100001 This avoids ugly multi-line wrapping for the test on non V=3D1 builds. Acked-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-4-alex.bennee@linaro.org> diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 681dfa077c..b77bbd9b3c 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -14,7 +14,7 @@ AARCH64_TESTS=3Dfcvt pcalign-a64 lse2-fault fcvt: LDFLAGS+=3D-lm =20 run-fcvt: fcvt - $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") + $(call run-test,$<,$(QEMU) $<) $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) =20 config-cc.mak: Makefile diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg= /multiarch/system/Makefile.softmmu-target index 7ba9053375..a051d689d7 100644 --- a/tests/tcg/multiarch/system/Makefile.softmmu-target +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target @@ -37,10 +37,10 @@ run-gdbstub-untimely-packet: hello --qemu $(QEMU) \ --bin $< --qargs \ "-monitor none -display none -chardev file$(COMMA)path=3Duntimely-packet= .out$(COMMA)id=3Doutput $(QEMU_OPTS)", \ - "softmmu gdbstub untimely packets") + softmmu gdbstub untimely packets) $(call quiet-command, \ (! grep -Fq 'Packet instead of Ack, ignoring it' untimely-packet.gdb.err= ), \ - "GREP", "file untimely-packet.gdb.err") + "GREP", file untimely-packet.gdb.err) else run-gdbstub-%: $(call skip-test, "gdbstub test $*", "no guest arch support") --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407299; cv=none; d=zohomail.com; s=zohoarc; b=nLdNSIoDgqMslDOS183blL//f+zqitUbAmOmRoxD7WRn9p/hRb+N0eIRbUh+7qyWPIOyw6lFeN0T3DryqlKOfd6sP9w1KG4lchVLIl0yB6nTs+yN9oqs7AWX5EBVbywOvAp59Z+N8ezuQ/36MVhfx3SZieGXmHIowrYIQCHUG20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407299; 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:To; bh=uH3otyEIeLq3dLGPNCMZELh485heJIDu3uWi+lqceck=; b=c7KaxBiTD47ILr9gylndI59w653SZc7DErIkS199bkDbYfsR/B1Br51UK9fPPW9jUt72BIPGWFoxLKXbRkwqn0tSkGQENzwsP8ckBym5c7jREQm6oE3sI4q9pecdobkBQlOoAG0FboqW1P3KeKnIIKSxG/tU46Nf0lAx5OIfEmY= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407299110942.1625084645748; Wed, 30 Aug 2023 07:54:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaG-0001AY-NV; Wed, 30 Aug 2023 10:54:16 -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 1qbMaF-00019t-HS for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:15 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaB-0000ji-M9 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:15 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-401b3ea0656so51730515e9.0 for ; Wed, 30 Aug 2023 07:54:11 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id b4-20020adff244000000b0031423a8f4f7sm16871369wrp.56.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0E6D31FFBF; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407250; x=1694012050; 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=uH3otyEIeLq3dLGPNCMZELh485heJIDu3uWi+lqceck=; b=XZIceiIliKeKjndId2v9ttLbfJlYZOmm9rGJTGUlVYHgpDvalnBTk1PN+Y1Y+0ayov JZAtYTAXadOpFB0Z4Lh7gXA5oNtcDOcWzh5zR1MmgTxXzNoyGq7m/rukCechDJIGtZwa QWGCH1QZ3Diva4PRJuE6ghHOTiAGsUYLCIsBTJQVGcwa8OgO2UB8S6ONzqG0tjPX8dsV jm+mNPCEjupQuCg9n/G9ZQ1zjMLoXYtVEfk60ov/8VddAU2oaIlmhcoYMFP3/CpgaPR9 +6vsSJTmjVJVcute7KPsZ3Ns3H415sICn7qIxtuIGwBMDcQAb8ajSR74eZ/8LIU6bPjP lzeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407250; x=1694012050; 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=uH3otyEIeLq3dLGPNCMZELh485heJIDu3uWi+lqceck=; b=jefdpDMLt7zRnCvdGeAeWPM8E3oobl2hUiFwORm0w0sqDmawRqX8K4Vh+MI5EDq3dZ A8Uj1pkgrOyyEBRFIV9LHhnOU7d99/JwC6uTOMvtQdIuyGfoqyAl6ijQJUAXk6AM0hjW WpMlfD6BdNzMf43GI0pED5JX/L/qiuT5TC1gdEHo6qkOKofUZrCxrvl15g+l9M+z2Aln QIxsxGN8bS3BpVsgjhZev0kMtWTn6PYtajxeybTpbABnOIubeNJu4VndDxAQzDlGpFpy T5ohz3Kk+CvwhZzJ8Je4W5R6Y0dVFBvzCIydW6jszNrKNZAt7rRCaXT09uTDsym3hzzC QpCA== X-Gm-Message-State: AOJu0YzlvaqPYMnn/KgMrgNf2BeblnuBARZ21+uB/4nCzBu1ZsPxcyZQ 88BaUPsjQypoYq7DBF+cIJ17Fg== X-Google-Smtp-Source: AGHT+IHvF+2t6OFOepDX9rpS7oQ2MF91c+8dK7+lsR86r8JRVqLH6dOifjec6w/hh7YxjTvd3f5abQ== X-Received: by 2002:adf:cd0b:0:b0:317:f18b:a950 with SMTP id w11-20020adfcd0b000000b00317f18ba950mr1751701wrm.26.1693407250072; Wed, 30 Aug 2023 07:54:10 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Markus Armbruster , Thomas Huth , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Juan Quintela Subject: [PULL 04/12] docs/style: permit inline loop variables Date: Wed, 30 Aug 2023 15:53:59 +0100 Message-Id: <20230830145407.3064249-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407300557100007 I've already wasted enough of my time debugging aliased variables in deeply nested loops. While not scattering variable declarations around is a good aim I think we can make an exception for stuff used inside a loop. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi Acked-by: Markus Armbruster Reviewed-by: Thomas Huth Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-5-alex.bennee@linaro.org> diff --git a/docs/devel/style.rst b/docs/devel/style.rst index 3cfcdeb9cd..2f68b50079 100644 --- a/docs/devel/style.rst +++ b/docs/devel/style.rst @@ -204,7 +204,14 @@ Declarations =20 Mixed declarations (interleaving statements and declarations within blocks) are generally not allowed; declarations should be at the beginning -of blocks. +of blocks. To avoid accidental re-use it is permissible to declare +loop variables inside for loops: + +.. code-block:: c + + for (int i =3D 0; i < ARRAY_SIZE(thing); i++) { + /* do something loopy */ + } =20 Every now and then, an exception is made for declarations inside a #ifdef or #ifndef block: if the code looks nicer, such declarations can --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407386; cv=none; d=zohomail.com; s=zohoarc; b=fN8FgTqyymnM9WLDBxUbB4BTRkEX/dLT/3RNE4xSkSP9Fa+Vp0hKJVYAb2iRoxxPTFAOSjsj7Zp4XEXGexNrS0biRAaiEZSL/Sp6azhHTBVu2qyk3zL5zfTL7sNZEII501i7P7kgJG+QoA4gKYuD7k13jnvrVL+2AxhaMk4DU1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407386; 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:To; bh=7CAQcCHxhhzOkaK3t8ZyiVpaGWR3QfKLpmoXkKlWorI=; b=jIu9ybPswcG4jt3v4x8FFZx5SCEn7jvRHWNv9vXQ11CzH2jIxBC1kDbuxRD8NmQeBpnXnzNVXx2oxUnuLXDRkL6tBoPTyTGHEO8T4PO9aK7+uclHNV/tEUIhcBk5j3BWrG57lngtpwIKor9Khf0EdtYvhKj4Svoe9IZKWAbEouM= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407386171441.07671488402787; Wed, 30 Aug 2023 07:56:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaI-0001C2-IZ; Wed, 30 Aug 2023 10:54:18 -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 1qbMaF-0001AC-Qg for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:15 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaC-0000jr-83 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:15 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31c3df710bdso4532304f8f.1 for ; Wed, 30 Aug 2023 07:54:11 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id j4-20020a5d6184000000b0030ae53550f5sm16998302wru.51.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 242601FFC0; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407251; x=1694012051; 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=7CAQcCHxhhzOkaK3t8ZyiVpaGWR3QfKLpmoXkKlWorI=; b=B5Ym9j3w+9mechIcDJ9NXZ0jO5Rwqv91eeXmwXk9SgFdUqtoz0zyNb/J7NwoSfNRqY VbYvhNGh0fuJbZVr902J/UtCzHdOPI8NuJalNbBDyaW/6wZhhMEyy5GztSGbkz8fn9tK xN0DJ8ARBHW7Aio39iEQnMYmEF/AoVwNi01LxbhOYgBjBpbBIiM0qFVSjAM17UD7wlOw EwsKS1OKd2coW5rvF74YS/8QkyloO6TQlNclB1Hjlp3ak5MkoC3Kh7doPeNv1kbcuP0k lp63fe9iL5LbQqx8wGwcaQF6UjYM87QY8H5X4DUuEDRIMDNPpIn3i5GbLR7gAwAu2S6i jhHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407251; x=1694012051; 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=7CAQcCHxhhzOkaK3t8ZyiVpaGWR3QfKLpmoXkKlWorI=; b=GpG4oKbY5E4MPRBO1vJ95BUge13QyA2zEu6rkwJjkXQ7FiJt2fd0tKVJr7/6n5175h vcf0yHwzBt+YTcKulBAl82IQhhhWSUQvQpkrphbtbPdqM5vAssskwJ+0TZZRo9P/D1vZ UFeWMxv/8MzP+sP1T4MbJYNqO/Py8uIPKMExCmVenZjTygGNVQLuh/s9dZYux8Nc+EOA 2zcEaITkAlPmrSrbdbyGnp/R8P8wSFw8zhq2WLi3IH+3Xts6U+TxiCWRGXbJGyGY+xkN +MmE6B4S4i8W3EhgcsXkWGqXDnPCcB7fi13sHh4WMe9e72fb+VwzNyoT1YhmLrA6h92j JS6w== X-Gm-Message-State: AOJu0Yxg2zOoN/YiXMEPz7dJl4jA2TqxSuTAzxENlcpBWeGSvQ5rd/Xf GDRr9v2LbtSJ5qmBZchIRgiJhw== X-Google-Smtp-Source: AGHT+IFCiEyGALB38hp5uucJyGR4YcyqFH603p7Wp8Mq6i+4QG+GS/YgeWbhEdBhrpGJvQLsRAs7zg== X-Received: by 2002:a5d:568f:0:b0:31a:d3fd:221b with SMTP id f15-20020a5d568f000000b0031ad3fd221bmr1784043wrv.20.1693407250857; Wed, 30 Aug 2023 07:54:10 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PULL 05/12] .gitlab-ci.d/cirrus.yml: Update FreeBSD to v13.2 Date: Wed, 30 Aug 2023 15:54:00 +0100 Message-Id: <20230830145407.3064249-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407386964100009 From: Thomas Huth The FreeBSD CI job started to fail due to linking problems ... time to update to the latest version to get this fixed. Signed-off-by: Thomas Huth Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230823144533.230477-1-thuth@redhat.com> Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-6-alex.bennee@linaro.org> diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml index 1507c928e5..41d64d6680 100644 --- a/.gitlab-ci.d/cirrus.yml +++ b/.gitlab-ci.d/cirrus.yml @@ -50,7 +50,7 @@ x64-freebsd-13-build: NAME: freebsd-13 CIRRUS_VM_INSTANCE_TYPE: freebsd_instance CIRRUS_VM_IMAGE_SELECTOR: image_family - CIRRUS_VM_IMAGE_NAME: freebsd-13-1 + CIRRUS_VM_IMAGE_NAME: freebsd-13-2 CIRRUS_VM_CPUS: 8 CIRRUS_VM_RAM: 8G UPDATE_COMMAND: pkg update; pkg upgrade -y --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407314; cv=none; d=zohomail.com; s=zohoarc; b=W1CWlqGsNgkqu1Tb2q0ZUo1TjPpPlLpBkS9YbmDDkQOWKbDNg5z67oi5g1SOTgPnupTIe3xORfqCP8ODA93SBWBN/bOojQ2+ynKp0VwNux6l39/6D8RUvH5krvIWYxvM1KkUzX97ZbhuJH2inhU1J9vv2eITGb1MWHDPR0iXU/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407314; 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:To; bh=RUJU7I/ZCoEcB3CxWQsoadwO8esnJuOP81/I/ouJ2ZE=; b=TbffgYqLhfeNzojO2wQ+MBkt0UUUV5Ykp8bd3nzZ2B8Yg7PqE4gA2ZSUUu2uyVILZZ7+VOQvaazjO59MpYaFp2MR9zUVudUd3P7/HTKXN51MhGT27QoQxPmznY2iARl8wKIUS1LlS6b9lCDFb6vHcSC1+lX4z9UCxlMtLhkFP6s= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407314672214.46865394664314; Wed, 30 Aug 2023 07:55:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaJ-0001CM-Au; Wed, 30 Aug 2023 10:54:19 -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 1qbMaG-0001AM-63 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:16 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaC-0000jw-HZ for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:15 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fef56f7223so51457115e9.3 for ; Wed, 30 Aug 2023 07:54:12 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f10-20020a5d664a000000b0031c79de4d8bsm16858223wrw.106.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3A4EC1FFC1; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407251; x=1694012051; 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=RUJU7I/ZCoEcB3CxWQsoadwO8esnJuOP81/I/ouJ2ZE=; b=Ak/g7ZxG26UCmJViIpR7uKdc3arGt36xDIKI1JiK0hgyAh8UVFvDPPYP5I2gjRSARw LfuDLJGfpr1eFrTGGNI8jtzU4gAMkEPudMFwO3K1R6j7d1Ny2mQ5GqsSLNc2za+OFV2Z OvW/7lmVG9ReyJPM9MpdhRZwYo1xncRmlK/V4RrVNP77tSP6BzWjb1Ll9xLusyA1q/cG Iw6syV6YsphKaAWjDlZmW8GlbgfvT6MhwOxxauvC2KOucBsshWvVD0aLDQ06xw8/+t8I h7oFAbhS82DznzOu1nygcu7bAQP0tpX8M2OJpzxXsKrPGson5tT4JM2Drh3whWwFpWgm dTqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407251; x=1694012051; 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=RUJU7I/ZCoEcB3CxWQsoadwO8esnJuOP81/I/ouJ2ZE=; b=PlwlYdL7JbtNbJWh59KVHJ8EhkjcQFeiLRnlv2n1g0ZVaoZRlRIQJP6oMcPFG/sGya LOrwHhCr4aIeDMJaj1C8SzhWk1stNqSh5brJujbfQ6/hO9Q7cLaOzioF5+0qzIP4eGSy 2X3pKoLWDHBQsdz28xXxUOAweAw9I+rCvZuHxmqLdJn9OsK9/3LP0EE1JG57NUDWkvOp yfT2F72VsQFdnJ8jTf0nYqjCIdJHLmabS1D+y+Vo8LMlvRhBlV7Cs3raTHymplrI4o1U NkWcZSrRybB99OPPki7JsiGZLAWXowO+WkZRFVcsLzQDk9CJ59/DMqlTUFpk8hc39mWW 3ufQ== X-Gm-Message-State: AOJu0YzvW6/qaFKKUZCcs8aflv/P+lSArHOvIWw9xljZIN9qTOHLYIXe dOg7K0DTqdof8CHcV9v2Nibf+t5fGYGhirydLnw= X-Google-Smtp-Source: AGHT+IFW1U2I5sw7ZNMpgf/z2mztkftJ0i0luA4ENeaOkKwkLoO4pcEf9UJ815ZX25/LhB1atYg40A== X-Received: by 2002:a7b:c389:0:b0:401:b705:ebea with SMTP id s9-20020a7bc389000000b00401b705ebeamr2301291wmj.12.1693407251067; Wed, 30 Aug 2023 07:54:11 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PULL 06/12] tests: remove test-gdbstub.py Date: Wed, 30 Aug 2023 15:54:01 +0100 Message-Id: <20230830145407.3064249-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407315006100001 This isn't directly called by our CI and because it doesn't run via our run-test.py script does things slightly differently. Lets remove it as we have plenty of working in-tree tests now for various aspects of gdbstub. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-7-alex.bennee@linaro.org> diff --git a/tests/guest-debug/test-gdbstub.py b/tests/guest-debug/test-gdb= stub.py deleted file mode 100644 index 98a5df4d42..0000000000 --- a/tests/guest-debug/test-gdbstub.py +++ /dev/null @@ -1,177 +0,0 @@ -# -# This script needs to be run on startup -# qemu -kernel ${KERNEL} -s -S -# and then: -# gdb ${KERNEL}.vmlinux -x ${QEMU_SRC}/tests/guest-debug/test-gdbstub.py - -import gdb - -failcount =3D 0 - - -def report(cond, msg): - "Report success/fail of test" - if cond: - print ("PASS: %s" % (msg)) - else: - print ("FAIL: %s" % (msg)) - global failcount - failcount +=3D 1 - - -def check_step(): - "Step an instruction, check it moved." - start_pc =3D gdb.parse_and_eval('$pc') - gdb.execute("si") - end_pc =3D gdb.parse_and_eval('$pc') - - return not (start_pc =3D=3D end_pc) - - -def check_break(sym_name): - "Setup breakpoint, continue and check we stopped." - sym, ok =3D gdb.lookup_symbol(sym_name) - bp =3D gdb.Breakpoint(sym_name) - - gdb.execute("c") - - # hopefully we came back - end_pc =3D gdb.parse_and_eval('$pc') - print ("%s =3D=3D %s %d" % (end_pc, sym.value(), bp.hit_count)) - bp.delete() - - # can we test we hit bp? - return end_pc =3D=3D sym.value() - - -# We need to do hbreak manually as the python interface doesn't export it -def check_hbreak(sym_name): - "Setup hardware breakpoint, continue and check we stopped." - sym, ok =3D gdb.lookup_symbol(sym_name) - gdb.execute("hbreak %s" % (sym_name)) - gdb.execute("c") - - # hopefully we came back - end_pc =3D gdb.parse_and_eval('$pc') - print ("%s =3D=3D %s" % (end_pc, sym.value())) - - if end_pc =3D=3D sym.value(): - gdb.execute("d 1") - return True - else: - return False - - -class WatchPoint(gdb.Breakpoint): - - def get_wpstr(self, sym_name): - "Setup sym and wp_str for given symbol." - self.sym, ok =3D gdb.lookup_symbol(sym_name) - wp_addr =3D gdb.parse_and_eval(sym_name).address - self.wp_str =3D '*(%(type)s)(&%(address)s)' % dict( - type =3D wp_addr.type, address =3D sym_name) - - return(self.wp_str) - - def __init__(self, sym_name, type): - wp_str =3D self.get_wpstr(sym_name) - super(WatchPoint, self).__init__(wp_str, gdb.BP_WATCHPOINT, type) - - def stop(self): - end_pc =3D gdb.parse_and_eval('$pc') - print ("HIT WP @ %s" % (end_pc)) - return True - - -def do_one_watch(sym, wtype, text): - - wp =3D WatchPoint(sym, wtype) - gdb.execute("c") - report_str =3D "%s for %s (%s)" % (text, sym, wp.sym.value()) - - if wp.hit_count > 0: - report(True, report_str) - wp.delete() - else: - report(False, report_str) - - -def check_watches(sym_name): - "Watch a symbol for any access." - - # Should hit for any read - do_one_watch(sym_name, gdb.WP_ACCESS, "awatch") - - # Again should hit for reads - do_one_watch(sym_name, gdb.WP_READ, "rwatch") - - # Finally when it is written - do_one_watch(sym_name, gdb.WP_WRITE, "watch") - - -class CatchBreakpoint(gdb.Breakpoint): - def __init__(self, sym_name): - super(CatchBreakpoint, self).__init__(sym_name) - self.sym, ok =3D gdb.lookup_symbol(sym_name) - - def stop(self): - end_pc =3D gdb.parse_and_eval('$pc') - print ("CB: %s =3D=3D %s" % (end_pc, self.sym.value())) - if end_pc =3D=3D self.sym.value(): - report(False, "Hit final catchpoint") - - -def run_test(): - "Run through the tests one by one" - - print ("Checking we can step the first few instructions") - step_ok =3D 0 - for i in range(3): - if check_step(): - step_ok +=3D 1 - - report(step_ok =3D=3D 3, "single step in boot code") - - print ("Checking HW breakpoint works") - break_ok =3D check_hbreak("kernel_init") - report(break_ok, "hbreak @ kernel_init") - - # Can't set this up until we are in the kernel proper - # if we make it to run_init_process we've over-run and - # one of the tests failed - print ("Setup catch-all for run_init_process") - cbp =3D CatchBreakpoint("run_init_process") - cpb2 =3D CatchBreakpoint("try_to_run_init_process") - - print ("Checking Normal breakpoint works") - break_ok =3D check_break("wait_for_completion") - report(break_ok, "break @ wait_for_completion") - - print ("Checking watchpoint works") - check_watches("system_state") - -# -# This runs as the script it sourced (via -x) -# - -try: - print ("Connecting to remote") - gdb.execute("target remote localhost:1234") - - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - - # Run the actual tests - run_test() - -except: - print ("GDB Exception: %s" % (sys.exc_info()[0])) - failcount +=3D 1 - import code - code.InteractiveConsole(locals=3Dglobals()).interact() - raise - -# Finally kill the inferior and exit gdb with a count of failures -gdb.execute("kill") -exit(failcount) --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407365; cv=none; d=zohomail.com; s=zohoarc; b=kV5Wqv6OOoJqdcQ5kEF7lCk6ayiC/ClXBNUWQTuedCgcjlPKflimorKKOFaLeGJqYQgedXNGpZPH4IRly1MkAfgP0UtNaIWDO+WqigPP2/JBQTPYyIOL2ByF3tEvj2Sw/mb8mUJFGaw3VZ7XPFK1kY6S1MenUArvzW9IuO6/Nb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407365; 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:To; bh=G9E1DuNxaXu2Lv6KCbenlgvIsuAZILViDISYbqMbTqM=; b=TdgfzUWHHwHtLKBUx2tvIXaiaOBBoQtxDonEJT/hLR9ZtPWvMBmUP/SMOHIoi5/9jipLIK6jzY4vPOtkfgyG8lPW8UIu6x9qXn6IRIHqOX3VchHiLs+HHpcmaxQFrjQL44OpkaDg61x539iYR8BORDYgYcbeFjqb9DxE3xF13eE= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407365865305.85546736635115; Wed, 30 Aug 2023 07:56:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaL-0001E3-1L; Wed, 30 Aug 2023 10:54:21 -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 1qbMaI-0001C1-Fa for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:18 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaE-0000kG-6M for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:18 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4018af1038cso53920025e9.0 for ; Wed, 30 Aug 2023 07:54:13 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id z8-20020adff1c8000000b0031c612146f1sm16659748wro.100.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 66A6B1FFC2; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407252; x=1694012052; 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=G9E1DuNxaXu2Lv6KCbenlgvIsuAZILViDISYbqMbTqM=; b=cwCwzgMH564NbywI15AulOwIDAmVpLPbI1DYxz+H8sS6assEuxTnlvCFV5i/EXaTuK YpLajyIHk0hNX/zHl4ISQ3U1t1T/UnKxwRk0IFm+BdewRn3NcCjTMTKP3N0l5OVm45xm iD+fCLoiU47lsXgoZ7Vb3+VzZa8lglVEYUOHAhydMtey1eJki+W2pJq06znzqcA3N+Qn jK/0D3QwMpFzCuopZp6r2qwcTqoB/ejpkv6GRlUqx37y0KZu3N0cTBMId4CSWxK9ZfqN YgSHwC/QMGyWONIe3eSrwlwPO/t17Kip9FgNABZlKSMTHyC68d6UrSANr+pxywc9gq0C oHKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407253; x=1694012053; 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=G9E1DuNxaXu2Lv6KCbenlgvIsuAZILViDISYbqMbTqM=; b=jjP4GrKE3ZMkeIhbLFzM/SisH0D7H7p6WUhVQxOr5dx+mvthH5o7mTzMGkiFLz8ouv k9PBKKrcLIpVg+8kC8aZSSOjQ8FWSG1wnM2WfiJE5tKrS6ClykTnDqQcNvIGPlEHsLeX eE7yNcRKOluN92n8qJwZiE3vPOu3T6i2QYFd84ALKC8NrILYMUeU0vuRu5sWVlC0L4m+ QSXw+SC6hJSdoj5ok4ifLg0HIkSZeYfA+tNgdeU9J1yq1mApSTlO10MSBPbJRvAZmy9S TZiTm5aAYWP85G1MJZqbksWp7ghddccLs9L5vAzcr4m4yT4TSgNHdDw0OcL7h3qnujgT i0yg== X-Gm-Message-State: AOJu0YxFVh59sXmxeAeT7AxU63AbSkUpg5TnMbCuPaMrdYdtrLOG/UyN l1+0nxIDcnZ9Yi62fUGs0qIRpcd9u06O++70F+Y= X-Google-Smtp-Source: AGHT+IGj28dKbU45weMe/CV+fEkZEWzXBS7XU5KOLNPsPtZS2E2jT5nvWQhlbewKHBBdlWxaD6e8Tg== X-Received: by 2002:a5d:5450:0:b0:319:650f:60e2 with SMTP id w16-20020a5d5450000000b00319650f60e2mr1859962wrv.11.1693407252747; Wed, 30 Aug 2023 07:54:12 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ilya Leoshkevich , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell , David Hildenbrand , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-s390x@nongnu.org (open list:S390 TCG CPUs) Subject: [PULL 07/12] tests/tcg: clean-up gdb confirm/pagination settings Date: Wed, 30 Aug 2023 15:54:02 +0100 Message-Id: <20230830145407.3064249-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407366348100001 We can do this all in the run-test.py script so remove the extraneous bits from the individual tests which got copied from the original non-CI gdb tests. Acked-by: Ilya Leoshkevich Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-8-alex.bennee@linaro.org> diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index a032e01f79..b13b27d4b1 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -83,6 +83,8 @@ def log(output, msg): gdb_cmd +=3D " %s" % (args.gdb_args) # run quietly and ignore .gdbinit gdb_cmd +=3D " -q -n -batch" + # disable pagination + gdb_cmd +=3D " -ex 'set pagination off'" # disable prompts in case of crash gdb_cmd +=3D " -ex 'set confirm off'" # connect to remote diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch6= 4/gdbstub/test-sve-ioctl.py index b9ef169c1a..ee8d467e59 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py @@ -76,9 +76,6 @@ def run_test(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - # Run the actual tests run_test() except: diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py b/tests/tcg/aarch64/gdbs= tub/test-sve.py index ef57c7412c..afd8ece98d 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve.py +++ b/tests/tcg/aarch64/gdbstub/test-sve.py @@ -66,9 +66,6 @@ def run_test(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - # Run the actual tests run_test() except: diff --git a/tests/tcg/multiarch/gdbstub/memory.py b/tests/tcg/multiarch/gd= bstub/memory.py index 67864ad902..dd25e72281 100644 --- a/tests/tcg/multiarch/gdbstub/memory.py +++ b/tests/tcg/multiarch/gdbstub/memory.py @@ -115,9 +115,6 @@ def run_test(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - # Run the actual tests run_test() except (gdb.error): diff --git a/tests/tcg/multiarch/gdbstub/sha1.py b/tests/tcg/multiarch/gdbs= tub/sha1.py index 423b720e6d..416728415f 100644 --- a/tests/tcg/multiarch/gdbstub/sha1.py +++ b/tests/tcg/multiarch/gdbstub/sha1.py @@ -73,10 +73,6 @@ def run_test(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error): diff --git a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py b/tests/tcg/= multiarch/gdbstub/test-proc-mappings.py index 5e3e5a2fb7..04ec61d219 100644 --- a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py +++ b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py @@ -51,10 +51,6 @@ def main(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except gdb.error: diff --git a/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py b/tests/tc= g/multiarch/gdbstub/test-qxfer-auxv-read.py index d91e8fdf19..926fa962b7 100644 --- a/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py +++ b/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py @@ -42,10 +42,6 @@ def run_test(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error): diff --git a/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py b/tests/= tcg/multiarch/gdbstub/test-thread-breakpoint.py index 798d508bc7..e57d2a8db8 100644 --- a/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py +++ b/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py @@ -45,10 +45,6 @@ def run_test(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error): diff --git a/tests/tcg/s390x/gdbstub/test-signals-s390x.py b/tests/tcg/s390= x/gdbstub/test-signals-s390x.py index 80a284b475..ca2bbc0b03 100644 --- a/tests/tcg/s390x/gdbstub/test-signals-s390x.py +++ b/tests/tcg/s390x/gdbstub/test-signals-s390x.py @@ -61,10 +61,6 @@ def run_test(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except (gdb.error): diff --git a/tests/tcg/s390x/gdbstub/test-svc.py b/tests/tcg/s390x/gdbstub/= test-svc.py index 18fad3f163..804705fede 100644 --- a/tests/tcg/s390x/gdbstub/test-svc.py +++ b/tests/tcg/s390x/gdbstub/test-svc.py @@ -49,10 +49,6 @@ def main(): exit(0) =20 try: - # These are not very useful in scripts - gdb.execute("set pagination off") - gdb.execute("set confirm off") - # Run the actual tests run_test() except gdb.error: --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407328; cv=none; d=zohomail.com; s=zohoarc; b=Xu0FhiOqvZMWSYDXWbWo2u18YM8+fBExvogkkATRmhjc/wSXcDOhZR+FHy9HFt4P+RfsFOfFwlynx+LuQbjVSaXr7GVI1tukB2tbHricgDB//gpcsRefywodFYhQCpHjQGQyVfBtMs0Eo032w+xV/0+o4+Js8b9y2AZe6N5KBsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407328; 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:To; bh=/xMHxg0y53JN4TLoRHDzXOhPXJYR1t6X3GOG4+zpqXU=; b=H+7hWN0mWhZ+P/1JOsDHeGDq5HEBpI0MXvctyefKv4n9DbeEJDNUDn3dtt54L22R5vGS4/aiNU/3l98047fbCDyL6We1ukqdK+R2ZunLBLgBeeM2XAadoToJDwAXcMkSjm+WOsmNatiohFgU9nuT6nzsFh7jXoE6calAw9W1AX4= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169340732811144.912234052742406; Wed, 30 Aug 2023 07:55:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaJ-0001CO-GG; Wed, 30 Aug 2023 10:54:19 -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 1qbMaI-0001Bd-5e for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:18 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaD-0000k9-QF for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:17 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-31c3df710bdso4532326f8f.1 for ; Wed, 30 Aug 2023 07:54:13 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id l13-20020a5d4bcd000000b003141e629cb6sm16730710wrt.101.2023.08.30.07.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 86DBE1FFBB; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407252; x=1694012052; 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=/xMHxg0y53JN4TLoRHDzXOhPXJYR1t6X3GOG4+zpqXU=; b=ACTcTJK8waim6t7kC7LAhybS2nHfY3+CHPg3h1Fnox6RRO6wo4BHdOR5oNFhBQB1kh m2S0xdCM6qchbv4R+YAbwbx7NqCBa1AsNnesklc6h1o1FIu+OlXfrBj3TY3rObxY+LCn ub2tGJYy36NXKKOOK48W6OKiZzKhUW8aX3mQZMhbUnL+t6nh7sIn7F5A67UTOBzDq5mf BXy7saqoDrog+lnlNQ/hzY3XSbA6uPggAw68JXlWhF6aQFrxLY/7C++3XgmNB+LbuTL1 hx6E5RtKz9IA9U9DRUWmi87piWrl227LhqEK3VRmZhHPxX/Qufqz2YFL9ortJNkzDSol 7L4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407252; x=1694012052; 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=/xMHxg0y53JN4TLoRHDzXOhPXJYR1t6X3GOG4+zpqXU=; b=PaMIZxvQhNlRhQjcb1MjFJzxa3KYo6MIqJs5INPB0EvXpe15pb98MYOysZxiHmNIQa /Fef75WUo2wOzQKKHZpwvwouQ966g7/nFadm51en2eoIdKgyALbqeCuAZhOV/3YX1vjV xaKyxIIgQOXZDfvttoXBh/meoAdSrCIHHTkFzP9qPAWquGIgviqe0OedqAYbSAs8KCo8 reBeJDAIbMsuwI8ce/bFUZlpZpzLimntjo7mjJ1k2GpzWLHjJk2WWOG8DCNKrsy3VLpQ 0R3PEzp+rwjIN3oopKpgmKktMGCyYvm2OZSHoO6XK3Fuu73ngGSdjje0+xwfGbDsGJo9 ALKA== X-Gm-Message-State: AOJu0YwqmUdDIGlCQqjNLkKyw7iV48hOH88N6cpndSn+IhYgftuLerxd p8zmFHQnD7mROuALSsCoSKtotA== X-Google-Smtp-Source: AGHT+IGM2JVAQc/eAyd2w39EKOV3zL7Xjw/h0y8qyIe9CGQZ1qNZvBC1j9NlF3Et2ygxLmgiUEeFaw== X-Received: by 2002:adf:ea41:0:b0:319:7428:9caa with SMTP id j1-20020adfea41000000b0031974289caamr2313798wrn.38.1693407252372; Wed, 30 Aug 2023 07:54:12 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Matheus Branco Borella , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 08/12] gdbstub: fixes cases where wrong threads were reported to GDB on SIGINT Date: Wed, 30 Aug 2023 15:54:03 +0100 Message-Id: <20230830145407.3064249-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407328614100001 From: Matheus Branco Borella This fix is implemented by having the vCont handler set the value of `gdbserver_state.c_cpu` if any threads are to be resumed. The specific CPU picked is arbitrarily from the ones to be resumed, but it should be okay, as all GDB cares about is that it is a resumed thread. Signed-off-by: Matheus Branco Borella Message-Id: <20230804182633.47300-2-dark.ryu.550@gmail.com> [AJB: style and whitespace fixes] Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1725 Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-9-alex.bennee@linaro.org> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 5f28d5cf57..e7d48fa0d4 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -597,6 +597,15 @@ static int gdb_handle_vcont(const char *p) * or incorrect parameters passed. */ res =3D 0; + + /* + * target_count and last_target keep track of how many CPUs we are goi= ng to + * step or resume, and a pointer to the state structure of one of them, + * respectivelly + */ + int target_count =3D 0; + CPUState *last_target =3D NULL; + while (*p) { if (*p++ !=3D ';') { return -ENOTSUP; @@ -637,6 +646,9 @@ static int gdb_handle_vcont(const char *p) while (cpu) { if (newstates[cpu->cpu_index] =3D=3D 1) { newstates[cpu->cpu_index] =3D cur_action; + + target_count++; + last_target =3D cpu; } =20 cpu =3D gdb_next_attached_cpu(cpu); @@ -654,6 +666,9 @@ static int gdb_handle_vcont(const char *p) while (cpu) { if (newstates[cpu->cpu_index] =3D=3D 1) { newstates[cpu->cpu_index] =3D cur_action; + + target_count++; + last_target =3D cpu; } =20 cpu =3D gdb_next_cpu_in_process(cpu); @@ -671,11 +686,25 @@ static int gdb_handle_vcont(const char *p) /* only use if no previous match occourred */ if (newstates[cpu->cpu_index] =3D=3D 1) { newstates[cpu->cpu_index] =3D cur_action; + + target_count++; + last_target =3D cpu; } break; } } =20 + /* + * if we're about to resume a specific set of CPUs/threads, make it so= that + * in case execution gets interrupted, we can send GDB a stop reply wi= th a + * correct value. it doesn't really matter which CPU we tell GDB the s= ignal + * happened in (VM pauses stop all of them anyway), so long as it is o= ne of + * the ones we resumed/single stepped here. + */ + if (target_count > 0) { + gdbserver_state.c_cpu =3D last_target; + } + gdbserver_state.signal =3D signal; gdb_continue_partial(newstates); return res; diff --git a/tests/tcg/multiarch/system/interrupt.c b/tests/tcg/multiarch/s= ystem/interrupt.c new file mode 100644 index 0000000000..98d4f2eff9 --- /dev/null +++ b/tests/tcg/multiarch/system/interrupt.c @@ -0,0 +1,28 @@ +/* + * External interruption test. This test is structured in such a way that = it + * passes the cases that require it to exit, but we can make it enter an + * infinite loop from GDB. + * + * We don't have the benefit of libc, just builtin C primitives and + * whatever is in minilib. + */ + +#include + +void loop(void) +{ + do { + /* + * Loop forever. Just make sure the condition is always a constant + * expression, so that this loop is not UB, as per the C + * standard. + */ + } while (1); +} + +int main(void) +{ + return 0; +} + + diff --git a/tests/tcg/multiarch/gdbstub/interrupt.py b/tests/tcg/multiarch= /gdbstub/interrupt.py new file mode 100644 index 0000000000..e222ac94c5 --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/interrupt.py @@ -0,0 +1,97 @@ +from __future__ import print_function +# +# Test some of the softmmu debug features with the multiarch memory +# test. It is a port of the original vmlinux focused test case but +# using the "memory" test instead. +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb +import sys + +failcount =3D 0 + + +def report(cond, msg): + "Report success/fail of test" + if cond: + print("PASS: %s" % (msg)) + else: + print("FAIL: %s" % (msg)) + global failcount + failcount +=3D 1 + + +def check_interrupt(thread): + """ + Check that, if thread is resumed, we go back to the same thread when t= he + program gets interrupted. + """ + + # Switch to the thread we're going to be running the test in. + print("thread ", thread.num) + gdb.execute("thr %d" % thread.num) + + # Enter the loop() function on this thread. + # + # While there are cleaner ways to do this, we want to minimize the num= ber of + # side effects on the gdbstub's internal state, since those may mask b= ugs. + # Ideally, there should be no difference between what we're doing here= and + # the program reaching the loop() function on its own. + # + # For this to be safe, we only need the prologue of loop() to not have + # instructions that may have problems with what we're doing here. We d= on't + # have to worry about anything else, as this function never returns. + gdb.execute("set $pc =3D loop") + + # Continue and then interrupt the task. + gdb.post_event(lambda: gdb.execute("interrupt")) + gdb.execute("c") + + # Check whether the thread we're in after the interruption is the same= we + # ran continue from. + return (thread.num =3D=3D gdb.selected_thread().num) + + +def run_test(): + """ + Test if interrupting the code always lands us on the same thread when + running with scheduler-lock enabled. + """ + + gdb.execute("set scheduler-locking on") + for thread in gdb.selected_inferior().threads(): + report(check_interrupt(thread), + "thread %d resumes correctly on interrupt" % thread.num) + + +# +# This runs as the script it sourced (via -x, via run-test.py) +# +try: + inferior =3D gdb.selected_inferior() + arch =3D inferior.architecture() + print("ATTACHED: %s" % arch.name()) +except (gdb.error, AttributeError): + print("SKIPPING (not connected)", file=3Dsys.stderr) + exit(0) + +if gdb.parse_and_eval('$pc') =3D=3D 0: + print("SKIP: PC not set") + exit(0) +if len(gdb.selected_inferior().threads()) =3D=3D 1: + print("SKIP: set to run on a single thread") + exit(0) + +try: + # Run the actual tests + run_test() +except (gdb.error): + print("GDB Exception: %s" % (sys.exc_info()[0])) + failcount +=3D 1 + pass + +# Finally kill the inferior and exit gdb with a count of failures +gdb.execute("kill") +exit(failcount) diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg= /multiarch/system/Makefile.softmmu-target index a051d689d7..90810a32b2 100644 --- a/tests/tcg/multiarch/system/Makefile.softmmu-target +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target @@ -27,7 +27,15 @@ run-gdbstub-memory: memory "-monitor none -display none -chardev file$(COMMA)path=3D$<.out$(COMMA)i= d=3Doutput $(QEMU_OPTS)" \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \ softmmu gdbstub support) - +run-gdbstub-interrupt: interrupt + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) \ + --output $<.gdb.out \ + --qargs \ + "-smp 2 -monitor none -display none -chardev file$(COMMA)path=3D$<.out$(= COMMA)id=3Doutput $(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/interrupt.py, \ + softmmu gdbstub support) run-gdbstub-untimely-packet: hello $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \ @@ -50,4 +58,4 @@ run-gdbstub-%: $(call skip-test, "gdbstub test $*", "need working gdb") endif =20 -MULTIARCH_RUNS +=3D run-gdbstub-memory run-gdbstub-untimely-packet +MULTIARCH_RUNS +=3D run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-u= ntimely-packet --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407349; cv=none; d=zohomail.com; s=zohoarc; b=eU1Wh69bYx0SLzNrExkLt1FTxBTPa3uWMdbVSPwd5tasJnuHykRBCqvjM4iGkvGE+ss9UK7l0uVyg5t0HtRMB8j8558NJhjj7o1CoDc87PJf6eamQo+tD5f5j2J7bvs7RGCc7gtwnk3R1o8lCYyW7hEPe2ODO2IAbCjT8RlgXcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407349; 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:To; bh=J+4c/0Q7/eLM71cRhHLrdgn3bw80ZIKHk11jFduNmfQ=; b=AAHvrbJn6MMOxg3gj+k/P1Ylveh0KrFMajSNUWENLN2eQ9OWrpgUDSa5ZidogdIq3KFkxkzsVhx/Hw+6nrybB7aAgrzy3+66Ij+kZ3lx0Q/c4alcCHcipZvQ4Jt9TauOK26nMczkhReDPBVnn2De5tpH6W8uVzGv0wA2cbisjyU= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407349121539.7995580189922; Wed, 30 Aug 2023 07:55:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaL-0001EF-73; Wed, 30 Aug 2023 10:54:21 -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 1qbMaH-0001BE-QZ for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:17 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaD-0000kB-Sy for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:17 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-313e742a787so634726f8f.1 for ; Wed, 30 Aug 2023 07:54:13 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a9-20020a5d5709000000b00317b5c8a4f1sm16858004wrv.60.2023.08.30.07.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 9E5141FFC3; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407252; x=1694012052; 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=J+4c/0Q7/eLM71cRhHLrdgn3bw80ZIKHk11jFduNmfQ=; b=fDVWffmNd2+y6E8EFV4pwLMM7WD8JINn39nRkXhuZ7l0KVfuV1XUP/tcowZPnbob7L D6q5PmhiXYScCxyvOtv9IM/kiFDecxewREfaWkGte9aceamZiUGlV24TOwtOu6b1mMWd bJklnYTCJ6aabolLqPGrEjEsVjO/zDoLQNZVsQJqscH9+A3gR0wW/jkB3P9WJgekzg8s izQkiYew+eiVTwMdlIq75O0BYJzHWGi/EG3fB/qAn4N43C24amP/tbx7gbefa5sgCbBM 2c1BXR0DAEJ2y4Hdwrxb8Wac5wA8h25GVFaBT9m7yd++AfG8Nv8RLVPvSccBHg/cILOj m+pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407252; x=1694012052; 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=J+4c/0Q7/eLM71cRhHLrdgn3bw80ZIKHk11jFduNmfQ=; b=MpRVrCPcbiGDNUvupaOid47WEa/Ez1/9a/5vG1zMpUoAqnPizY/lOwX4gL3od33uCg DtChPZUxNycQLggTKBQwwn8ZKSsR44nVbjmret74/Q2F70RUqpuNAUvruaUiGndjMV9v UZ9eSqmOwJQQUeUaTn3UKoeuG1jtWtlPKL4O7ztOCnJvFRd/VSC/4dzCLM9LB87E5p0n IrOSeUTCWq6l4HDHzdBz6fVpGmRy/ZCLmp7ILG9mcUTDE+DI6v9XJ58TPkYJCApJFz7L 7U3zWbTtSYQ4bdCcfWUZaXht0ty566EfuCLp3sf3ZPeJKAcJz1uPjfBRDWNSmBlMwzUf ifHQ== X-Gm-Message-State: AOJu0YwtueGgI72CgbTx4dOMXVm+lJ7gCiOKBXpFhCklHNVl371qUp22 rERBXy0KOf7ronj+0wtAR1NaSA== X-Google-Smtp-Source: AGHT+IFR6j2JNVE1HL1ChcVANUFaE0M2qCwm6RAK8ebr479Lnvj8b4HoPOAObavsYqsg8OXWgp1qKw== X-Received: by 2002:adf:e54f:0:b0:319:7ec8:53ba with SMTP id z15-20020adfe54f000000b003197ec853bamr1938558wrm.14.1693407252565; Wed, 30 Aug 2023 07:54:12 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PULL 09/12] gdbstub: remove unused user_ctx field Date: Wed, 30 Aug 2023 15:54:04 +0100 Message-Id: <20230830145407.3064249-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407349959100001 This was always NULL so drop it. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Ilya Leoshkevich Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-10-alex.bennee@linaro.org> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index e7d48fa0d4..8e9bc17e07 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -836,7 +836,7 @@ static inline int startswith(const char *string, const = char *pattern) return !strncmp(string, pattern, strlen(pattern)); } =20 -static int process_string_cmd(void *user_ctx, const char *data, +static int process_string_cmd(const char *data, const GdbCmdParseEntry *cmds, int num_cmds) { int i; @@ -863,7 +863,7 @@ static int process_string_cmd(void *user_ctx, const cha= r *data, } =20 gdbserver_state.allow_stop_reply =3D cmd->allow_stop_reply; - cmd->handler(params, user_ctx); + cmd->handler(params, NULL); return 0; } =20 @@ -881,7 +881,7 @@ static void run_cmd_parser(const char *data, const GdbC= mdParseEntry *cmd) =20 /* In case there was an error during the command parsing we must * send a NULL packet to indicate the command is not supported */ - if (process_string_cmd(NULL, data, cmd, 1)) { + if (process_string_cmd(data, cmd, 1)) { gdb_put_packet(""); } } @@ -1394,7 +1394,7 @@ static void handle_v_commands(GArray *params, void *u= ser_ctx) return; } =20 - if (process_string_cmd(NULL, get_param(params, 0)->data, + if (process_string_cmd(get_param(params, 0)->data, gdb_v_commands_table, ARRAY_SIZE(gdb_v_commands_table))) { gdb_put_packet(""); @@ -1738,13 +1738,13 @@ static void handle_gen_query(GArray *params, void *= user_ctx) return; } =20 - if (!process_string_cmd(NULL, get_param(params, 0)->data, + if (!process_string_cmd(get_param(params, 0)->data, gdb_gen_query_set_common_table, ARRAY_SIZE(gdb_gen_query_set_common_table))) { return; } =20 - if (process_string_cmd(NULL, get_param(params, 0)->data, + if (process_string_cmd(get_param(params, 0)->data, gdb_gen_query_table, ARRAY_SIZE(gdb_gen_query_table))) { gdb_put_packet(""); @@ -1757,13 +1757,13 @@ static void handle_gen_set(GArray *params, void *us= er_ctx) return; } =20 - if (!process_string_cmd(NULL, get_param(params, 0)->data, + if (!process_string_cmd(get_param(params, 0)->data, gdb_gen_query_set_common_table, ARRAY_SIZE(gdb_gen_query_set_common_table))) { return; } =20 - if (process_string_cmd(NULL, get_param(params, 0)->data, + if (process_string_cmd(get_param(params, 0)->data, gdb_gen_set_table, ARRAY_SIZE(gdb_gen_set_table))) { gdb_put_packet(""); --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407360; cv=none; d=zohomail.com; s=zohoarc; b=bDOOz2cbqs1LSC0QONkZX5Z7o6TRw0GTKqzix+7MVgRpBuBF8patvrXdNB27RiYpqsYVj8kRJ96XKGwXClrz7W5t8Z1IElcJfQNYWU+TeuTCiC1SXOkRZhxf+bkj+dPviNhu0kKFNkXM79lNXokaUbvZiRJB1kPZV6tcTbdJ2fU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407360; 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:To; bh=SQNWyEt/hAb1sq6x2ShrI2jNVdnDYAzqYtnrYXK/jhc=; b=mfwgeoFKSIiM1/qOw3a0q4q58KWgZA76qb7tE5Gmh6k5B3BXRNNJ94P8Iaiaik4vaLqW/VY5TPtD1dV2Gn4bLmTIjfe+jZ9Z2g9KrtPY20erpK1BOrzDIVA2PFwJQ8xk+W0T/H/JNS7GxuFHygQLgwT4WO4F0llS1efKdc1z2oc= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407360820862.3490197930712; Wed, 30 Aug 2023 07:56:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaI-0001CA-NQ; Wed, 30 Aug 2023 10:54:18 -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 1qbMaH-0001B3-Ab for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:17 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaC-0000k0-UG for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:17 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-401da71b7c5so15201555e9.2 for ; Wed, 30 Aug 2023 07:54:12 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id u7-20020a05600c210700b003fee8793911sm2521092wml.44.2023.08.30.07.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:09 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B76831FFBC; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407251; x=1694012051; 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=SQNWyEt/hAb1sq6x2ShrI2jNVdnDYAzqYtnrYXK/jhc=; b=SPvRqdfednxicQJHYxe6VAFjOAnT7bseLZ4FcO+tKM2EQqwgWiTUlZ+C13A1zqYLpl /wMC3AJ2kNJu+mtnfwlLthKiFHrSacgNmJN1M46wsEXrrFYcspj8ryoysFbQvbC+CqgQ j1PWl77YFu5v8SWlNYqhyWLWnwnCMqiC458oQXwsbmqO1HOkDIZhO9btraVIzlf5++vO eQkc7krN8snfJpstF48F4rNCQGAaTvaEZ0CV+y+HcMJvp271wfOWPls+/4GuptjZrY0w 4yaTlr8bhJ0y8BTwHOXkEfeG9EDpCJucY3e1l3bHc7C1gED+8yX14pev6To/Ss1i5vIy Z9xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407251; x=1694012051; 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=SQNWyEt/hAb1sq6x2ShrI2jNVdnDYAzqYtnrYXK/jhc=; b=Q6y3t2REKOgyUn9cnbWoJrlsdsGr2/IYfwO45k07Daw7VrYz4mBshaRfVz0qzfhGfT fdSzPr0x9cx3QIDv1syO7aNOW7qon8NgDE14vdbH1hCr7djeboXfMoSG8DFpDFaKunQT hCN2NrwmjAUdqDnOF6TmOk51cRBIdZ15QlW8L4PEPGp8GGcWM8VDFXCcxMOj2FMygBCI LHJXKiwdxvCK4fpFiMf7plP+lmQZEGL/i4iRORCGiKVpa8n0uPRH0AHhIKi2W1Xe1IQM brsfj0ZiGsUru+rpFvH0+BcvQZW2z+2LcVbKjdW/3x+R8vLRRgUzuW8HbiXPc9ubcixv 55Ww== X-Gm-Message-State: AOJu0YyKlzw48F1mqFOMMxTKBoxYa9WVdEmn73d1NlNNrFtEQYk13CgX UE4iMse7kL0BvQ2bIDlEz2L4bw== X-Google-Smtp-Source: AGHT+IGZ62lDvrQNEeYJa7B2J22la/c9PAmImIspgf/3iekIFnyM+VZTFc7Lk5AXHhlItZy1nKp4rw== X-Received: by 2002:a1c:6a03:0:b0:401:b652:b6cf with SMTP id f3-20020a1c6a03000000b00401b652b6cfmr2081629wmc.13.1693407251610; Wed, 30 Aug 2023 07:54:11 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/12] gdbstub: refactor get_feature_xml Date: Wed, 30 Aug 2023 15:54:05 +0100 Message-Id: <20230830145407.3064249-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407361507100001 Try to bring up the code to more modern standards by: - use dynamic GString built xml over a fixed buffer - use autofree to save on explicit g_free() calls - don't hand hack strstr to find the delimiter - fix up style of xml_builtin and invert loop Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-11-alex.bennee@linaro.org> 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 8e9bc17e07..729e54139a 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -354,64 +354,67 @@ static CPUState *gdb_get_cpu(uint32_t pid, uint32_t t= id) static const char *get_feature_xml(const char *p, const char **newp, GDBProcess *process) { - size_t len; - int i; - const char *name; CPUState *cpu =3D gdb_get_first_cpu_in_process(process); CPUClass *cc =3D CPU_GET_CLASS(cpu); + size_t len; =20 - len =3D 0; - while (p[len] && p[len] !=3D ':') - len++; - *newp =3D p + len; + /* + * qXfer:features:read:ANNEX:OFFSET,LENGTH' + * ^p ^newp + */ + char *term =3D strchr(p, ':'); + *newp =3D term + 1; + len =3D term - p; =20 - name =3D NULL; + /* Is it the main target xml? */ 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) { GDBRegisterState *r; + GString *xml =3D g_string_new(""); + + g_string_append(xml, + "" + ""); =20 - pstrcat(buf, buf_sz, - "" - "" - ""); 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, ""); - g_free(arch); + g_autofree gchar *arch =3D cc->gdb_arch_name(cpu); + g_string_append_printf(xml, + "%s", + arch); } - pstrcat(buf, buf_sz, "gdb_core_xml_file); - pstrcat(buf, buf_sz, "\"/>"); + g_string_append(xml, "gdb_core_xml_file); + g_string_append(xml, "\"/>"); for (r =3D cpu->gdb_regs; r; r =3D r->next) { - pstrcat(buf, buf_sz, "xml); - pstrcat(buf, buf_sz, "\"/>"); + g_string_append(xml, "xml); + g_string_append(xml, "\"/>"); } - pstrcat(buf, buf_sz, ""); + g_string_append(xml, ""); + + process->target_xml =3D g_string_free(xml, false); + return process->target_xml; } - return buf; } + /* Is it dynamically generated by the target? */ if (cc->gdb_get_dynamic_xml) { - char *xmlname =3D g_strndup(p, len); + g_autofree char *xmlname =3D g_strndup(p, len); const char *xml =3D cc->gdb_get_dynamic_xml(cpu, xmlname); - - g_free(xmlname); if (xml) { return xml; } } - for (i =3D 0; ; i++) { - name =3D xml_builtin[i][0]; - if (!name || (strncmp(name, p, len) =3D=3D 0 && strlen(name) =3D= =3D len)) - break; + /* 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]; + if ((strncmp(name, p, len) =3D=3D 0) && + strlen(name) =3D=3D len) { + return xml_builtin[i][1]; + } } - return name ? xml_builtin[i][1] : NULL; + + /* failed */ + return NULL; } =20 static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) @@ -2245,6 +2248,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 --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407330; cv=none; d=zohomail.com; s=zohoarc; b=cMY03f/lIQITNEIpN2zOb3OMw9pL+hx9+MYq+FEq3t0MaRDHN8NmyVVK5Mw7EbnvLXGm4mD3D9ENV6cjV4sW4hJGD6V0A9sK+cSHInXPVOW2roUfYYMsT4YMho3op47oIJ7p/E01tbGrYmAIUsTyHf8TnIwg5lLKKofPAn0eEfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407330; 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:To; bh=FIIWkIImEVUr1vcFkZ9mfJXCWjjR9U+tUkLobigHVPM=; b=jcxnDM2Z6QLckGLeYjFRz+MQDc9CMDt5Fd9HTN1+0ti929EbAcSqTMcy+LdU7rZ1TAx2n+GR7i00PoQSAaUlI+BS5F6S2Tm/fvLA2mr1hngva0q6izn6ZKsLIfkrnhBqQecebZdwPkoJwvvkptlLciOKX+eFmMpoMJnoP/Yw0Ag= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407330498324.48089402151425; Wed, 30 Aug 2023 07:55:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaO-0001G9-1k; Wed, 30 Aug 2023 10:54:24 -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 1qbMaK-0001Dq-Hh for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:20 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450: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 1qbMaF-0000lH-9L for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:20 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40037db2fe7so53705235e9.0 for ; Wed, 30 Aug 2023 07:54:14 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id n8-20020a7bcbc8000000b00401d8810c8bsm2501252wmi.15.2023.08.30.07.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DE1081FFBD; Wed, 30 Aug 2023 15:54:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407254; x=1694012054; 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=FIIWkIImEVUr1vcFkZ9mfJXCWjjR9U+tUkLobigHVPM=; b=T7COO35S88ANfT8GnupCiA0KH+UMe9X8yaUpz37HbEqx+43UjLJO7hTTNMeHTJVIjy AUgb7IHyPebTNiwk9H7REK+c2NNZipQJq3NJtZGT3+BASie6ed7QkWGlJcJdWGNVC8tL rOtbDwk5VqcnY3ik8kRYye/Jd5BKjGC3IXKBzPuqGyi30vL5ubdf2ifGIRkQ69G3MnZ1 9UNBFqdZma7ZQ3koFd9uDlD83gyDXIJH133jUkUweRlbghBWUatrppDDPcScxSF3jxW1 uLzfWfn/pBB3e4PHgdylVTEVpkOrjKlUkLokku9dn35B8ML7VfCot4M4VGGr3NkjRs5a TzQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407254; x=1694012054; 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=FIIWkIImEVUr1vcFkZ9mfJXCWjjR9U+tUkLobigHVPM=; b=NaTtjg20o6zwrrB0tuii5Y9q8TF2bc1WC/3ILL1NTdihxUHLZ6V3Xp0nPPH4oti98y FR61B2CMPOzY/ddJ42o/vzi8ICiXEJ1xc6lR1LOerGrSfrE2Es+CDay+iMWvyyX2/Pps oPVXrMTasaGmjrnZOhPsn0O1OTNs2QJ0YOPipTiyw+K6P/LRDC4POhifEiKwKMvWi2FU 6UYIkWE/u6STI+jifnX3oBn/OhCk0WCPfThGYjD670AzfnUrq5zTHNYm9zqWjNN4pPeE epFIrK6SK+L+abmPy8COFvQkurAmq/MtPHJh7JsMVXIiCROfYRAMou6Mkh3083MEpAnZ 4dFg== X-Gm-Message-State: AOJu0YwKyU96z9BSBn2Sln//CT28RQoODIotHpQ49o07Z72pu051yh7J DifbqvXMvAcoqafP8I7qz9vToQ== X-Google-Smtp-Source: AGHT+IHGHcet/8iGTfC3vzIvHbGUcMB04gwTy2C38mu/ucSFQGJdLu9hiEWUb8mmVWCJGC0s7TZxDQ== X-Received: by 2002:a05:600c:b50:b0:3fe:c7fe:206e with SMTP id k16-20020a05600c0b5000b003fec7fe206emr2253566wmr.16.1693407253709; Wed, 30 Aug 2023 07:54:13 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell , Daniel Henrique Barboza , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Greg Kurz , Nicholas Piggin , qemu-arm@nongnu.org (open list:ARM TCG CPUs), qemu-ppc@nongnu.org (open list:PowerPC TCG CPUs) Subject: [PULL 11/12] gdbstub: replace global gdb_has_xml with a function Date: Wed, 30 Aug 2023 15:54:06 +0100 Message-Id: <20230830145407.3064249-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1693407331853100005 Try and make the self reported global hack a little less hackish by providing a query function instead. As gdb_has_xml was always set if we negotiated XML we can now use the presence of ->target_xml as the test instead. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-12-alex.bennee@linaro.org> diff --git a/gdbstub/internals.h b/gdbstub/internals.h index 4876ebd74f..fee243081f 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -33,6 +33,7 @@ typedef struct GDBProcess { uint32_t pid; bool attached; =20 + /* 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 7d743fe1e9..0ee39cfdd1 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -31,12 +31,12 @@ int gdbserver_start(const char *port_or_device); 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. + * gdb_has_xml() - report of gdb supports modern target descriptions + * + * This will report true if the gdb negotiated qXfer:features:read + * target descriptions. */ -extern bool gdb_has_xml; +bool gdb_has_xml(void); =20 /* in gdbstub-xml.c, generated by scripts/feature_to_c.sh */ extern const char *const xml_builtin[][2]; diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 729e54139a..fdebfe25ea 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) { @@ -351,6 +349,11 @@ 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) { @@ -1084,7 +1087,7 @@ static void handle_set_reg(GArray *params, void *user= _ctx) { int reg_size; =20 - if (!gdb_has_xml) { + if (!gdb_get_cpu_process(gdbserver_state.g_cpu)->target_xml) { gdb_put_packet(""); return; } @@ -1105,7 +1108,7 @@ static void handle_get_reg(GArray *params, void *user= _ctx) { int reg_size; =20 - if (!gdb_has_xml) { + if (!gdb_get_cpu_process(gdbserver_state.g_cpu)->target_xml) { gdb_put_packet(""); return; } @@ -1572,7 +1575,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 f509b7285d..9f0b8b5497 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) diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index f421c5d041..8fc8351df7 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -48,7 +48,7 @@ int arm_cpu_gdb_read_register(CPUState *cs, GByteArray *m= em_buf, int n) } if (n < 24) { /* FPA registers. */ - if (gdb_has_xml) { + if (gdb_has_xml()) { return 0; } return gdb_get_zeroes(mem_buf, 12); @@ -56,7 +56,7 @@ int arm_cpu_gdb_read_register(CPUState *cs, GByteArray *m= em_buf, int n) switch (n) { case 24: /* FPA status register. */ - if (gdb_has_xml) { + if (gdb_has_xml()) { return 0; } return gdb_get_reg32(mem_buf, 0); @@ -102,7 +102,7 @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *m= em_buf, int n) } if (n < 24) { /* 16-23 */ /* FPA registers (ignored). */ - if (gdb_has_xml) { + if (gdb_has_xml()) { return 0; } return 12; @@ -110,7 +110,7 @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *m= em_buf, int n) switch (n) { case 24: /* FPA status register (ignored). */ - if (gdb_has_xml) { + if (gdb_has_xml()) { return 0; } return 4; diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index ca39efdc35..2ad11510bf 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -56,7 +56,7 @@ static int ppc_gdb_register_len(int n) return sizeof(target_ulong); case 32 ... 63: /* fprs */ - if (gdb_has_xml) { + if (gdb_has_xml()) { return 0; } return 8; @@ -76,7 +76,7 @@ static int ppc_gdb_register_len(int n) return sizeof(target_ulong); case 70: /* fpscr */ - if (gdb_has_xml) { + if (gdb_has_xml()) { return 0; } return sizeof(target_ulong); --=20 2.39.2 From nobody Wed May 15 06:03:25 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1693407348; cv=none; d=zohomail.com; s=zohoarc; b=C2Xn8PSssGdh8h3PbMVnppM2LNxM/u0rdg4Li5SUqRdhnG3tcB9Kbt+sIUQOhyQg3sIEp8cqo3AHhyFsC1lks2Bjgb/ZJLfTQxcTX/TLn+gJaPl4qWWi4vvmjQ+9hA209wF3TUDQP55cuDYHmv2sGwKsagpQpA47EZRaRcyk3vA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407348; 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:To; bh=XKjAgQoj2FFsH6qRrmv8SNeV5ivWp4tXeZ8rykfRKz0=; b=e947gnqlPEMmkjB4jHh4L6Xlj1mbOeHmgH39mzVB500BB6xP/gjTu+/D7IfbpC/KhSNuqbfGjD7gYjs7zVJCLaR1/94JqjpY+VK9uJhnMmWJOUE0S6SPvSlfGppjv2WdrSjTvaVXje0eg9Wn3Q1eF96nFMEcqimpYk2axCb/UzY= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693407348880259.32567126331423; Wed, 30 Aug 2023 07:55:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMaM-0001FN-FQ; Wed, 30 Aug 2023 10:54:22 -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 1qbMaK-0001Dr-K0 for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:20 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMaF-0000lV-Ia for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:54:20 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-31c8321c48fso631075f8f.1 for ; Wed, 30 Aug 2023 07:54:15 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id s8-20020a5d6a88000000b0031431fb40fasm16810212wru.89.2023.08.30.07.54.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:54:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0305A1FFC4; Wed, 30 Aug 2023 15:54:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693407254; x=1694012054; 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=XKjAgQoj2FFsH6qRrmv8SNeV5ivWp4tXeZ8rykfRKz0=; b=swZJNEGXqnTMvy1jFN8vxOx1D/68V5iyROcHqkELnQqZIWK052mHjALCX06QsWBnT7 0238cPdGWQtl6G9ocsB9p0w22FaqhRfOhLS+4yOy838PJWlksxbmdqdRHMZ2TEpLESQ7 ZTfCEQf8XFc7RRMS5uoiorUtvyDt6j7hF9W3y/2Q7lHC1Bf6dj5tGqhxvJVgYnWDG9ER P0/eAMTv4jzuCVp/TRIysjO6kiQyCOoizUrh/TN5zH1g4hC5TrJTtEqMpeqSWH5dbBWd b6FPIjWWTdwLy+xrjCGsu3JcY2TRKUCbmIjtyZJwMIzXHI1Y1IixeoswZtvqDhedt7/U ml9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407254; x=1694012054; 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=XKjAgQoj2FFsH6qRrmv8SNeV5ivWp4tXeZ8rykfRKz0=; b=Qpri+AkHJgdTa+EEcoofeEzlTweKW5pHX/6ZXA72r+i3oULb6GwRhPEUX3VYRv8tYI NljGK/+dBr6pPfn/n7genJYCWhbkGOgIoTHAMIs4zwL0XUp2uvz3ZnKZyyFNhxk0YMAl +RxgYR9y0xZL8ICeG2bsZWtzG/BwQbRkx5jlSyiMjolNHpki9kQB/zlxRL9hV8fmrrdW WHzoB1Q3EjpqzjHRAw6e3VsiyBTKVZhnzhEome8DIj1Uy2eZoDyLvE9kOyLS2aLlgOwE 8it0HqWpB+ICK8QzRD8TZ0LqLs5h5dNSnSiJAaGcgz8jv8g0ZRPzZYtPqDSE/BlwNMyF UVYQ== X-Gm-Message-State: AOJu0YxvkP8CtzF2pJqMct6jzjYHxSLcxgAymD5+778mCwo2EWcvjGKx erk/59CpTJgxadbU/m3Q4SxeHQ== X-Google-Smtp-Source: AGHT+IFQi+JSrDVqEeN60MsRe7UVIdJns3aQBSrxm+N1qgNV+VRNVJpzuBtuQmObro1Nzwf5dxllIw== X-Received: by 2002:adf:f7c1:0:b0:317:6734:c2ae with SMTP id a1-20020adff7c1000000b003176734c2aemr4673187wrq.11.1693407254211; Wed, 30 Aug 2023 07:54:14 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 12/12] gdbstub: move comment for gdb_register_coprocessor Date: Wed, 30 Aug 2023 15:54:07 +0100 Message-Id: <20230830145407.3064249-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830145407.3064249-1-alex.bennee@linaro.org> References: <20230830145407.3064249-1-alex.bennee@linaro.org> 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: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 @linaro.org) X-ZM-MESSAGEID: 1693407349965100002 Use proper kdoc style comments for this API function. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20230829161528.2707696-13-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 0ee39cfdd1..16a139043f 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -14,6 +14,16 @@ /* Get or set a register. Returns the size of the register. */ typedef int (*gdb_get_reg_cb)(CPUArchState *env, GByteArray *buf, int reg); typedef int (*gdb_set_reg_cb)(CPUArchState *env, uint8_t *buf, int reg); + +/** + * gdb_register_coprocessor() - register a supplemental set of registers + * @cpu - the CPU associated with registers + * @get_reg - get function (gdb reading) + * @set_reg - set function (gdb modifying) + * @num_regs - number of registers in set + * @xml - xml name of set + * @gpos - non-zero to append to "general" register set at @gpos + */ void gdb_register_coprocessor(CPUState *cpu, gdb_get_reg_cb get_reg, gdb_set_reg_cb set_r= eg, int num_regs, const char *xml, int g_pos); diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index fdebfe25ea..349d348c7b 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -456,12 +456,6 @@ static int gdb_write_register(CPUState *cpu, uint8_t *= mem_buf, int reg) return 0; } =20 -/* Register a supplemental set of CPU registers. If g_pos is nonzero it - specifies the first register number and these registers are included in - a standard "g" packet. Direction is relative to gdb, i.e. get_reg is - gdb reading a CPU register, and set_reg is gdb modifying a CPU register. - */ - void gdb_register_coprocessor(CPUState *cpu, gdb_get_reg_cb get_reg, gdb_set_reg_cb set_r= eg, int num_regs, const char *xml, int g_pos) --=20 2.39.2