From patchwork Tue Aug 15 14:51:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713783 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1823183wrp; Tue, 15 Aug 2023 07:54:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbk7a+R+EP8giuzir/hE+jdlOpp8eH30NilWs6VPPeJ0PaVJU/JjaojgYHxpYdzxW41R+9 X-Received: by 2002:a05:6102:250:b0:443:85fa:32dc with SMTP id a16-20020a056102025000b0044385fa32dcmr8235136vsq.7.1692111276596; Tue, 15 Aug 2023 07:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111276; cv=none; d=google.com; s=arc-20160816; b=YaQMPZtn5/Drp8bD8TyoNA/5jjKtS3iOU7T2I++u5TokhrMxtG0JFTzY48T0aaK2xw 1XSl7HQW/hWAkb7ftE3mjYaEhZY7JIF9vYPM5fBsguGMkXTyt2gCCZdyEz9FPqWe+mfk 7k+q2IvJyFJI23566tUjRbPaUJuf4sncJnSWoVJUYxzT1viA4JO1AeKFX1r0qma4O8ll IXPLuu5dnE4DUdyIOWKL9K06ige7N5ZHtyDZsSngV1JdsyHxsxaRg0jsl0ZKaNixmArC oFhbJunlQbVAJCnA7yD8sybh3ciU5CYo3Q6yROz3nRArA0AObsRGhw10mLkTCOVMbUV7 3B5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yFrqHRj+4Z4QeOb4gTibh0+O8iFD1dFK/WKj4LG+z60=; fh=0yIyjxusVARvdjVk62am+XFjXZhaEpc8VwJZ3cUZg5U=; b=Zw+pt1Kugi1zYBSyf9wjbfJqbZ3MpI5JRftOCDFaMh9GpTL7JeVbuYsNIzE8YKnkdO GNze1FoAquHn1hQl6MQhA2P+zwRQnNngh8d4TrzgxaIXwNvthey52JB8VspWr/wDURRt OZkdRk506erzW9KUEhI+TI0DlIEK9XFoE401BDGWknJYHVctk5g3b46rf+g9eCv+iKAW CrlsMdPhpG1jG1MfEZwLLfc03F9rvxLg5YSRVPbmnFmxxLREm0P4o6b4+HISdHnbk59j WAlCyIcyxYdfTC1B6tAMYwpdozkOdEFn+QB/voQEjSkZZpm3+Cpe6zUASeQ0PA9fkC08 HWJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z4UDVvsc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f20-20020a0cf3d4000000b0063fbe48a482si7346790qvm.374.2023.08.15.07.54.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:54:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z4UDVvsc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOW-0005oO-Ij; Tue, 15 Aug 2023 10:51:40 -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 1qVvOV-0005nl-9t for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:39 -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 1qVvOM-0006Ff-19 for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:39 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3197a71a9c0so1181101f8f.1 for ; Tue, 15 Aug 2023 07:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111088; x=1692715888; 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=yFrqHRj+4Z4QeOb4gTibh0+O8iFD1dFK/WKj4LG+z60=; b=z4UDVvscermnkIRsj9k1SX2aPqjAlR4hvrYBp2THGVxYnmIXWRrjvh655HIpg9JzzD vU+QpLOdyIlYlQOc3EYmPvbr+z/f6cqv0aUDHVfas5YH3rnkYmgN2+MQM/2sAmk4GUv5 AX9RlT1S+YLzRxsz1XNs0mEXJMn8zVR39qZs1FxsXgaVRu7yaU7oa6luBIQLFWrQpqq7 e5XoYchph1fqyI/UrWdkq7DO67aM2nLp/cKSdBJoe6s6cf1YJ6XOuSF5vcFHfHcNWmVl Pr/F095S5hmuX9PRIxzDSGMzADdtjS1xf6qxWZ0PxUYHZZWgClCLjCjFYvkGW5X7HB0D HA0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111088; x=1692715888; 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=yFrqHRj+4Z4QeOb4gTibh0+O8iFD1dFK/WKj4LG+z60=; b=XlEX/pE+pOhCIlhVZRUQD2H4TkmyFvXOoN5f+EMTSwRcajW75bOMpP/suGSH4eJQPQ Y2XBHsksHA93l2AayEvME4kbLIOayL2SVwwfAYx5F+y5P/A1EgT6S7MGVifj/dwjggNq NRGjDJC2MZncy9YFfvxaEP0HswhCxzC40oRO0KF+xN3gv7/2Ww/3iIbZGOXT9RlqFLAa Kd9EgvD3FBy5onzCq36I3ICYlWDd5f+YTtRvhBNuCOno7ijUFgckfrSH9EhidHghYy1m Cfg/h0ppNM/lsXzKdX83s/S70htBlvKMietfyqQngVxagrqTVHujT42Po8xqsx07/SV9 c5UA== X-Gm-Message-State: AOJu0Yx8fDHxr7VhF7yHzB4TOvsFYG1WdG5qAO64giRXM4N8To45QvGo CISQ1BE41RWiedg0rT9B75z8SA== X-Received: by 2002:a5d:40cf:0:b0:30e:56b3:60fe with SMTP id b15-20020a5d40cf000000b0030e56b360femr1764820wrq.4.1692111087879; Tue, 15 Aug 2023 07:51:27 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id k13-20020a5d428d000000b0030ada01ca78sm18236374wrq.10.2023.08.15.07.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:27 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E81411FFBC; Tue, 15 Aug 2023 15:51:26 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH 1/9] gitlab: enable ccache for many build jobs Date: Tue, 15 Aug 2023 15:51:18 +0100 Message-Id: <20230815145126.3444183-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Daniel P. Berrangé 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='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=1 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=1' env variable against their gitlab fork CI settings. Signed-off-by: Daniel P. Berrangé Message-Id: <20230804111054.281802-2-berrange@redhat.com> Signed-off-by: Alex Bennée --- docs/devel/ci-jobs.rst.inc | 7 +++++ .gitlab-ci.d/buildtest-template.yml | 11 ++++++++ .gitlab-ci.d/crossbuild-template.yml | 26 +++++++++++++++++++ .gitlab-ci.d/windows.yml | 13 ++++++++-- .../dockerfiles/debian-hexagon-cross.docker | 9 ++++++- 5 files changed, 63 insertions(+), 3 deletions(-) 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=1" env variable to disable it. diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.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=$(expr $(nproc) + 1) script: + - export CCACHE_BASEDIR="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" + - export PATH="$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build + - ccache --zero-stats - ../configure --enable-werror --disable-docs --enable-fdt=system ${TARGETS:+--target-list="$TARGETS"} $CONFIGURE_ARGS || @@ -20,6 +30,7 @@ then make -j"$JOBS" $MAKE_CHECK_ARGS ; fi + - ccache --show-stats # 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="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" + - export PATH="$CCACHE_WRAPPERSDIR:$PATH" - mkdir build - cd build + - ccache --zero-stats - ../configure --enable-werror --disable-docs --enable-fdt=system --disable-user $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS --target-list-exclude="arm-softmmu cris-softmmu @@ -18,6 +28,7 @@ version="$(git describe --match v[0-9]* 2>/dev/null || git rev-parse --short HEAD)"; mv -v qemu-setup*.exe qemu-setup-${version}.exe; fi + - ccache --show-stats # 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="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="500M" + - export PATH="$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="$(pwd)" + - export CCACHE_DIR="$CCACHE_BASEDIR/ccache" + - export CCACHE_MAXSIZE="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 = 'yes' # Preserve the current working directory - $env:MSYS = 'winsymlinks:native' # Enable native Windows symlink + - $env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR" + - $env:CCACHE_DIR = "$env:CCACHE_BASEDIR/ccache" + - $env:CCACHE_MAXSIZE = "500M" + - $env:CCACHE_DEPEND = 1 # cache misses are too expensive with preprocessor mode + - $env:CC = "ccache gcc" - mkdir build - cd build + - ..\msys64\usr\bin\bash -lc "ccache --zero-stats" - ..\msys64\usr\bin\bash -lc "../configure --enable-fdt=system $CONFIGURE_ARGS" - ..\msys64\usr\bin\bash -lc "make" - ..\msys64\usr\bin\bash -lc "make check MTESTARGS='$TEST_ARGS' || { cat meson-logs/testlog.txt; exit 1; } ;" + - ..\msys64\usr\bin\bash -lc "ccache --show-stats" - Write-Output "Finished build at $(Get-Date -Format u)" msys2-64bit: diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker b/tests/docker/dockerfiles/debian-hexagon-cross.docker index c2cfb6a5d0..578269766c 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 \ @@ -24,13 +25,19 @@ RUN apt-get update && \ python3-venv && \ # Install QEMU build deps for use in CI DEBIAN_FRONTEND=noninteractive 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 ENV TOOLCHAIN_INSTALL /opt ENV TOOLCHAIN_RELEASE 16.0.0 ENV TOOLCHAIN_BASENAME "clang+llvm-${TOOLCHAIN_RELEASE}-cross-hexagon-unknown-linux-musl" ENV TOOLCHAIN_URL https://codelinaro.jfrog.io/artifactory/codelinaro-toolchain-for-hexagon/v${TOOLCHAIN_RELEASE}/${TOOLCHAIN_BASENAME}.tar.xz +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" RUN curl -#SL "$TOOLCHAIN_URL" | tar -xJC "$TOOLCHAIN_INSTALL" ENV PATH $PATH:${TOOLCHAIN_INSTALL}/${TOOLCHAIN_BASENAME}/x86_64-linux-gnu/bin From patchwork Tue Aug 15 14:51:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713782 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1822877wrp; Tue, 15 Aug 2023 07:53:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgJMLpH+Tlgo7w3aE0MjnNBNo6q6zN49tOJhMJhRdEpQBocG+gUI6gIOQkrhbshZViWeox X-Received: by 2002:a0c:b4da:0:b0:647:2653:bcc with SMTP id h26-20020a0cb4da000000b0064726530bccmr3063053qvf.13.1692111231565; Tue, 15 Aug 2023 07:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111231; cv=none; d=google.com; s=arc-20160816; b=E2ZT1lKcvZVPrrGkvJ1mroKBaUkdFMxkL7EhSmmBdJn1GbgoqyrfteRPXD2pSJX0VR RhM6xllqEH1Vscz99E0dRxUR0P6dKtXLDoY6tAS0bRgYKSjsNIb3vvKZyRoBdCC86Mwc 8O4Bg1evz9iExUjipdc2FIFnuxgjd3yVa/HZq+muHrKZ+SKf+UabhKuaAKymfph3ueJZ 6Ob/dFO3suzHR/I3F/52EHf8TNeHt2J7QJP5tc1i3wzSFIoCoSLnsx79gvLqVtjppPub hi3T1uMKM2T281hzwf/lc0G9CyN8YOFooaSlkS5oPrEbsGaWtdXDBOmXlL333XCKMI87 P1Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lqn39QxMs9aLTyxsVNGDWvzJYuuXaaxbNOeSMjBfXiY=; fh=04/pGBQSKxP/VRM1dOX7r60Lg6gNaLrLAuVAoZSSo70=; b=Eo2IAYTkJoWRWsi+Z2dZjMkOwz50cqlx0LDFtnCct2ozmMCD+VW2VorD4lApdae2uC KQNLSbx9OD2mU9dj2bOGXz6YTq4cGlVOYVxjvJojX3jjXY9y6nIXyT2NYBGRJxeLu9xd QsZCPY1XDJ0AIXqIPwPjRFieHBKJT3mcbHUmsj2qWSM201iz3vVhnesJVBuov3O44/W5 LMCWAi4t2LR4/Zr8yomZYPfOCA+Vh9wMcR2spXH9v2uQc2FHikgjo+HcUCQ7fcm+gU7r JdEntXut06oy2ifbn81SzbPcpvnYYe4Y5PEFaKba+NMnQJyo1pPjRQFWbzurKOiffAWX mAWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FDbUbCvG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o16-20020a0cf4d0000000b006471feb326esi2782908qvm.275.2023.08.15.07.53.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:53:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FDbUbCvG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOU-0005mW-G1; Tue, 15 Aug 2023 10:51:38 -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 1qVvOT-0005lO-0z for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:37 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVvOM-0006Fi-7H for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:36 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fe4a89e8c4so50627485e9.3 for ; Tue, 15 Aug 2023 07:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111088; x=1692715888; 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=lqn39QxMs9aLTyxsVNGDWvzJYuuXaaxbNOeSMjBfXiY=; b=FDbUbCvGPy4nyh0kTR3uFhAv59rJkeoq5X0aNLKdNhrEQlQwBq6OqFKGywaCRtnTrS h7WH1sO9m4IxN8dob7+ArUZTitDbJL+YS9LDZiiv4/lfp608xWp1JK5DiLlsTansjPZ+ +skAtIRULH658sSEfND5GK/CAm98pr0ZiBA7wYHjKLj9pPpyv87ig+7qi4WIHlQiy8eo sITsi3tcOU6K4ATQItV4my08GIZo+//YtLk+5DtRAVNMebmpDvUwMvny1e8jaBuC63Yj vkzuOvichtWKY34FeMCsZ99hsesAqofUq0hxUurXB1oY0DImYrPkwIjE/8wAqGiVhFdV /Pkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111088; x=1692715888; 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=lqn39QxMs9aLTyxsVNGDWvzJYuuXaaxbNOeSMjBfXiY=; b=O5uYSyhuobdeY5d0MK+z8LuotO8gtf8bChIrE0eBpoz8H7W3HQTlyyFPvbVk7SIrGr 1+Yh3NWdUiMrbwtfNCDAAcWcyF3vzxLkX1X+QPiJK+5vV4naV2264qdJ/VaK+Kd0BuQ9 z5LzywJ9WlsPdbq/mza5haQLJOwgeU6Me92hGnvK4B1kkjtr/A8/3fVp42AUePq9IE1n a7gEig8bkLHUTgZ2JSfjzIC+k8d5N/5XxoYtuwnUA11/hg+nmAhQgPxQUhgeDVHPlSAn avaTSTtUz4lpWliWLOrcObvRAmlb4iFgfw2Aw1/Et0q4WQrQewgHAEn+LDTNo4iNBebi xQIg== X-Gm-Message-State: AOJu0YwjXh2RlKJ0YR9toY9EFNncPXeY0OQFoFey7a4Nd6/1N/4/0Rti T0wFe4yZ94vht51VPRNW6tR/Ag== X-Received: by 2002:adf:dc91:0:b0:313:e553:b858 with SMTP id r17-20020adfdc91000000b00313e553b858mr9712327wrj.33.1692111088112; Tue, 15 Aug 2023 07:51:28 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id d10-20020a056000114a00b00301a351a8d6sm17931556wrx.84.2023.08.15.07.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:27 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0FDB21FFBD; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin Subject: [PATCH 2/9] tests/docker: cleanup non-verbose output Date: Tue, 15 Aug 2023 15:51:19 +0100 Message-Id: <20230815145126.3444183-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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). Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé --- tests/docker/Makefile.include | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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=1 \ $(if $(NOUSER),, \ --build-arg USER=$(USER) \ - --build-arg UID=$(UID)) \ - -t qemu/$* - < $<, \ - "BUILD", $1) + --build-arg UID=$(UID)) \ + -t qemu/$* - < $< $(if $V,,> /dev/null),\ + "BUILD", $*) # Special rule for debootstraped binfmt linux-user images docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker From patchwork Tue Aug 15 14:51:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713786 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1823245wrp; Tue, 15 Aug 2023 07:54:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgKIaV0b77U/Jby58CbtZwhf9b0+JDFeA+AYX75F1DdyAqOyY00Jkst1Q5XWGX0F8abOBI X-Received: by 2002:ac8:5782:0:b0:403:e841:66f8 with SMTP id v2-20020ac85782000000b00403e84166f8mr13961718qta.43.1692111286199; Tue, 15 Aug 2023 07:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111286; cv=none; d=google.com; s=arc-20160816; b=cYZCYowabqACZJ+XkmFohXDnlT3Hyoi/A2KDQviCSMF3J/atLg6SG6fxXJWASxlXpo 4gQXyJ1QX2xlGZS6R1yGtFtDNAP+u2eXpwoPpgN4HHoZAwGj3s5QUXgpBYTQSUBCaHer UydhlmknGx4wUZvabC673IZd1w3LYZ2DGrsPoQ8wWxAeOm1Fb4KymvlDHqBZ8JfBNE2T PbkToqEt0EyKsmte6QyA+WqYTuBWgSoKcpH3lXVIGZy4az5v62yWqt0RAUsOtIcUOzfI m8M0ZDYiHjnTMoZTuLs+vFE5/r+QgjTZ1ObvrBAl3vtl5YJbzl2QRNSv2lWktlhty4vo hjCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i4cgTwYKmgY5S8ywczpvEN/MK3kalEN3O1n5Lxh3nkA=; fh=04/pGBQSKxP/VRM1dOX7r60Lg6gNaLrLAuVAoZSSo70=; b=zc1LxOKZ3JgTnauM7l6m9xr2YCNA/i1bFt+8KpmlIhCBfpu6+cIc46rWVV9SXg+a/H lMvdxWHj2KdEcQ86ZdMlgEnGdPw7NmUS3bfKPQ472xX8aruYJkcoVNKVttJsuinD5YBs IB/XZvutLGZ9B8a+gwUzTg3VVtzc4VhWbO2EFeQWjAw4Ov7YNoCQ3SV3bieKd1l6DKHJ MsPPfL+J/TFF9I4fkYr0ENlY0QiHXcuGdjhbeUlDm2P2ZYOS2TnD0eoRycf7yC9ocLmN yNsdbaRGXArP3012dUfw9DcdwZJul1/xJBRNK5bGjyfvPQasTzeKmIDkkAyO8YCSNq92 OLJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BrdDVthi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m19-20020a05622a119300b00403b444f449si7644149qtk.419.2023.08.15.07.54.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BrdDVthi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOZ-0005r9-IR; Tue, 15 Aug 2023 10:51:43 -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 1qVvOX-0005q4-LD for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:41 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVvON-0006Ga-8o for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:41 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fe9c20f449so20704625e9.3 for ; Tue, 15 Aug 2023 07:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111089; x=1692715889; 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=i4cgTwYKmgY5S8ywczpvEN/MK3kalEN3O1n5Lxh3nkA=; b=BrdDVthiAHhSVisg3dOEAFtQnGdwDRYEkYBydduol8IfF9Yo2MtoCcBWVVFDqGpNQ1 ed7VUxvzzjQ+/rl0Qim9Lced3x62P4YxyX0pkbhEjWAks1jP/5wu+jXKq6ffObXiLg4I YcI126Ku4r/F9pBnM76+iFdU7Bj26wAP+B+TbEavFrRXW3k8upF6cih1XhK24zPNZDOV qVDFZa+GdUa1AcYA4lIk7rpfMM64uclh9JYmS2BGBPVLh3qHGWtCrTAJD42drByV/rRq ZXhVive6SdIMq4aBuTVU2ILgB+ZZAeC34lvw2Y3cyF0oRTAlJdocR6KyBMmxibNw6Fvi pAnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111089; x=1692715889; 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=i4cgTwYKmgY5S8ywczpvEN/MK3kalEN3O1n5Lxh3nkA=; b=CmvtIllW/G45PTM4bpckO7YBJNYDgDjLQk6PfkCwf5g8bYxB2Xh6X8OM1ABlHlG7mD 7zcPngNUTnlqsmsF49VPKUnPr9GG1RIEbQ7u0LDRAUQdmmDBYDjvgaTbKGk1fU0LluZX /pqxguTaxOl0AaZuZET8KmohzVCCqlkWCvQMD4n7kDHyjXTq1+hevEV+uAJSDm7W1an+ cwIlK6xpr5DQ+hRT5UNoqX9/NWAL0WwRWAZfsGkokWNXYgT1Ui9HOaJEo4zLlz7EkDNR Wi1wgfna9s/RS7AZWulINEtaWnhaLpeXX9mTl/j+C5fahLme5qjwRNmHR7M6hhQKiBbX NXaA== X-Gm-Message-State: AOJu0YzxOZIqgVth3g7O6MrP5iFQ9woz7GqeAF7pZZU4naUP1tQOj8St 9JB1ZYD63C5f3bv7HXsEWtz3rw== X-Received: by 2002:adf:f104:0:b0:319:7a72:5d80 with SMTP id r4-20020adff104000000b003197a725d80mr4283559wro.51.1692111089626; Tue, 15 Aug 2023 07:51:29 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f9-20020a7bc8c9000000b003fba92fad35sm21126516wml.26.2023.08.15.07.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:28 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2B9F01FFBE; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin Subject: [PATCH 3/9] tests/tcg: remove quoting for info output Date: Tue, 15 Aug 2023 15:51:20 +0100 Message-Id: <20230815145126.3444183-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This avoids ugly multi-line wrapping for the test on non V=1 builds. Signed-off-by: Alex Bennée --- tests/tcg/aarch64/Makefile.target | 2 +- tests/tcg/multiarch/system/Makefile.softmmu-target | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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=fcvt pcalign-a64 lse2-fault fcvt: LDFLAGS+=-lm run-fcvt: fcvt - $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") + $(call run-test,$<,$(QEMU) $<) $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) 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=untimely-packet.out$(COMMA)id=output $(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") From patchwork Tue Aug 15 14:51:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713777 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1822365wrp; Tue, 15 Aug 2023 07:52:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9rbuJZd5k35Czi3ONpUQb257CmMogAYc+0nlq96uHX2lCXhvDkGTnTc9x3vZlFSXChSMP X-Received: by 2002:a05:620a:460d:b0:768:3975:6b5b with SMTP id br13-20020a05620a460d00b0076839756b5bmr16487161qkb.34.1692111151441; Tue, 15 Aug 2023 07:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111151; cv=none; d=google.com; s=arc-20160816; b=mcoVyk1JUEPYAnU8cjvtA1LsaY0xWoJPeiEbgmRgjOkRSkDgq12+aZldEfa8VSyi5S /qwSbsG7pzydPE0PqIR/XUBSqaYodhanspNyWWrkY2swztMhsq+kwlvA6duAldFbwz9G fL2OopdOE5p52asu2eTor4LM03erUDA0QhSVHxiS2tfNa6Yt/VsTdfWqBWrgQYh3WI98 FFMBJ9+8btdWKEG8qn+UMs7qTUXo3MUEu4eqql0ozU4IQrVuGxWSJPz8vs9rmGQIef4e vblifSIVH6OQEGHOZIse9uQYT2jHlumA/aJOCPzTmccMubd9/Q2Ab74aEo0PLiXrVs+g FRwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HWAw3yoUeeJNMPe6CX9phpQMFB1kiw2oQRZp+zWhjgY=; fh=04/pGBQSKxP/VRM1dOX7r60Lg6gNaLrLAuVAoZSSo70=; b=wQoou/Rb7rJ88CqB57w37GXxoNVxq4ODZlnPSKNHF0X7yqLiFYm7M2v1BFkkSVF1E6 gk1Y6A53FptyoaCoTp6cEizaLhOMXScSNOPA0p8rK/J0VVTM07o4BV8jjoZOEIVFC0k+ Hlx8mmSEsGlZcmNrbdybFNB80rOPEECKxqulzLpktv9pfX5DFaf6cVfq+YRSGaVzlD+W ua/4BL+zXmGXx0nzXusq1FCaQUD/osScbA0wNI4FONflmc6tC9ZtCc7nP8Mx2dvsMVx4 vnW/6cWxr79QvEFMBHYppdDyibZi9e5uUu4zeGSFnfUi0PTVFGIb0MfmzpBCUkmTAETm S2cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iw92sg5Q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k6-20020a05620a414600b0076cb9d1d455si8055328qko.355.2023.08.15.07.52.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:52:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iw92sg5Q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOW-0005oP-K1; Tue, 15 Aug 2023 10:51:40 -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 1qVvOV-0005nL-0n for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:39 -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 1qVvON-0006GT-0O for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:38 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3178dd771ceso4894230f8f.2 for ; Tue, 15 Aug 2023 07:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111089; x=1692715889; 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=HWAw3yoUeeJNMPe6CX9phpQMFB1kiw2oQRZp+zWhjgY=; b=iw92sg5Q396RUvPqFZbgqMBDmpmd0ZPXVLVFJjP2+IFOloitGJdMWgc0ZcDX1eMf8p VL5SPFSm68IIksdJ3O5ZuaJl+GBSYLDGJ5tytMXUCvNPQUPq3fWhIRgSCG7SuJB9h0CK 3HR+bhxwA8gILmhh43ViIRTXCQizNZCRYI3Bk484ceZhV2r+NVCRERn5dRJ4DAoSNxnn NE0XN9UuoLew2CjKXjoHsV5RcCTpmA0rxJ54n2Z0TYqGLOKM9sny3MXIbWA4y6SKhrCl ZnU7y6xU/s5axNEsa/YhMN+xRMmc/vNah5EoUJ3AHSpsV8ohhesOxWZCbLXru/yECJSn V0RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111089; x=1692715889; 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=HWAw3yoUeeJNMPe6CX9phpQMFB1kiw2oQRZp+zWhjgY=; b=Q3Sz2g8159QcxYFtc08eDE+vM6UwrSYjq5WT2/6GPcwwNEIr9v8vV8KBuhsc27ZYxv f9581r0LM3c30CpRaMkEOZkNlwxMVIvpvmdwtj+vdekIW17J0U3fyHyoPM+fu/5a15ro yfnxAzvi4OSlg1YdRHXKqfi/iLIetuhnoi8wnMqGOXfhV8e+lDTALldVARNnT7jCdvPp dLRbtq+wETTcUn68hM7G6EZkTW2zdtdVx5y/MQX9ZRbFdiyEMe9CV3sh+FCC1jEZCYxT sQ4m0n0UtWEiJ+tGnMEjajsEvIBzkcl/yBJ6tcaO0ieaa6FaKNDFh/kCKZR+NMmhgA1k LUbw== X-Gm-Message-State: AOJu0YzH19Xath9AGwW8ahvmsF2C8pzeypmkrbGyci90Jt4E2R6+nC3y v0RMeJGSKM2yN+fLmSBEej2W0g== X-Received: by 2002:a5d:44cf:0:b0:317:731c:4d80 with SMTP id z15-20020a5d44cf000000b00317731c4d80mr8836991wrr.24.1692111089450; Tue, 15 Aug 2023 07:51:29 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id e4-20020adfef04000000b003196dba130asm11100062wro.106.2023.08.15.07.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:28 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 43ABD1FFBF; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin Subject: [PATCH 4/9] tests: remove test-gdbstub.py Date: Tue, 15 Aug 2023 15:51:21 +0100 Message-Id: <20230815145126.3444183-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. Signed-off-by: Alex Bennée Acked-by: Ilya Leoshkevich --- tests/guest-debug/test-gdbstub.py | 177 ------------------------------ 1 file changed, 177 deletions(-) delete mode 100644 tests/guest-debug/test-gdbstub.py diff --git a/tests/guest-debug/test-gdbstub.py b/tests/guest-debug/test-gdbstub.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 = 0 - - -def report(cond, msg): - "Report success/fail of test" - if cond: - print ("PASS: %s" % (msg)) - else: - print ("FAIL: %s" % (msg)) - global failcount - failcount += 1 - - -def check_step(): - "Step an instruction, check it moved." - start_pc = gdb.parse_and_eval('$pc') - gdb.execute("si") - end_pc = gdb.parse_and_eval('$pc') - - return not (start_pc == end_pc) - - -def check_break(sym_name): - "Setup breakpoint, continue and check we stopped." - sym, ok = gdb.lookup_symbol(sym_name) - bp = gdb.Breakpoint(sym_name) - - gdb.execute("c") - - # hopefully we came back - end_pc = gdb.parse_and_eval('$pc') - print ("%s == %s %d" % (end_pc, sym.value(), bp.hit_count)) - bp.delete() - - # can we test we hit bp? - return end_pc == 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 = gdb.lookup_symbol(sym_name) - gdb.execute("hbreak %s" % (sym_name)) - gdb.execute("c") - - # hopefully we came back - end_pc = gdb.parse_and_eval('$pc') - print ("%s == %s" % (end_pc, sym.value())) - - if end_pc == 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 = gdb.lookup_symbol(sym_name) - wp_addr = gdb.parse_and_eval(sym_name).address - self.wp_str = '*(%(type)s)(&%(address)s)' % dict( - type = wp_addr.type, address = sym_name) - - return(self.wp_str) - - def __init__(self, sym_name, type): - wp_str = self.get_wpstr(sym_name) - super(WatchPoint, self).__init__(wp_str, gdb.BP_WATCHPOINT, type) - - def stop(self): - end_pc = gdb.parse_and_eval('$pc') - print ("HIT WP @ %s" % (end_pc)) - return True - - -def do_one_watch(sym, wtype, text): - - wp = WatchPoint(sym, wtype) - gdb.execute("c") - report_str = "%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 = gdb.lookup_symbol(sym_name) - - def stop(self): - end_pc = gdb.parse_and_eval('$pc') - print ("CB: %s == %s" % (end_pc, self.sym.value())) - if end_pc == 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 = 0 - for i in range(3): - if check_step(): - step_ok += 1 - - report(step_ok == 3, "single step in boot code") - - print ("Checking HW breakpoint works") - break_ok = 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 = CatchBreakpoint("run_init_process") - cpb2 = CatchBreakpoint("try_to_run_init_process") - - print ("Checking Normal breakpoint works") - break_ok = 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 += 1 - import code - code.InteractiveConsole(locals=globals()).interact() - raise - -# Finally kill the inferior and exit gdb with a count of failures -gdb.execute("kill") -exit(failcount) From patchwork Tue Aug 15 14:51:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713778 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1822366wrp; Tue, 15 Aug 2023 07:52:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDDupUX7hEXYByJ0UJkn4Xkpm0U0KV58MDiBOM3QFmVT7VOdNtIXFiiAf7g7dHPr6rMNCq X-Received: by 2002:a05:622a:1c11:b0:405:37db:808c with SMTP id bq17-20020a05622a1c1100b0040537db808cmr14875753qtb.64.1692111151598; Tue, 15 Aug 2023 07:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111151; cv=none; d=google.com; s=arc-20160816; b=JxSMMW7GV34ClQw70kNNnBOg6fADdaPIHk9ICIwDxY4WfN3vE8I/0VbptI3BefCNR1 vZRYrYGFr2iWpYFRiCnSfJWnfR8jlo2wAQlxjJXc4CFZS0EK44WbJsA+Mfg1lMwI9Wua 0+MNf5vwHAjEZEFVpWDsUZwrAzhbhEgR1VruktORox029Pyd+HrQURc+gRqv/x8aGUjk qcEZLSeTJ7NI2zyupNomqV+ero9OfP2mdh9PIfgqUS0BM6s/qFg9pG66TJXY8/hwA4El Hv1veTFd6Pn89yYQSkP1Qk5ZI6kASF6fzh17hyYiOdnPh9/9hWTqvrFl8ooPZStARTaI Cesw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R4o5KcbHxCMMudk1ebQJTS76ot0MvKIvT2lcoqReshg=; fh=04/pGBQSKxP/VRM1dOX7r60Lg6gNaLrLAuVAoZSSo70=; b=cv2teizm7kbDANC4esEBAMEDv/emU9LV0Y/VYVtOjETP1su1XgxNhuQZBflN8wGvny dLBCL7jepazGNsd+ac2zkC6jUAzdAiZYTfEyUrMeAJ+336FzUu3TI5VBlw/aFRsNImnQ u9LMtN/F+YCs+5oV+sqw0yvFGIeE/fUCthPCc3LGqmDrJVKx2bi2Gsdb0kSXN+daM2LQ wdfqcMHrskuyniqJRyVO+bO4rcFIvWDCope5ZAY/gW7qa2eM+h/yEgS7Zm0v6nz3DBgi 9/3/0ghjmb+a+KVp3z2lOqYBmyKJrdihlQl69pAEpGBiipFTrN3iJQygEuYdpAOLAwrg UV4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mYFJXESh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j7-20020ac85f87000000b0040d2558b23csi7446164qta.462.2023.08.15.07.52.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:52:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mYFJXESh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOb-0005sa-OR; Tue, 15 Aug 2023 10:51:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVvOZ-0005qm-BL for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:43 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVvON-0006Gd-Fd for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:43 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe426b86a8so51358185e9.3 for ; Tue, 15 Aug 2023 07:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111090; x=1692715890; 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=R4o5KcbHxCMMudk1ebQJTS76ot0MvKIvT2lcoqReshg=; b=mYFJXEShs/bXqyTd23fF/z9+WYUilATbKZ1UJQ7i0wQERf8EpTeh+d8NAbj14hMvyH n9UbxASPv0JFeY5JGN/E7KudCZR9+15xpf2yVOZM8mSgYF03wqW1KXXUzK1v/FKSgNMq mjPt1ZpyEYxEVtgUzspHN3p/Zba+RITUpLYWEHw6fmZbGhmDSvkal9j5her3In5ap1OJ J+2C+hoFIUgnsQ6T2K2Mj18UrIRZzWUnA/X+gFXtYte4IgaEq0pKy5YSbNeEXGlVxEFC u+lggP+asER1tF0GWlRGtkDgQWXfx982lxwP2m4tr9t3GXMdt7LiT8IjM/CquNdIp96r evDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111090; x=1692715890; 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=R4o5KcbHxCMMudk1ebQJTS76ot0MvKIvT2lcoqReshg=; b=L42AFEPRJ+gN0UgkxyU5nfgC4P9OxrYVkekHwHvYUzzgGjmV7vXQWF3AcznhG6GwRo 4HJ8vKyg2jfdNknCw7tX1JK4Js6rMMKzfFw+2DfU8yG5gSqMsvk9P9qUIMn6YVn/zhyo GAnw82tysaFQJUkkcIE8meSRX6HT2rUBfF2KpeXZ7zFHcaEd2CHfdPWVCx/GNKeMZyCO 74F/bNkphWcAY0ItT11lcKFm7HFLTctb/avOmF/hobXRVoJ1DHcBoIrp7TDPzCSaEOYx OlVqgvR4Pp2kyfKENKIWpvWEJSCTKZkV8cX8Z3UrhxxoUFLdJfwQ0LZXS+EQpu+ActF3 erIg== X-Gm-Message-State: AOJu0YzDVJzGAVHuLEzKKWyIn0mouk6ZMX7BX58alx69/nmFT6AvA1ln IM+Xzr91xR8EGWncaDf5hJme3g== X-Received: by 2002:a05:600c:292:b0:3fb:ef86:e2e with SMTP id 18-20020a05600c029200b003fbef860e2emr10888035wmk.19.1692111089823; Tue, 15 Aug 2023 07:51:29 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f9-20020a7bc8c9000000b003fe20533a1esm18241765wml.44.2023.08.15.07.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:28 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 73DB51FFC0; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin Subject: [PATCH 5/9] tests/tcg: clean-up gdb confirm/pagination settings Date: Tue, 15 Aug 2023 15:51:22 +0100 Message-Id: <20230815145126.3444183-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. Signed-off-by: Alex Bennée Acked-by: Ilya Leoshkevich Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- tests/guest-debug/run-test.py | 2 ++ tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 3 --- tests/tcg/aarch64/gdbstub/test-sve.py | 3 --- tests/tcg/multiarch/gdbstub/memory.py | 3 --- tests/tcg/multiarch/gdbstub/sha1.py | 4 ---- tests/tcg/multiarch/gdbstub/test-proc-mappings.py | 4 ---- tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py | 4 ---- tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py | 4 ---- tests/tcg/s390x/gdbstub/test-signals-s390x.py | 4 ---- tests/tcg/s390x/gdbstub/test-svc.py | 4 ---- 10 files changed, 2 insertions(+), 33 deletions(-) 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 += " %s" % (args.gdb_args) # run quietly and ignore .gdbinit gdb_cmd += " -q -n -batch" + # disable pagination + gdb_cmd += " -ex 'set pagination off'" # disable prompts in case of crash gdb_cmd += " -ex 'set confirm off'" # connect to remote diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch64/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) 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/gdbstub/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) 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/gdbstub/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) 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/gdbstub/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) 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) 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/tcg/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) 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) 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/s390x/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) 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) 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: From patchwork Tue Aug 15 14:51:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713780 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1822542wrp; Tue, 15 Aug 2023 07:52:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFyV7zDMSPYy2Xl1SDzG6TODhSlZkv6fdSyBIcR3+jd+VOku16I2xybQuw+9bboBJrsSSL X-Received: by 2002:a05:620a:2947:b0:767:96e2:7dc with SMTP id n7-20020a05620a294700b0076796e207dcmr19311105qkp.49.1692111178624; Tue, 15 Aug 2023 07:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111178; cv=none; d=google.com; s=arc-20160816; b=QYc/aVdrszXn4ZtPPvB6IcRS+gpynULl/TBD+WIihupK9iZM5Sac9P7Xm2uLqIRpUk IG0IdWiPuk+RioENuVARBkcpNTOb1CPGSolQSD/wPQauetOT4dEkCz0K410yGoywNbKQ ynnQREGcyX4aaSD0zYiwEQpDlxWMZ1teoytLa6WJkXlJOw2F5gCRTyqQBe/iswwirkXa TX6B1o+9J6J6UMZ6XGxl5W9tOwfiEdF3+4wtwErVIEh+VgFsqMzeVsora8Omj3N8fHFp nzjpX79mdp0rGikCIJfFGgmzjkssVp1YgxIjtfyBMkbZJOVx1MUGNv14Ks2+O4ZgX2Ga 2u4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M3HpoGymUAOECIzpXws+SoFW7NCUK3OvK2CLae4WjpQ=; fh=tVhfvX9jRNWNImrTZT87TccK2g9bXygm1TjZiFHZeyU=; b=a+W1oe1fD5xJTOV81B8Biq15lO98l5UfgVzscWtLJFk06toCXCXi2Hnh+9/hE18JNF qSpnSRtze2RsJHY+e9IxY5+Pobdt1CCYigaW6Bk/1SKe6vtVG4UX5YgOBkFaAbQGYuuW 91agb9mF/FXCdugOc+1ZgwazVX46r+wp0id3Lvld5WNIkqAx9kSaxrHj13niS6omr3jO AiVbex2meJUz2q4mPkBADa+sBLymhy5v9JvuwWadyLaAmEghDYJu7ussodUG/Bq16cBS AAF0M4gFJGx0oDckBVg6Es8WGV9AlWQSI4gWkvxn5XopoJC9BvBCppzr0pU0x6g7LhQi fUng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=alVphEyV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s12-20020a05620a0bcc00b0075edbbf6eafsi7051209qki.558.2023.08.15.07.52.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=alVphEyV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOz-0006Bq-Qv; Tue, 15 Aug 2023 10:52:09 -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 1qVvOe-0005uR-Pc for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:49 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVvOP-0006HD-TP for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:48 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe5c0e57d2so49783405e9.0 for ; Tue, 15 Aug 2023 07:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111091; x=1692715891; 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=M3HpoGymUAOECIzpXws+SoFW7NCUK3OvK2CLae4WjpQ=; b=alVphEyVb2e4Bwb1mmqTovtrVe+D3Z31OQ5ctmpwVnPX5ixRpyjRktBKKPsmDnqrDk EkWAOQ7BlmhNWnBsjo3TOmSXZtR410ILogPvbUrF7fvHiyqYOLkMlSMBEPu4GDTNdm+C lzSVEEJQVPYaIBTOrrqzbXxpBl4LCLn2n3RZEibtWVvuf+CpS5+DYJcqz0O1kOd9tEby 6XhFes+ntuPeKJkXzJcSGIZihoqSxrYcoDRfs3t6gvZAYp5O8jPkkOJ/STFUUqPMsG8E VgijkWwXzhCBZQRkR8SikcT22zcc9WKCZTIDHAl1kHROYb1Rm7X8qzqpg6Q7rjCpFYR8 0bag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111091; x=1692715891; 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=M3HpoGymUAOECIzpXws+SoFW7NCUK3OvK2CLae4WjpQ=; b=QmTVxnqr0vTRU5JKOdgdwZmev5F8DXKZfHGcBDd8OHNDrrG/qwFzOXFKYksolEt6W6 4oSUr9MbfSRlBJ7FxRNzvP6AtT9Y2ctVvvs6CIvLqR2jYEP3I2+S09z2n6JQH69YloeO IEE6HY/OIYaGgdFlWaJ3auQhqqyRi9VFMcJWaaeTYCpZH6dptBcvOQKOZgBkhWQjwsv3 QFTkVo4/Llri7BBSMLAROulkhKtSIHtjPyHybCdVasjPxK/z0jqbcpac7MVc44kP2nUx zVw6jdyA83eQsFVMRZtlNug43D5dsW3/5gefE46140SjXuFV3gFdnICOm4PO+xC/XU8e 4uGw== X-Gm-Message-State: AOJu0Ywd6mlQaotLFPJ4wVhV15IKvRcnqPnpO38tWJUw0Ffc++Yy/jtg KulA91IGxWeyZYW7T/71np+xTA== X-Received: by 2002:a05:600c:6002:b0:3fb:be7c:d58a with SMTP id az2-20020a05600c600200b003fbbe7cd58amr8922041wmb.26.1692111090879; Tue, 15 Aug 2023 07:51:30 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id h5-20020adffa85000000b003197efd1e7bsm4856616wrr.114.2023.08.15.07.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 92C281FFC1; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Matheus Branco Borella Subject: [PATCH 6/9] gdbstub: fixes cases where wrong threads were reported to GDB on SIGINT Date: Tue, 15 Aug 2023 15:51:23 +0100 Message-Id: <20230815145126.3444183-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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] Signed-off-by: Alex Bennée Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1725 --- v2 - fix up some whitespace --- gdbstub/gdbstub.c | 29 ++++++ tests/tcg/multiarch/system/interrupt.c | 28 ++++++ tests/tcg/multiarch/gdbstub/interrupt.py | 97 +++++++++++++++++++ .../multiarch/system/Makefile.softmmu-target | 12 ++- 4 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/multiarch/system/interrupt.c create mode 100644 tests/tcg/multiarch/gdbstub/interrupt.py 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 = 0; + + /* + * target_count and last_target keep track of how many CPUs we are going to + * step or resume, and a pointer to the state structure of one of them, + * respectivelly + */ + int target_count = 0; + CPUState *last_target = NULL; + while (*p) { if (*p++ != ';') { return -ENOTSUP; @@ -637,6 +646,9 @@ static int gdb_handle_vcont(const char *p) while (cpu) { if (newstates[cpu->cpu_index] == 1) { newstates[cpu->cpu_index] = cur_action; + + target_count++; + last_target = cpu; } cpu = gdb_next_attached_cpu(cpu); @@ -654,6 +666,9 @@ static int gdb_handle_vcont(const char *p) while (cpu) { if (newstates[cpu->cpu_index] == 1) { newstates[cpu->cpu_index] = cur_action; + + target_count++; + last_target = cpu; } cpu = 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] == 1) { newstates[cpu->cpu_index] = cur_action; + + target_count++; + last_target = cpu; } break; } } + /* + * 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 with a + * correct value. it doesn't really matter which CPU we tell GDB the signal + * happened in (VM pauses stop all of them anyway), so long as it is one of + * the ones we resumed/single stepped here. + */ + if (target_count > 0) { + gdbserver_state.c_cpu = last_target; + } + gdbserver_state.signal = signal; gdb_continue_partial(newstates); return res; diff --git a/tests/tcg/multiarch/system/interrupt.c b/tests/tcg/multiarch/system/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 = 0 + + +def report(cond, msg): + "Report success/fail of test" + if cond: + print("PASS: %s" % (msg)) + else: + print("FAIL: %s" % (msg)) + global failcount + failcount += 1 + + +def check_interrupt(thread): + """ + Check that, if thread is resumed, we go back to the same thread when the + 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 number of + # side effects on the gdbstub's internal state, since those may mask bugs. + # 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 don't + # have to worry about anything else, as this function never returns. + gdb.execute("set $pc = 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 == 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 = gdb.selected_inferior() + arch = inferior.architecture() + print("ATTACHED: %s" % arch.name()) +except (gdb.error, AttributeError): + print("SKIPPING (not connected)", file=sys.stderr) + exit(0) + +if gdb.parse_and_eval('$pc') == 0: + print("SKIP: PC not set") + exit(0) +if len(gdb.selected_inferior().threads()) == 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 += 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=$<.out$(COMMA)id=output $(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=$<.out$(COMMA)id=output $(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 -MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-untimely-packet +MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-untimely-packet From patchwork Tue Aug 15 14:51:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713784 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1823206wrp; Tue, 15 Aug 2023 07:54:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKyDHWXt/S3SF/43rnrnHMjuJTic5Z60WqOcn39JAi6JKKEfQ5/d3bQIVKa6Sg3kWENOYx X-Received: by 2002:a05:620a:63c9:b0:76c:c68e:8f46 with SMTP id pw9-20020a05620a63c900b0076cc68e8f46mr14231066qkn.40.1692111279549; Tue, 15 Aug 2023 07:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111279; cv=none; d=google.com; s=arc-20160816; b=cWryKDEKDyUZDmlWW13QNH0IdYPFycYi2i6crQPVioV3usTq5XhcU51g2CFBbhL9lM 7VJM81MRqQsGM8mHJQCxs+klJmi8+uVU92gX5WPFWzHmEbdx4bPUZ3KV/56lP8Ez8VJ8 BNC+3s2rhE8hH6cG44p/AArqvNTjC/rMhw961OWmrW1KZR7nTLhHJWeMR6baX6hi6NiR v2pcF8gG1W6iTXdfB5tlgH3izudLrLka305DImJJHiJ2WdnuN5womwKVX0xzr36Zngn4 If9noCwd8T0pHC7viNgJEF42WF0ph2hOAZ7ktwN3oMdUsVaGk2LyAwWAn4iPDohBn2n1 3vyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ogCxZYZaoEvrj5iiH+2Bm7In/45Ks3iQ2LZbKz8QbrY=; fh=04/pGBQSKxP/VRM1dOX7r60Lg6gNaLrLAuVAoZSSo70=; b=YbvGX3HXwy4nTtM6wGRHB9PzaBxQCVB7T95brDhJhAbd3P6GPQMJw/qtObNaHveRGh ZSaNDOt9VBZHLF9ixCHyIOAUEhjLM3FFgbM3CBaM5QNR2lwlOk6uEwCZKMmDHxFLcmuy 64bOO702+SF8pbkqgGsFe0jvtVE2Pj6btdDg1A8azoIwST93itc1xYB5EzDqgaBD/zm+ gewuWvUu4vlfrkA3mUdYiZ4xyQVUKfFPZbFkUaJU8c7uwpUI9tebucPYSb/5Z+lX1eul 9TSZSjGHx5E3/NPQO8NjF29zcfUX7dosN3QDxaD0JHEEsnifcJvkmxX1Ni1AW1y5wrX8 PJjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nS1/AUa7"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j11-20020a05620a288b00b0075cd3df8118si7592921qkp.603.2023.08.15.07.54.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nS1/AUa7"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOh-00060H-Js; Tue, 15 Aug 2023 10:51:53 -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 1qVvOe-0005uL-4C for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:49 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVvOP-0006Hv-Ry for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:47 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-319779f0347so1746152f8f.1 for ; Tue, 15 Aug 2023 07:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111092; x=1692715892; 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=ogCxZYZaoEvrj5iiH+2Bm7In/45Ks3iQ2LZbKz8QbrY=; b=nS1/AUa7SSvoR5HRTqpZklmBo9ckwFTBprwIE08Zq+51uaCfrjz9YFA6dZedBq8I0w yukVKe7HPbXGbYeQd8+2PidtHtqu7O2hzyx0EjB0ld9fn91MWfblvdPd1EPWTcEo6N9L YjfBnCxx2CeIrPkDY2V2g5BUHZ48FsWbOSlTlF7cQFOjjYZEJVtvXEKmBzYEq+NSP0su 7ncXOHB42IEwz4VfaoFnQFSVuufFvYbq43BLwB7Q+PcKlgjZLLrW5O4D9mf2f4SSGN4E 9EzVsRMt6HKLM8mVn9c2/WdVd4lBH0beVRF+HkDp7hy3CGv4sw1xci8bEyPNPcpX9QlP dfgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111092; x=1692715892; 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=ogCxZYZaoEvrj5iiH+2Bm7In/45Ks3iQ2LZbKz8QbrY=; b=iBH5M1OiOWBSOJvxWAV2N3tXg+lt53Ly+mrRwLf5GmSJrh/HxwpTqnVQni4pGN0Vhw Js8UHIrwt3oJDEx4dRNy/7mvzCoPR250kz4oA5ANxVxbFraWjyGOTrORJozsvDqZSl6+ maMj5Wk1TeF01DEcsv/ROkxWaD5W00BaCSeyAv9pD5HLUrjqTOftATPxuxddDNmWDgKy RhiHdcNnq1WXro6pwpMn3rmvtOt0cI1mcOWIsmk4eYSqYC3h7eZOWebms+MQXWl3WwAh wWCQt+nsruBD6FI0+2eHbuRQsr1xgj2toBzPp6ogQfFEtZEv2qG7cHzvi3qNR/Ev/z4Z 9e+w== X-Gm-Message-State: AOJu0YxtpsSMBp1NK80/o2Ys/Ueq80Nmrckf3kMzDxo0RP+O9/PdH3kP hCc8Ft6nrPcwFFglDQ8PKCkUHA== X-Received: by 2002:adf:f80c:0:b0:319:8979:8fcc with SMTP id s12-20020adff80c000000b0031989798fccmr908216wrp.70.1692111091915; Tue, 15 Aug 2023 07:51:31 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id f14-20020adffcce000000b00317a04131c5sm18148968wrs.57.2023.08.15.07.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id ACABC1FFC2; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin Subject: [PATCH 7/9] gdbstub: remove unused user_ctx field Date: Tue, 15 Aug 2023 15:51:24 +0100 Message-Id: <20230815145126.3444183-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This was always NULL so drop it. Signed-off-by: Alex Bennée Acked-by: Ilya Leoshkevich --- gdbstub/gdbstub.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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)); } -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 char *data, } gdbserver_state.allow_stop_reply = cmd->allow_stop_reply; - cmd->handler(params, user_ctx); + cmd->handler(params, NULL); return 0; } @@ -881,7 +881,7 @@ static void run_cmd_parser(const char *data, const GdbCmdParseEntry *cmd) /* 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 *user_ctx) return; } - 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; } - 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; } - 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 *user_ctx) return; } - 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; } - 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(""); From patchwork Tue Aug 15 14:51:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713785 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1823215wrp; Tue, 15 Aug 2023 07:54:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrxIQKbKhv5WOTeImisAUOQod+Zm5Ib/HaSYT0wFrwtVojc1vywM3cnRLFTyXtnRPEjtHH X-Received: by 2002:a05:620a:4083:b0:767:f178:b571 with SMTP id f3-20020a05620a408300b00767f178b571mr2700328qko.10.1692111280513; Tue, 15 Aug 2023 07:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111280; cv=none; d=google.com; s=arc-20160816; b=i9cMqyWnX8ku2JqdYtPEfdVoifgkASLJ3c7KKV4hwTzWhkg96b1c6YsULtth2IzdKA FFlN1Vajw40Vp1k8+r1NjcbojAlp48qYHQiAkKWbI6u1pFfYqXSH6RNcPOiQHkSgMZk3 2+mM3JTH1ig+52vlAgfBWsVIvLq45IS0DQi5tadmro8V0eHq7H6OG8Rn6lshhTL9KKe6 0fun0p8BIdlsWGl3kFopRGmVazZGdJCr9A7YGvelx82BCJjZmdbBvcpmIGrfTefEzuZz iy+nYkRCjPrSZzcsRMj5gve5wqg2e1k9W1z9kcND/z/eAgtbwYQQNeo88QamOzXdJFES 7JWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=33wawR2LWoaAut+i9ZrgbT27fp+Dc7BzTfoXKJW1L3U=; fh=04/pGBQSKxP/VRM1dOX7r60Lg6gNaLrLAuVAoZSSo70=; b=vei5HQ4t844UuUUqD3Pb2FGN9a2eW2+O1H0cW1H+HzGddohU5DoWEIaLI49QEAyMAu AnGIy+xyrSisF0BKZ/SyDMZcfFrZvtNxtiI0YsiRLhinSZGYDyv8UBAH7GXBqVv2gcxs YjRfg8rLgSvNw/JLUf06grZvET19i4XjZRCS1n39oV/GM5VTpsd9um8ZTRlI9nASKv0O a/g1Hpz6Xa2h4CCNmfz+cic01tfJPJhrzkwPD9ltYPe77LxAQ3hzKMXOKE+V15YhsToS ajP/s8SmWCEcCAaQLsCc5rZfp75aznnaFjWQ5WgPOfDmLo9HdhA7ooJqg2A9ILxx1p4S h+FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eIHHwVeT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s12-20020a05620a0bcc00b00766534d6a57si7630015qki.520.2023.08.15.07.54.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eIHHwVeT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOn-00064A-Oy; Tue, 15 Aug 2023 10:51:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVvOd-0005uK-Qo for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:49 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVvOP-0006I4-Sk for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:47 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-31965c94001so3072417f8f.3 for ; Tue, 15 Aug 2023 07:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111092; x=1692715892; 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=33wawR2LWoaAut+i9ZrgbT27fp+Dc7BzTfoXKJW1L3U=; b=eIHHwVeTQPuAcSfKRmsKRID5y/XpQUWI2xgmcMSXI24nWBNsBpp/Adco4lB8gNpSaM eL8WmafJs0spUViBPZ2xRXdl5bxxM0Gth58KXcBsdjsPb3M7Bg99+pWW2dSSh8aijYjM q/JwTOKmy3s3IiPU0BHtdT2v/W20PdxquOgC7LREdDvLR+Gu/pSiA2GdcvdeoExyrwWS zvtyb7XJWzJCUfD9WOf+jAVTA/D55v8nLDHvI7C7+12Fx0fjnGrBO5LCfdur84d/Rrm9 coiTmnOAVE1uORun3dx5/dR5XjK35pZxJQQ98jP0hIXgQNr1ZitvAcvfgh+Vsd11FCYX oYEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111092; x=1692715892; 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=33wawR2LWoaAut+i9ZrgbT27fp+Dc7BzTfoXKJW1L3U=; b=LwX+7HpAegv28e0/I9kbtSHaoywn9YZMG6mZjdeJIoDOw4Z6aL9iuLYU5/4to/voUw /S9wLW+jO2PpDo4ebklCZrFLgOr4tfOCAPh6VvTv0GfzuLATEnLW9qQxxv0QgDxxXP7r xcqcKdoU97Oz5d2dvkDbO9qpQ62BWMZGP9sQOq+Lg4Te0hCBo71vOtYowfJIUdPNPSbX ZycJgEiILhpEe1JipCpGaj+Q7tYFAPLe0BtAKfOvJxMzTXjko4v/WkRYfXWwZE1SEcew 5eXJPlOarJGJ8QD/PAfav36IQlHaetoZ2La4ziLA7uIOlB+QaOumy6U23VTjCf0OaQst 2Alw== X-Gm-Message-State: AOJu0YwS2i2CGSQUgW2ocC6YTo5I/u7NxLwDwk/4CaMtGSk3s3OZ8bxC fw0ru8IzgDvU5rrDiiwulgU3Cg== X-Received: by 2002:a5d:53c3:0:b0:317:5c82:10c5 with SMTP id a3-20020a5d53c3000000b003175c8210c5mr9856910wrw.17.1692111092139; Tue, 15 Aug 2023 07:51:32 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id w4-20020adfcd04000000b003176eab8868sm18259844wrm.82.2023.08.15.07.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C73DD1FFBB; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin Subject: [PATCH 8/9] gdbstub: refactor get_feature_xml Date: Tue, 15 Aug 2023 15:51:25 +0100 Message-Id: <20230815145126.3444183-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 Signed-off-by: Alex Bennée --- gdbstub/internals.h | 2 +- gdbstub/gdbstub.c | 62 ++++++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index f2b46cce41..4876ebd74f 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -33,7 +33,7 @@ typedef struct GDBProcess { uint32_t pid; bool attached; - char target_xml[1024]; + char *target_xml; } GDBProcess; enum RSState { diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 8e9bc17e07..0f9032d793 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -354,54 +354,52 @@ static CPUState *gdb_get_cpu(uint32_t pid, uint32_t tid) static const char *get_feature_xml(const char *p, const char **newp, GDBProcess *process) { - size_t len; int i; const char *name; CPUState *cpu = gdb_get_first_cpu_in_process(process); CPUClass *cc = CPU_GET_CLASS(cpu); - len = 0; - while (p[len] && p[len] != ':') - len++; - *newp = p + len; + /* ‘qXfer:features:read:annex:offset,length' */ + char *term = g_strstr_len(p, -1, ":"); + size_t len = term - p; + g_autofree char *annex = g_strndup(p, len); + /* leave newp at offset,length for the rest of the params */ + *newp = term + 1; - name = NULL; - if (strncmp(p, "target.xml", len) == 0) { - char *buf = process->target_xml; - const size_t buf_sz = sizeof(process->target_xml); - /* Generate the XML description for this CPU. */ - if (!buf[0]) { + name = NULL; + if (g_strcmp0(annex, "target.xml") == 0) { + if (!process->target_xml) { GDBRegisterState *r; + GString *xml = g_string_new(""); + + g_string_append(xml, + "" + ""); - pstrcat(buf, buf_sz, - "" - "" - ""); if (cc->gdb_arch_name) { - gchar *arch = 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 = 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 = cpu->gdb_regs; r; r = 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 = g_string_free(xml, false); + return process->target_xml; } - return buf; } if (cc->gdb_get_dynamic_xml) { - char *xmlname = g_strndup(p, len); + g_autofree char *xmlname = g_strndup(p, len); const char *xml = cc->gdb_get_dynamic_xml(cpu, xmlname); - - g_free(xmlname); if (xml) { return xml; } @@ -2245,6 +2243,6 @@ void gdb_create_default_process(GDBState *s) process = &s->processes[s->process_num - 1]; process->pid = pid; process->attached = false; - process->target_xml[0] = '\0'; + process->target_xml = NULL; } From patchwork Tue Aug 15 14:51:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 713781 Delivered-To: patch@linaro.org Received: by 2002:a5d:4012:0:b0:317:ecd7:513f with SMTP id n18csp1822541wrp; Tue, 15 Aug 2023 07:52:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3t7xovjJRQZv606F6ZZ97HI9F+DCZtf/Q07keW84mUf+Ghbd3HuLPRBmUEm4CSV5k9JjV X-Received: by 2002:a05:620a:40d4:b0:767:dcca:7c35 with SMTP id g20-20020a05620a40d400b00767dcca7c35mr17527395qko.9.1692111178569; Tue, 15 Aug 2023 07:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692111178; cv=none; d=google.com; s=arc-20160816; b=n0R/1eeYoI7jAEbXA5/0BDeh0MLFA51NcgcZSwdMMtHpHbrCFSiU2rIb61AYgv7Dhw ag7r/4ttv7LD5PCO55P6gI6dGZbsiNYmsl9SDzrZv8ljjqZ4aOmktOR1fkLjttR1jO0E kaG4KIKI9FtxHYcCzRUIF7ZdZQb2glYJ+nwB6QS5g5mn8rZ9gzOiaoo+2cPNp1BWx5cQ N1HBo3SkKoLNg6sxO2PJfluBGcs58sbwnr6jiGSeBiUzusVFs830T3dY2UgR13T573xT ib7aMSc9W/wDjuiTeobRMZcfPnZWpf8PfSU7RZo4gEluI9xVWu4nLA3X7Byj6LYHUXXA C0nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UnhFXoZukvu0YTKINuH5NG1+Wifue15VPIsTSt2x950=; fh=04/pGBQSKxP/VRM1dOX7r60Lg6gNaLrLAuVAoZSSo70=; b=sT5yADxdgUjFffoonf4cHZJqIonWBptyK1UVLyvMTYjDZUMWrdu/MPAyD/gXZ4tiKk +CkrDqeYMdbV7ibyPYBmq4+2NfdauY+ivTANPSlDYKHT44RUwYRSZGpae2HqPTL700tT e6SjrJcV8Tc8k0yjBfg0dJg7XxqNg/c8B5niLwQy1zC70oLVVXFJPSk7SHgYUGDPOd32 HABFgqBdrXfPj4brOp9AFZOQnpof9p17VA9TftqbcDdv5gnIurF2zwf4/eIn+PAeb+Ez YMGwQyH80lLb4iGPxcEaayw2gJfcXWgeTFee1dwOzlJ9l+2iP+CadJ++/PAIMG+xWHPJ +L8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyWwrUJu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s3-20020a05620a080300b0076810112e5csi7028340qks.112.2023.08.15.07.52.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Aug 2023 07:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyWwrUJu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVvOw-0006A8-18; Tue, 15 Aug 2023 10:52:07 -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 1qVvOf-0005uW-0l for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:49 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qVvOP-0006HM-TH for qemu-devel@nongnu.org; Tue, 15 Aug 2023 10:51:48 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-317716a4622so4849034f8f.1 for ; Tue, 15 Aug 2023 07:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692111091; x=1692715891; 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=UnhFXoZukvu0YTKINuH5NG1+Wifue15VPIsTSt2x950=; b=NyWwrUJuXI47oT1v3vectwWeFS1dHpFy7c+RG+EoyQUAaGP2yyIrjBN35TY1+9xjA9 azgh/Y082aH5ogcj7sL7wlapH3IrqyzmijpMNTt7k4UQiAo/DhJMKsf20eIrcy7fgUXt lXZV7MR0UsvL/HyZafZB/UYX17DCe1CCX9EfbQ0Mka2Kelz3LWXuXL0EHuPvsMJqqb50 YdMJYJwc0Txiw096WepY7ICdoxZf8VvVlJBKq1bcg0LIh3UYMPXjw1fAMl5HlHEC4yTN xAPT1D2Wc1Nnji3jwUjl3fLgcgN87tZbDT25eHgBUtaVxJwzS5TeduFzAi4uCiA0LrG7 Wpvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692111091; x=1692715891; 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=UnhFXoZukvu0YTKINuH5NG1+Wifue15VPIsTSt2x950=; b=QpqSNeGU8elYJmKNVB7PfSKKd0M0uQbnGT1nOhM3lw58raZK81t+vZvUGoLzSP4F8L s4H6u3Rfiohb3VADdMd8PPeZLzO//06n8pPC6QBdoSog91U5KSMNARxSYZ75wicquIKc H788ss+7hYGtiyeEQPR33WLZzJDcKeyhx2YEjY6Zz8iNVi4gXvZPF27d4bvyMe0ljMXM euk2MHJBLRkYRAulQmGSiDfzmgrROksBWAwduLDYXo/c02wf1fPZl8bFSxQRxIf7zO6i IXMFI4aoq8vH024Un7arSQrmF7LFYtyXiiEidFZBdQnzoI7l+6IoF0inmBHkXT2lLNCx mYQA== X-Gm-Message-State: AOJu0Yywz/jYye51lPUNSzRaSSP0EwNGjrFTg52gAHVVgYZy28xMgrjg cGw+Hd5W5yS4rXyrmCXvqKYJJA== X-Received: by 2002:adf:e685:0:b0:317:6a7c:6e07 with SMTP id r5-20020adfe685000000b003176a7c6e07mr9683309wrm.32.1692111091141; Tue, 15 Aug 2023 07:51:31 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id j8-20020a5d4528000000b0031779a6b451sm18191537wra.83.2023.08.15.07.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 07:51:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EE8A71FFC3; Tue, 15 Aug 2023 15:51:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Wainer dos Santos Moschetta , Peter Maydell , Akihiko Odaki , Thomas Huth , David Hildenbrand , Yonggang Luo , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Daniel Henrique Barboza , David Gibson , Greg Kurz , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , qemu-s390x@nongnu.org, Ilya Leoshkevich , qemu-ppc@nongnu.org, =?utf-8?q?Philip?= =?utf-8?q?pe_Mathieu-Daud=C3=A9?= , Nicholas Piggin Subject: [PATCH 9/9] gdbstub: replace global gdb_has_xml with a function Date: Tue, 15 Aug 2023 15:51:26 +0100 Message-Id: <20230815145126.3444183-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230815145126.3444183-1-alex.bennee@linaro.org> References: <20230815145126.3444183-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. Signed-off-by: Alex Bennée --- gdbstub/internals.h | 1 + include/exec/gdbstub.h | 10 +++++----- gdbstub/gdbstub.c | 12 +++++++----- gdbstub/softmmu.c | 1 - gdbstub/user.c | 1 - target/arm/gdbstub.c | 8 ++++---- target/ppc/gdbstub.c | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-) 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; + /* If gdb sends qXfer:features:read:target.xml this will be populated */ char *target_xml; } GDBProcess; 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); /** - * 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); /* 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 0f9032d793..88a4b6a06b 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -75,8 +75,6 @@ void gdb_init_gdbserver_state(void) gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags; } -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 tid) } } +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) { @@ -1079,7 +1082,7 @@ static void handle_set_reg(GArray *params, void *user_ctx) { int reg_size; - if (!gdb_has_xml) { + if (!gdb_get_cpu_process(gdbserver_state.g_cpu)->target_xml) { gdb_put_packet(""); return; } @@ -1100,7 +1103,7 @@ static void handle_get_reg(GArray *params, void *user_ctx) { int reg_size; - if (!gdb_has_xml) { + if (!gdb_get_cpu_process(gdbserver_state.g_cpu)->target_xml) { gdb_put_packet(""); return; } @@ -1567,7 +1570,6 @@ static void handle_query_xfer_features(GArray *params, void *user_ctx) return; } - gdb_has_xml = true; p = get_param(params, 0)->data; xml = 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 event) vm_stop(RUN_STATE_PAUSED); replay_gdb_attached(); - gdb_has_xml = 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 = gdb_first_attached_cpu(); gdbserver_state.g_cpu = gdbserver_state.c_cpu; gdbserver_user_state.fd = fd; - gdb_has_xml = false; } 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 *mem_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 *mem_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 *mem_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 *mem_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);