From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608290921; cv=none; d=zohomail.com; s=zohoarc; b=hrrsDEJl/ChChm1grf5+dhzIg6zOJT8lzuuqo9OQCaO3rVm1z05l7/u74rsuFXz/COHy8InHWGDaCyViGMuB5EButjs6xb1WjyC6D5tJou5lI8Wvc5w0yW4xJcy4wHKu0EfDLMZ4g6isHR23tE3Hd3/RVYgjjt1v63Z5xoGU4VQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608290921; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bUNDzMEHp2bJw/cEZs6exTqnUgdBKWbnqrvMaXEkx3E=; b=dEPPtbJrLjYUv+XhKpVvuJHwWb+IPq3LF7qEqGMPGeqPcEbPvh5Sdg16izsEjXMeiwc8RrbopEbKFsxd5ack5nVHpFXX6XFl2GP//ahbiWVXyXfaqEM9rrWOqyEjAY+CH/dPeU+DFwhnj2w6hFOqzEs4cAPgk4q/R+NTqf1h3O8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608290921074745.6596201724216; Fri, 18 Dec 2020 03:28:41 -0800 (PST) Received: from localhost ([::1]:38998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDw7-00006U-ME for importer@patchew.org; Fri, 18 Dec 2020 06:28:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDul-0006ng-AT for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:15 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:38092) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDuh-00034O-Vx for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:15 -0500 Received: by mail-wr1-x433.google.com with SMTP id r7so1762305wrc.5 for ; Fri, 18 Dec 2020 03:27:11 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z15sm14052819wrv.67.2020.12.18.03.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:08 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B9D831FF87; Fri, 18 Dec 2020 11:27:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bUNDzMEHp2bJw/cEZs6exTqnUgdBKWbnqrvMaXEkx3E=; b=M4F3jxwkEVjMYO9zGjRX9M5O5jU5FVCkM9iKPgSQtkHeHNEYNPMmc9UOUCSvpw9uUA 5u2i2UjQ62X02AIBdGMwvH3Zli80XyRF7TBN21y9PialZ19uHT4b5cNOmEnEqMcmEmCO vxrvKV6iOtQdW+D/lLKhiaACA9B1Tv7PA9uNMma4isX1LYP71+MAx/I/RWYq0aB/P7x5 3HKfAP0rKmO1No0Hqa2ATU5a+oP1S6gycAsmeI/O+HBGa3EWi56GDJ7KfaUClMiIVc1K iG94GW5kEZhjlajkU6EFKgdm29tb5T5TW6bFKyrwPBWtsWorFgvrHi8CH6KMKCfxFH/0 E0qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bUNDzMEHp2bJw/cEZs6exTqnUgdBKWbnqrvMaXEkx3E=; b=hT78XwqJOqZ+SAOLdLpMo77As4N6dM6yiFMpPCric77qNH74L54Z+VB8gagk+R58Y/ MSOHbbeDdnOdX+QRPqQM5Zude44+gL+T61YEa76Tyoknh+lHTLnDFOeNSnrVQ71FpMlJ rWK1NW7m9UwJD/OolNvihISMb5pAheFlEdWF7ljGxz8/OVO5iaQ8qBcT5+k/Zu5VkA/Q js2XGARGk+uxeyCbpL0nOuDInAcr2yBIkN4mtk8DH6r4JOIFhEuvFNVqUXdoyOC+UW8d VANam6iy6Z1EmEbFQr/fcMxswG3TK2ACaKW35Md/HAbLEBspjN0bgeDgPwPWQCJrlTvH usqg== X-Gm-Message-State: AOAM533vtW5/fqUMUi9xxA7UmE5INdGjh+cRG13iF1Yv6i2NfNg9PICu WVOw1X6Pb4BAPBRnBA0hQJkTSy9byO+wQw== X-Google-Smtp-Source: ABdhPJxNx4S9JOnaDiT7iuPQgRxn6dH/bJmOKWgQyjefu/QpRYSuSZhYZWI/cYW1X0mR1W3i2AgAWQ== X-Received: by 2002:adf:db44:: with SMTP id f4mr3847147wrj.169.1608290830704; Fri, 18 Dec 2020 03:27:10 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 1/9] test/guest-debug: echo QEMU command as well Date: Fri, 18 Dec 2020 11:26:59 +0000 Message-Id: <20201218112707.28348-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) This helps with debugging. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20201214153012.12723-2-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- tests/guest-debug/run-test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 71c5569054..0c4f5c3808 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -53,6 +53,7 @@ if __name__ =3D=3D '__main__': cmd =3D "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, args.binary) =20 + print("QEMU CMD: %s" % (cmd)) inferior =3D subprocess.Popen(shlex.split(cmd)) =20 # Now launch gdb with our test and collect the result --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608290923; cv=none; d=zohomail.com; s=zohoarc; b=NXASS8rAoF6bFS0BmA6+CMx0m1komLTLg4LsWmgWRChSSN0fNed87Zct0GaO3qN2GUBLcZP8TSP+wMoY6eaab0vTEqIrFWaQRsVG96l7ELo4ojxXEAOgRott8YaQQ6N5ALKYpdWlQ0ouYJzpTAgikA1FBL1VffA8URZmCfAaYL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608290923; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4YR3FKqEiht5wvA3fKDaBjYa36uQEgaaAETgD0fHI+Y=; b=QEQZaRzL4frLcfD74+1EZxRDk4M8xvA1FQKKa8V4RB5kVWuqlz5SKvtDt1AKaFRj+rN368Ng8KzDwUP14pQ2h/u0csKfK9lUNSo3jmlV3s5g+VA1Rl7PnkHK0Y4s5AhfaCqoCJGMLBi/M9lmEaxwjb0X6oUb4fas+VdgxXGnZ7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608290923598888.1006273588765; Fri, 18 Dec 2020 03:28:43 -0800 (PST) Received: from localhost ([::1]:39106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDwA-00009G-3G for importer@patchew.org; Fri, 18 Dec 2020 06:28:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDul-0006o6-Pd for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:15 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:55077) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDuk-00034Z-5X for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:15 -0500 Received: by mail-wm1-x331.google.com with SMTP id c133so1990775wme.4 for ; Fri, 18 Dec 2020 03:27:13 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s63sm12580480wms.18.2020.12.18.03.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:08 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CDC081FF8C; Fri, 18 Dec 2020 11:27:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4YR3FKqEiht5wvA3fKDaBjYa36uQEgaaAETgD0fHI+Y=; b=koRo8mbcgvhlCJr6ZO450WcwQgXX+O+lITlkOO6QxrFvXaE8lGLOOs6m/9yerD5Kt+ KE7fgig2VogAKcbGwZeaYHMaJIoxp4pXGk2lmEP0fiqrsy+PbzPAY1CB7QgAbZBsgrXq R3zIMCi7KJEThZkAZrszEQ95cWdaI/6imy0/MhZ7FQ7DG31kgDTLEhnLuwxHJ6ZutLjW JAUw6/IKo4eyEl9Jtu6fnf7E3ZOa9JcthxTTRNlGF2h3DxI7CRC9E5FVghx8EiZFnnfg aN3sr1PkgEdbq+sw16w1WRGRpcZmaKVrio43QPnCUkWI0CdvfFD2mnec1/2fRwOiIYyF Y/uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4YR3FKqEiht5wvA3fKDaBjYa36uQEgaaAETgD0fHI+Y=; b=d52Fz98yBRalbLzFXgOzdhhwzAqaxvkxnhqGTTsH5aWvkUHVsqbHx0XYlaLomOZysd 6FmEzkrsLeDHSF0dMYEzUG+rQlbLb++Lw0OHJMBzuXaJJx5L9rbKgXfjfs4FWfYkL+cX hwMkstjesgOH8peXeJOuhFh/gpeL1rTWjqjEZQstbhietezdIk3oOAHwf1a7yOan0TvZ 968L+MCBxI2PEowbhBhjEnP2rfq27dHeJ3Psq3MZccdBoZxaNVaDCTL3/wqbfodtw8pX m2Wky+hZxccBw4GYgvmqx731oncteAzeK894LNFQuhfsxmjyBVqJD4jE/eHNOKOaibWD n8FQ== X-Gm-Message-State: AOAM532+WuRdPqfSSaxojTUNlt1F1JUeZuPcAoTD9P7Qsio+PIfUs0gq ihJArfB/oc3jqpeWR/J/HtjmKA== X-Google-Smtp-Source: ABdhPJxHL4FjwfhNe95v33eW7LrQNxuWFljKE1M8LrYspVweNuv4WcxwyXSRIxdvhlH/GpLuZi+Gpw== X-Received: by 2002:a7b:c385:: with SMTP id s5mr3761945wmj.170.1608290832518; Fri, 18 Dec 2020 03:27:12 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/9] configure: gate our use of GDB to 8.3.1 or above Date: Fri, 18 Dec 2020 11:27:00 +0000 Message-Id: <20201218112707.28348-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The support of socket based debugging which we need for linux-user testing is only really stable as of 8.3.1 so lets gate our use of GDB on having a relatively modern version. For direct testing you can just point to a locally compiled version of gdb via configure, e.g.: ../../configure --gdb=3D$HOME/src/binutils-gdb.git/builds/all/install/bin= /gdb Signed-off-by: Alex Benn=C3=A9e Message-Id: <20201214153012.12723-3-alex.bennee@linaro.org> --- v2 - reword intention --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 0e542b4c46..07df350e06 100755 --- a/configure +++ b/configure @@ -6676,8 +6676,11 @@ if test "$plugins" =3D "yes" ; then fi fi =20 -if test -n "$gdb_bin" ; then - echo "HAVE_GDB_BIN=3D$gdb_bin" >> $config_host_mak +if test -n "$gdb_bin"; then + gdb_version=3D$($gdb_bin --version | head -n 1) + if version_ge ${gdb_version##* } 8.3.1; then + echo "HAVE_GDB_BIN=3D$gdb_bin" >> $config_host_mak + fi fi =20 if test "$secret_keyring" =3D "yes" ; then --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608290968; cv=none; d=zohomail.com; s=zohoarc; b=bf3aeRjCPKGXWIwa0tTuLjuEArUqJmPld0rSIHg7jRA8SU8WpWvzDqDV6KSPiTLuD16X+O2qbJrUu6ZE7pVEN9h7EkRC1le3ilDKZhdtJN51VznfE1sf/Vt4m6U0UZr9RHdQ3gXs27pAUvEQTqeZ1iELEz2ylo2tX9rzii8D5iU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608290968; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=52j5UDdkQCGobtG+iJtsfKQkVY+3DyC1b4VXquCpK3c=; b=DJsOykMu/UrqJTlqLwWDagkUIFFqD8+smmXzqp1vhVufhrOQp8ORnD8qdOFRPjRSTDhIoUEx0FGLkpeHYh2FvwwpmaTTF2diMOqmbqDp4HagF/KV+pYxGWUpfVHcLyfnZPvz6K/rMJbon+Qo9s1cldiAP2n7lODSaULv28iGvh8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608290968371508.69354345750855; Fri, 18 Dec 2020 03:29:28 -0800 (PST) Received: from localhost ([::1]:41740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDws-0001Ho-97 for importer@patchew.org; Fri, 18 Dec 2020 06:29:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDum-0006p8-K8 for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:16 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:39773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDuk-00035I-Qm for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:16 -0500 Received: by mail-wm1-x330.google.com with SMTP id 3so2182433wmg.4 for ; Fri, 18 Dec 2020 03:27:14 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 94sm14004876wrq.22.2020.12.18.03.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:08 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E2FF41FF8F; Fri, 18 Dec 2020 11:27:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=52j5UDdkQCGobtG+iJtsfKQkVY+3DyC1b4VXquCpK3c=; b=H+BkBVJ12lclMF4XELXnUmu8nzqmC4HwqL7cYZ8qAuwCn3F1haXAedt1jlLhjg3maY LhhvS/OGWXTSxNyG40dUvB8aaae0rRJn194v7Q6OOHYBbLIL61NDxrEcJQTBq/yKLiu1 MaDSNwCjHv9R7e8JbOwOOaPDSqVWxkLcF1iwVhhv7GFe+lZHz9tvWeJXxMkJHZgWVKV1 Bl+01NLTFpG865xAmHx0vMycACKE5xDye4+Z3frA0N0GdsIsd9hriyMR7P3voH2lrFLD oyYgvYA0ISMI8/o1l88OLkWxIlHdErx5dsvCWeBhqdjyf9U1WuScIfNNkfRr6tVw8hZ2 gOlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=52j5UDdkQCGobtG+iJtsfKQkVY+3DyC1b4VXquCpK3c=; b=lPQ9wXSRd0wpuLLpls8U4Cl1P7E8l0JGBiHNW1jaZgIUNtiB6thCT8YXQe8J9/znjE jw9WnQH4l9C4lJh7EphcFF3azY6uo5I7hgxinxOeSqwYNB8Hs0SqkUvbcbsQVo+TpSJ3 XxV9dEMySqTmacEWveAy14eWhyM5bPZUXYuO1Zhqhr07ZhtHsHGviQ/SBt91ueteUCEv nAhQeGe1YSbfGV7hPLL8+gJBeBjeIdQpcRNHalPGL34w4gkkCGBFB3+OaYWSLQ9c6Y6h MCbbmhWpExeHIeNpXiLdJY4gTiOLq6M3yMHnKDpyja7CdN38SDUXLVISBUdwKWPEkpMK Owtw== X-Gm-Message-State: AOAM531IC+HsBf3seV/7RJ1mRHvATB6coJb7rxHC5jnuM8f0INDBauJF zMgtXVdmYB0h9+uACp/s3/dNTWgZ88YdSQ== X-Google-Smtp-Source: ABdhPJzWCMjCAqdrfXwSf3VXXUp0XGv/EYhREih/ZhBP/uaIaE9dQJIzBhQg8N9BzGGViWC/jhIzwQ== X-Received: by 2002:a1c:8016:: with SMTP id b22mr3717021wmd.135.1608290833454; Fri, 18 Dec 2020 03:27:13 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 3/9] Revert "tests/tcg/multiarch/Makefile.target: Disable run-gdbstub-sha1 test" Date: Fri, 18 Dec 2020 11:27:01 +0000 Message-Id: <20201218112707.28348-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) We won't attempt to run the test now it's gated on a newer version of gdb. This reverts commit a930cadd83b4681a98ce72abf530a791ee2e42a6. Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/multiarch/Makefile.target | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Make= file.target index 230eb9a95e..cb49cc9ccb 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -54,9 +54,7 @@ run-gdbstub-sha1: sha1 --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ "basic gdbstub support") =20 -# Disable this for now -- it provokes a gdb internal-error on -# Ubuntu gdb 8.1.1-0ubuntu1. -# EXTRA_RUNS +=3D run-gdbstub-sha1 +EXTRA_RUNS +=3D run-gdbstub-sha1 endif =20 =20 --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608291232; cv=none; d=zohomail.com; s=zohoarc; b=cROUGAtevHTu+b9Ns5voFgAfxW3FdLk8fO4s7PJX72zUgTmBCUlXm0jBIYHT4rtQFkF4yZVtrN9kPrpdSu3z76D8lF1OTpefcc4ebnFlr/5KtccIcXUA1o5Lr2SMJRrcUmyCe3JrssDvPPU4VJ2oCCo/feKBwjQ1CQvG1cN9H+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608291232; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/fELguAheXJjKTQbYC8Vu+DxW5f+wKRNI1HhgpsaCyI=; b=iSjBXJAIg8t2jhlX+ZYKeybHdsjd+gYYpFgP0RSEDOtU2689zYMWNRQEPuA7f5D+8XWbIii0ug4/K7quc5it0bvmhnEkYnSIFjzWEtpbnCYx6DhBgkTW+UvT3R/YjCk0pHDR3XpACoHyWkGhdC15jsko7boMlJ1mKw49I7jOP7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608291232845210.04684060275906; Fri, 18 Dec 2020 03:33:52 -0800 (PST) Received: from localhost ([::1]:55082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqE19-0006xX-O6 for importer@patchew.org; Fri, 18 Dec 2020 06:33:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDuq-0006vx-P2 for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:20 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:46220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDun-000365-2Y for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:20 -0500 Received: by mail-wr1-x436.google.com with SMTP id d13so1724636wrc.13 for ; Fri, 18 Dec 2020 03:27:16 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a17sm13644131wrs.20.2020.12.18.03.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 117011FF90; Fri, 18 Dec 2020 11:27:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/fELguAheXJjKTQbYC8Vu+DxW5f+wKRNI1HhgpsaCyI=; b=Ec69LCWQRrGdoGUuuPIsKzRuB91/OJY0ltf8gp1ykWx/c4o4rAgqP353LQzNIgEAtu Eb+8/bw5NBLqEjFAhZtNfjK2can766XtoNdeE5FfoFOnLGvOtopLVfPA4fycrBPD/YdP WUxaP05Yel8fdZ7xth2WbapsIxkXT8jycTRdQEkJy/WCPy/cBhCPK4rmWBl0WkyMD1VG YoH409xD28StLWVfUUsuUzXpuAYCnmScD+FyLkf6DST7y6ylO0WggqbwEtGg/7J2dG7b Dl4edsEqv1evRRIGWndymc0G6Iq2L1JbyJZ5+YFiaZcK0/h5XudF9HLcrUFzJln7R4b8 m1NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/fELguAheXJjKTQbYC8Vu+DxW5f+wKRNI1HhgpsaCyI=; b=ldS8bzt3kbs3aCMhdVSFmvR35zvsfHjrHn8QL5ODxdN6abZwRqE97QjmDtCxtlHVtg HeasjmvpQZ0J+ecnE7zcmnjevlrMjSCNuMd1VSeQycC1mJVyzyYVLrwp+GSbsWef0F7O z7/FImcxZoXJk4hZGCImz6oG68uCXvZhxYPoZo0fjf2BOheBB0sw0Io6kHAfMSFtysqU QoB6cpxDX9yon8JB5JLC/OXLcu8snfPXzExHrBa+0LfeZvYejTrQ4M70ZWMKcEqrbhu/ XiDGZFDwFFYNYBP4+ihynxr+q5ico8Dq3MkDijOriCA8YPnLE4NV6E0oay+ZJIdeHryF 0Tuw== X-Gm-Message-State: AOAM530+7WifLbyoN0fwivbAIRt/4xMgQBkZXNSrrgSYLy9Fa0BqciQx X5aCwx4tGnIi9TEFQOPCu7ky3g== X-Google-Smtp-Source: ABdhPJxyKnECmlSNTtqgiCGz8kLak30+9JK+9raf21Xn1nYbO4lC+nSimY2mTOP/Zf5D0IAbqC1h4g== X-Received: by 2002:a5d:4f90:: with SMTP id d16mr3902807wru.120.1608290835639; Fri, 18 Dec 2020 03:27:15 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 4/9] gdbstub: implement a softmmu based test Date: Fri, 18 Dec 2020 11:27:02 +0000 Message-Id: <20201218112707.28348-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , "open list:ARM TCG CPUs" , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This adds a new tests that allows us to test softmmu only features including watchpoints. To do achieve this we need to: - add _exit: labels to the boot codes - write a memory.py test case - plumb the test case into the build system - tweak the run_test script to: - re-direct output when asked - use socket based connection for all tests - add a small pause before connection Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/guest-debug/run-test.py | 36 +++-- tests/tcg/aarch64/Makefile.softmmu-target | 1 + tests/tcg/aarch64/system/boot.S | 1 + tests/tcg/i386/Makefile.softmmu-target | 1 + tests/tcg/i386/system/boot.S | 2 +- tests/tcg/multiarch/gdbstub/memory.py | 130 ++++++++++++++++++ .../multiarch/system/Makefile.softmmu-target | 19 ++- tests/tcg/x86_64/Makefile.softmmu-target | 1 + tests/tcg/x86_64/system/boot.S | 2 +- 9 files changed, 181 insertions(+), 12 deletions(-) create mode 100644 tests/tcg/multiarch/gdbstub/memory.py diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 0c4f5c3808..8b91ff95af 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -16,6 +16,7 @@ import subprocess import shutil import shlex import os +from time import sleep from tempfile import TemporaryDirectory =20 def get_args(): @@ -27,10 +28,21 @@ def get_args(): required=3DTrue) parser.add_argument("--test", help=3D"GDB test script", required=3DTrue) - parser.add_argument("--gdb", help=3D"The gdb binary to use", default= =3DNone) + parser.add_argument("--gdb", help=3D"The gdb binary to use", + default=3DNone) + parser.add_argument("--output", help=3D"A file to redirect output to") =20 return parser.parse_args() =20 + +def log(output, msg): + if output: + output.write(msg + "\n") + output.flush() + else: + print(msg) + + if __name__ =3D=3D '__main__': args =3D get_args() =20 @@ -42,18 +54,25 @@ if __name__ =3D=3D '__main__': if not args.gdb: print("We need gdb to run the test") exit(-1) + if args.output: + output =3D open(args.output, "w") + else: + output =3D None =20 socket_dir =3D TemporaryDirectory("qemu-gdbstub") socket_name =3D os.path.join(socket_dir.name, "gdbstub.socket") =20 # Launch QEMU with binary if "system" in args.qemu: - cmd =3D "%s %s %s -s -S" % (args.qemu, args.qargs, args.binary) + cmd =3D "%s %s %s -gdb unix:path=3D%s,server" % (args.qemu, + args.qargs, + args.binary, + socket_name) else: cmd =3D "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, args.binary) =20 - print("QEMU CMD: %s" % (cmd)) + log(output, "QEMU CMD: %s" % (cmd)) inferior =3D subprocess.Popen(shlex.split(cmd)) =20 # Now launch gdb with our test and collect the result @@ -63,16 +82,15 @@ if __name__ =3D=3D '__main__': # disable prompts in case of crash gdb_cmd +=3D " -ex 'set confirm off'" # connect to remote - if "system" in args.qemu: - gdb_cmd +=3D " -ex 'target remote localhost:1234'" - else: - gdb_cmd +=3D " -ex 'target remote %s'" % (socket_name) + gdb_cmd +=3D " -ex 'target remote %s'" % (socket_name) # finally the test script itself gdb_cmd +=3D " -x %s" % (args.test) =20 - print("GDB CMD: %s" % (gdb_cmd)) =20 - result =3D subprocess.call(gdb_cmd, shell=3DTrue); + sleep(1) + log(output, "GDB CMD: %s" % (gdb_cmd)) + + result =3D subprocess.call(gdb_cmd, shell=3DTrue, stdout=3Doutput) =20 # A negative result is the result of an internal gdb failure like # a crash. We force a return of 0 so we don't fail the test on diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/= Makefile.softmmu-target index 1057a8ac49..a7286ac295 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -15,6 +15,7 @@ CRT_PATH=3D$(AARCH64_SYSTEM_SRC) LINK_SCRIPT=3D$(AARCH64_SYSTEM_SRC)/kernel.ld LDFLAGS=3D-Wl,-T$(LINK_SCRIPT) TESTS+=3D$(AARCH64_TESTS) $(MULTIARCH_TESTS) +EXTRA_RUNS+=3D$(MULTIARCH_RUNS) CFLAGS+=3D-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc =20 diff --git a/tests/tcg/aarch64/system/boot.S b/tests/tcg/aarch64/system/boo= t.S index b14e94f332..e190b1efa6 100644 --- a/tests/tcg/aarch64/system/boot.S +++ b/tests/tcg/aarch64/system/boot.S @@ -197,6 +197,7 @@ __start: bl main =20 /* pass return value to sys exit */ +_exit: mov x1, x0 ldr x0, =3D0x20026 /* ADP_Stopped_ApplicationExit */ stp x0, x1, [sp, #-16]! diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefi= le.softmmu-target index 1c8790eecd..5266f2335a 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -19,6 +19,7 @@ CFLAGS+=3D-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc =20 TESTS+=3D$(MULTIARCH_TESTS) +EXTRA_RUNS+=3D$(MULTIARCH_RUNS) =20 # building head blobs .PRECIOUS: $(CRT_OBJS) diff --git a/tests/tcg/i386/system/boot.S b/tests/tcg/i386/system/boot.S index 90aa174908..794c2cb0ad 100644 --- a/tests/tcg/i386/system/boot.S +++ b/tests/tcg/i386/system/boot.S @@ -76,7 +76,7 @@ _start: */ call main =20 - /* output any non-zero result in eax to isa-debug-exit device */ +_exit: /* output any non-zero result in eax to isa-debug-exit device */ test %al, %al jz 1f out %ax, $0xf4 diff --git a/tests/tcg/multiarch/gdbstub/memory.py b/tests/tcg/multiarch/gd= bstub/memory.py new file mode 100644 index 0000000000..67864ad902 --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/memory.py @@ -0,0 +1,130 @@ +from __future__ import print_function +# +# Test some of the softmmu debug features with the multiarch memory +# test. It is a port of the original vmlinux focused test case but +# using the "memory" test instead. +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb +import sys + +failcount =3D 0 + + +def report(cond, msg): + "Report success/fail of test" + if cond: + print("PASS: %s" % (msg)) + else: + print("FAIL: %s" % (msg)) + global failcount + failcount +=3D 1 + + +def check_step(): + "Step an instruction, check it moved." + start_pc =3D gdb.parse_and_eval('$pc') + gdb.execute("si") + end_pc =3D gdb.parse_and_eval('$pc') + + return not (start_pc =3D=3D end_pc) + + +# +# Currently it's hard to create a hbreak with the pure python API and +# manually matching PC to symbol address is a bit flaky thanks to +# function prologues. However internally QEMU's gdbstub treats them +# the same as normal breakpoints so it will do for now. +# +def check_break(sym_name): + "Setup breakpoint, continue and check we stopped." + sym, ok =3D gdb.lookup_symbol(sym_name) + bp =3D gdb.Breakpoint(sym_name, gdb.BP_BREAKPOINT) + + gdb.execute("c") + + # hopefully we came back + end_pc =3D gdb.parse_and_eval('$pc') + report(bp.hit_count =3D=3D 1, + "break @ %s (%s %d hits)" % (end_pc, sym.value(), bp.hit_count)) + + bp.delete() + + +def do_one_watch(sym, wtype, text): + + wp =3D gdb.Breakpoint(sym, gdb.BP_WATCHPOINT, wtype) + gdb.execute("c") + report_str =3D "%s for %s" % (text, sym) + + 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") + + +def run_test(): + "Run through the tests one by one" + + print("Checking we can step the first few instructions") + step_ok =3D 0 + for i in range(3): + if check_step(): + step_ok +=3D 1 + + report(step_ok =3D=3D 3, "single step in boot code") + + # If we get here we have missed some of the other breakpoints. + print("Setup catch-all for _exit") + cbp =3D gdb.Breakpoint("_exit", gdb.BP_BREAKPOINT) + + check_break("main") + check_watches("test_data[128]") + + report(cbp.hit_count =3D=3D 0, "didn't reach backstop") + +# +# This runs as the script it sourced (via -x, via run-test.py) +# +try: + inferior =3D gdb.selected_inferior() + arch =3D inferior.architecture() + print("ATTACHED: %s" % arch.name()) +except (gdb.error, AttributeError): + print("SKIPPING (not connected)", file=3Dsys.stderr) + exit(0) + +if gdb.parse_and_eval('$pc') =3D=3D 0: + print("SKIP: PC not set") + exit(0) + +try: + # These are not very useful in scripts + gdb.execute("set pagination off") + + # Run the actual tests + run_test() +except (gdb.error): + print("GDB Exception: %s" % (sys.exc_info()[0])) + failcount +=3D 1 + pass + +# Finally kill the inferior and exit gdb with a count of failures +gdb.execute("kill") +exit(failcount) diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg= /multiarch/system/Makefile.softmmu-target index db4bbeda44..4657f6e4cf 100644 --- a/tests/tcg/multiarch/system/Makefile.softmmu-target +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target @@ -7,8 +7,25 @@ # complications of building. # =20 -MULTIARCH_SYSTEM_SRC=3D$(SRC_PATH)/tests/tcg/multiarch/system +MULTIARCH_SRC=3D$(SRC_PATH)/tests/tcg/multiarch +MULTIARCH_SYSTEM_SRC=3D$(MULTIARCH_SRC)/system VPATH+=3D$(MULTIARCH_SYSTEM_SRC) =20 MULTIARCH_TEST_SRCS=3D$(wildcard $(MULTIARCH_SYSTEM_SRC)/*.c) MULTIARCH_TESTS =3D $(patsubst $(MULTIARCH_SYSTEM_SRC)/%.c, %, $(MULTIARCH= _TEST_SRCS)) + +ifneq ($(HAVE_GDB_BIN),) +GDB_SCRIPT=3D$(SRC_PATH)/tests/guest-debug/run-test.py + +run-gdbstub-memory: memory + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) \ + --output $<.gdb.out \ + --qargs \ + "-monitor none -display none -chardev file$(COMMA)path=3D$<.out$(COMMA)i= d=3Doutput $(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \ + "softmmu gdbstub support") + +MULTIARCH_RUNS +=3D run-gdbstub-memory +endif diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Ma= kefile.softmmu-target index df252e761c..1bd763f2e6 100644 --- a/tests/tcg/x86_64/Makefile.softmmu-target +++ b/tests/tcg/x86_64/Makefile.softmmu-target @@ -19,6 +19,7 @@ CFLAGS+=3D-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc =20 TESTS+=3D$(MULTIARCH_TESTS) +EXTRA_RUNS+=3D$(MULTIARCH_RUNS) =20 # building head blobs .PRECIOUS: $(CRT_OBJS) diff --git a/tests/tcg/x86_64/system/boot.S b/tests/tcg/x86_64/system/boot.S index 73b19a2bda..f8a2fcc839 100644 --- a/tests/tcg/x86_64/system/boot.S +++ b/tests/tcg/x86_64/system/boot.S @@ -124,7 +124,7 @@ _start: /* don't worry about stack frame, assume everthing is garbage when= we return */ call main =20 - /* output any non-zero result in eax to isa-debug-exit device */ +_exit: /* output any non-zero result in eax to isa-debug-exit device */ test %al, %al jz 1f out %ax, $0xf4 --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608291479; cv=none; d=zohomail.com; s=zohoarc; b=Gy5A71xqaNmG+rKqWuLPfGl3MtXIpP5iT33Yb9cjt2XmEPaUj1cCEvpgIrdsD7g7ez7cpBk5QTcwVdJwnWwsXJ3iGs5td9cHvvFP26WTkE/d4PvMYwKPpEFjqaNdFkmD0HusbyU+ceY9Uyvt3OalFw1KzecPls4rqtl0kPoY+Lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608291479; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=01tFfuv0vHwkzArr4QZXoLGHaw2yUPc1Y3PaVe5R/e0=; b=RBF1Px+nESn9YBInd2cUtUhRuEB4mmWJgddk6Cl29NGhL3eKETt8m7fjrAO3aKU9TXA49Vw6HSrxXc2TdKzqK8fP8nBZGAY4cYx0aW7cV4yA6zteKeuzn7NiBlXzwyRRu0Bqe5dZCY2aARAKGtEWynQti3lUxlThrso+5i7I9ao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608291479046629.9082512202202; Fri, 18 Dec 2020 03:37:59 -0800 (PST) Received: from localhost ([::1]:34846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqE57-0001wh-Ia for importer@patchew.org; Fri, 18 Dec 2020 06:37:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDuv-00076Y-33 for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:25 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:38413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDus-00038D-Us for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:24 -0500 Received: by mail-wm1-x333.google.com with SMTP id g185so2185949wmf.3 for ; Fri, 18 Dec 2020 03:27:22 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i16sm12838699wrx.89.2020.12.18.03.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:14 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2C8021FF91; Fri, 18 Dec 2020 11:27:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=01tFfuv0vHwkzArr4QZXoLGHaw2yUPc1Y3PaVe5R/e0=; b=N47HG5ZxSha8hjC7Z3LTtL1OkcWaK6+cHi55K+rov7jXDeHsBsPdtuDHkzmhdI0XnK NAk+0s6bu14PbMHepNBbRTIo2IJWLJj5/QvX2q6IPkBh0P1zXvkbyG2bE8QSTOHredWK nva3OZzklG8YqxdGx78stP5DyZ1i19mi5pq2oh7OsCz+QTSRz9CEFJxeYyblDnhYNq2I 99pKSs9tfmLfqdkhRsuMi9NKMCxRosCWurBfTuj21twcO7T4fzzi2Fk4gZ666hiM80P0 CbXb1xEAzzQL4LEtr0LS4AuQhPkuiDpzAg4e2g6QHyVSFzgIiAS6Xq1y0la5LD9cUrL8 ZQ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=01tFfuv0vHwkzArr4QZXoLGHaw2yUPc1Y3PaVe5R/e0=; b=tLo0+xJbwF+Tdj4AuKBQm33+10AQDcDbsTziOo4FEheKqW0y835YzIva7UnrvIE5pD gvpa5FML/ap7QSgsf9mvZhPAi1p0GlBsNfo4mcMkf09Id/fjhUqRYSwukNAXcZylOtR2 +cKB82II8jDQ6xET0ESHhQS5B32LPE4PYEef8VeWC8xhcz39NIMoqfdsoEsf4QXZFgx4 V8A/18QCTz0Z2nBEhLNphoqrT/5bSCeJgghi7rs+UK34uPpsNOk7fwhatB+XCbPkhaCv okfhhj7gMdHIHbbrOlC3pK2yhAxtYFxGgInOOEJGVFjjXv5DlSB5Exve/yXiTw09MAMM FKqQ== X-Gm-Message-State: AOAM5335eYZiGVvmpaSOG0kUmkGxa33/hcp3NB94/+R5tP9SJ0b6gK0/ h9cc5qsSb6r1A4MlRHtqMW9drw== X-Google-Smtp-Source: ABdhPJy3uuDZcuoIYjFLntSrT6XHoeJsluzXfHgTnFKSrnSX4CzsGIS6A1UxQCsVtdNDzc4i50vQfw== X-Received: by 2002:a1c:64c4:: with SMTP id y187mr3796762wmb.165.1608290841348; Fri, 18 Dec 2020 03:27:21 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 5/9] gdbstub: add support to Xfer:auxv:read: packet Date: Fri, 18 Dec 2020 11:27:03 +0000 Message-Id: <20201218112707.28348-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Lirong Yuan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Lirong Yuan This allows gdb to access the target=E2=80=99s auxiliary vector, which can be helpful for telling system libraries important details about the hardware, operating system, and process. [AJB: minor tweaks to test case, update MAINTAINERS] Signed-off-by: Lirong Yuan Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20200730193932.3654677-1-yuanzi@google.com> Message-Id: <20201214153012.12723-4-alex.bennee@linaro.org> --- gdbstub.c | 54 ++++++++++++++++++ MAINTAINERS | 1 + tests/tcg/multiarch/Makefile.target | 9 +++ .../multiarch/gdbstub/test-qxfer-auxv-read.py | 57 +++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py diff --git a/gdbstub.c b/gdbstub.c index d99bc0bf2e..15d3a8e1f5 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2172,6 +2172,12 @@ static void handle_query_supported(GdbCmdContext *gd= b_ctx, void *user_ctx) ";ReverseStep+;ReverseContinue+"); } =20 +#ifdef CONFIG_USER_ONLY + if (gdbserver_state.c_cpu->opaque) { + g_string_append(gdbserver_state.str_buf, ";qXfer:auxv:read+"); + } +#endif + if (gdb_ctx->num_params && strstr(gdb_ctx->params[0].data, "multiprocess+")) { gdbserver_state.multiprocess =3D true; @@ -2233,6 +2239,46 @@ static void handle_query_xfer_features(GdbCmdContext= *gdb_ctx, void *user_ctx) gdbserver_state.str_buf->len, true); } =20 +#ifdef CONFIG_USER_ONLY +static void handle_query_xfer_auxv(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + TaskState *ts; + unsigned long offset, len, saved_auxv, auxv_len; + const char *mem; + + if (gdb_ctx->num_params < 2) { + put_packet("E22"); + return; + } + + offset =3D gdb_ctx->params[0].val_ul; + len =3D gdb_ctx->params[1].val_ul; + ts =3D gdbserver_state.c_cpu->opaque; + saved_auxv =3D ts->info->saved_auxv; + auxv_len =3D ts->info->auxv_len; + mem =3D (const char *)(saved_auxv + offset); + if (offset > auxv_len) { + put_packet("E00"); + return; + } + + if (len > (MAX_PACKET_LENGTH - 5) / 2) { + len =3D (MAX_PACKET_LENGTH - 5) / 2; + } + + if (len < auxv_len - offset) { + g_string_assign(gdbserver_state.str_buf, "m"); + memtox(gdbserver_state.str_buf, mem, len); + } else { + g_string_assign(gdbserver_state.str_buf, "l"); + memtox(gdbserver_state.str_buf, mem, auxv_len - offset); + } + + put_packet_binary(gdbserver_state.str_buf->str, + gdbserver_state.str_buf->len, true); +} +#endif + static void handle_query_attached(GdbCmdContext *gdb_ctx, void *user_ctx) { put_packet(GDB_ATTACHED); @@ -2338,6 +2384,14 @@ static GdbCmdParseEntry gdb_gen_query_table[] =3D { .cmd_startswith =3D 1, .schema =3D "s:l,l0" }, +#ifdef CONFIG_USER_ONLY + { + .handler =3D handle_query_xfer_auxv, + .cmd =3D "Xfer:auxv:read::", + .cmd_startswith =3D 1, + .schema =3D "l,l0" + }, +#endif { .handler =3D handle_query_attached, .cmd =3D "Attached:", diff --git a/MAINTAINERS b/MAINTAINERS index d5ea7fbb8f..a4f04e19ca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2311,6 +2311,7 @@ R: Philippe Mathieu-Daud=C3=A9 S: Maintained F: gdbstub* F: gdb-xml/ +F: tests/tcg/multiarch/gdbstub/ =20 Memory API M: Paolo Bonzini diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Make= file.target index cb49cc9ccb..1dd0f64d23 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -55,6 +55,15 @@ run-gdbstub-sha1: sha1 "basic gdbstub support") =20 EXTRA_RUNS +=3D run-gdbstub-sha1 + +run-gdbstub-qxfer-auxv-read: sha1 + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ + "basic gdbstub qXfer:auxv:read support") + +EXTRA_RUNS +=3D run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read endif =20 =20 diff --git a/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py b/tests/tc= g/multiarch/gdbstub/test-qxfer-auxv-read.py new file mode 100644 index 0000000000..d91e8fdf19 --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py @@ -0,0 +1,57 @@ +from __future__ import print_function +# +# Test auxiliary vector is loaded via gdbstub +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb +import sys + +failcount =3D 0 + +def report(cond, msg): + "Report success/fail of test" + if cond: + print ("PASS: %s" % (msg)) + else: + print ("FAIL: %s" % (msg)) + global failcount + failcount +=3D 1 + +def run_test(): + "Run through the tests one by one" + + auxv =3D gdb.execute("info auxv", False, True) + report(isinstance(auxv, str), "Fetched auxv from inferior") + report(auxv.find("sha1"), "Found test binary name in auxv") + +# +# This runs as the script it sourced (via -x, via run-test.py) +# +try: + inferior =3D gdb.selected_inferior() + arch =3D inferior.architecture() + print("ATTACHED: %s" % arch.name()) +except (gdb.error, AttributeError): + print("SKIPPING (not connected)", file=3Dsys.stderr) + exit(0) + +if gdb.parse_and_eval('$pc') =3D=3D 0: + print("SKIP: PC not set") + exit(0) + +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): + print ("GDB Exception: %s" % (sys.exc_info()[0])) + failcount +=3D 1 + pass + +print("All tests complete: %d failures" % failcount) +exit(failcount) --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608291099; cv=none; d=zohomail.com; s=zohoarc; b=eZAGpLyhzQiok+oDUNj8wZ+EJy+SwOeaWua57d5Tj4Rsa9sE1MageG5RJQMxFIPIiGEu4d4XS8SOjg8qh9g3kTb57WzHA4J/oD0l351Q+HnxitJpplN84MLupb3zArfQF/GNijjhn45XtuqqmZIRMqIsccxvtDxJ8BRU6X+nQg4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608291099; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qzjSb7TtaIs2FGaM8dLD/lXODxjDnZRhX0kYxDeMf/0=; b=liGfMf+KpA2/YlXr7goHYCzyReYWwXt5oVeOHZqRv0SrEphYKTPkhJVGe5XvRer0fucLxGaOiA0dLUdIlolfmSYGYKhi/sRvmOSjS7zVRjaOV8PJDNKFWoZPY2e7MLvg5J/Qcgwyp+Yp5lcFisqnPqt+jGO0YWTptEF5H8xq/Ts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608291099565819.8884999029626; Fri, 18 Dec 2020 03:31:39 -0800 (PST) Received: from localhost ([::1]:47512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDz0-0003m6-FU for importer@patchew.org; Fri, 18 Dec 2020 06:31:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDur-0006yV-OS for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:21 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:51992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDuo-00036R-97 for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:21 -0500 Received: by mail-wm1-x32e.google.com with SMTP id v14so1992409wml.1 for ; Fri, 18 Dec 2020 03:27:17 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l8sm14438759wrb.73.2020.12.18.03.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4B2E21FF92; Fri, 18 Dec 2020 11:27:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qzjSb7TtaIs2FGaM8dLD/lXODxjDnZRhX0kYxDeMf/0=; b=YNJLCJRXjXXwKTGmY28f+WUCU2SQy4OYAGmw0Ib1c7z7of+wbB+uT54mksudMDrAzJ 42inANlaI9vm3wvbVKly6Z0gzz7dKYCymRM7rNLtRUdL2VyXdPGiw9uOHfdaCAlRwjA6 epzrw92BGHE7pa4fgaTV4ZxLrlyZam5twdvQId+fKY3qQlDM/e20HSW5lBA5nheUMf1u wI6fJCobxuBs82lpT2LjVrfKO12zNQ764MOzzM7xpzrkMO0pgLG1ycu72fljnnC5dIYR 4Ihq+LDLUulIr4sa1NUtgJqhA6LMRkE6JC9NDBHYbKqg6wvGWP6+7zQ7qMou1QAlJgoC 3prw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qzjSb7TtaIs2FGaM8dLD/lXODxjDnZRhX0kYxDeMf/0=; b=nij5U7qgBzr2pZfRh77NhFZLxtR5c1pEEbpI/nqTL6+l5pDd1SXHiAcEft4XXiUlbz t3kibXJNl48T8iRXQJGmDAZ/mXiUsmtmZ5ItkBd7s2ra4a+Hq+UkLNOqArD+SS9JDyC7 Wa+0JL4Fd5Q7FUvt86RcS4nJGItO/ffjTSQhLpEBu9dW1hAcrZ2PVGAZ9NTRJZpr16VS w6zxmmOAatk2otjCVdKi3uQ8UjdKw63H4ooW/Q8s0bwRwav+6wfShBQP1Dz6BVSh/+NL rVxZO01NZ3WgTKf3gxRlHzDejNtAKuEYws6gBTY723HbiFk/pgqG+1C+5DFPZg+IvuRM Ch+g== X-Gm-Message-State: AOAM532pL2TkZGCE79H8O0irYcJnEEq6+SmzOrZNWERAF8TVLns2C+2R YUkqhmz6E9SQ3RgDp7WBPrmThw== X-Google-Smtp-Source: ABdhPJy4wyjih1cGkYrZQ54n/6sGGNAFSz7yq85MgbSQA+ITp8lrccLTH7WSoV1mWw58F/s4MnfS2w== X-Received: by 2002:a1c:5410:: with SMTP id i16mr3889763wmb.30.1608290836832; Fri, 18 Dec 2020 03:27:16 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 6/9] gdbstub: drop CPUEnv from gdb_exit() Date: Fri, 18 Dec 2020 11:27:04 +0000 Message-Id: <20201218112707.28348-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Chris Wulff , Richard Henderson , Laurent Vivier , "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) gdb_exit() has never needed anything from env and I doubt we are going to start now. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20201214153012.12723-5-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/gdbstub.h | 2 +- bsd-user/syscall.c | 6 +++--- gdbstub.c | 2 +- linux-user/exit.c | 2 +- target/arm/arm-semi.c | 2 +- target/m68k/m68k-semi.c | 2 +- target/nios2/nios2-semi.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 94d8f83e92..492db0f512 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -46,7 +46,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const cha= r *fmt, ...); void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list = va); int use_gdb_syscalls(void); void gdb_set_stop_cpu(CPUState *cpu); -void gdb_exit(CPUArchState *, int); +void gdb_exit(int); #ifdef CONFIG_USER_ONLY /** * gdb_handlesig: yield control to gdb diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index d38ec7a162..adc3d21b54 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -333,7 +333,7 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi= _long arg1, #ifdef CONFIG_GPROF _mcleanup(); #endif - gdb_exit(cpu_env, arg1); + gdb_exit(arg1); qemu_plugin_atexit_cb(); /* XXX: should free thread stack and CPU env */ _exit(arg1); @@ -435,7 +435,7 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_= long arg1, #ifdef CONFIG_GPROF _mcleanup(); #endif - gdb_exit(cpu_env, arg1); + gdb_exit(arg1); qemu_plugin_atexit_cb(); /* XXX: should free thread stack and CPU env */ _exit(arg1); @@ -514,7 +514,7 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi= _long arg1, #ifdef CONFIG_GPROF _mcleanup(); #endif - gdb_exit(cpu_env, arg1); + gdb_exit(arg1); qemu_plugin_atexit_cb(); /* XXX: should free thread stack and CPU env */ _exit(arg1); diff --git a/gdbstub.c b/gdbstub.c index 15d3a8e1f5..afa553e8fc 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -3068,7 +3068,7 @@ static void gdb_read_byte(uint8_t ch) } =20 /* Tell the remote gdb that the process has exited. */ -void gdb_exit(CPUArchState *env, int code) +void gdb_exit(int code) { char buf[4]; =20 diff --git a/linux-user/exit.c b/linux-user/exit.c index 1594015444..70b344048c 100644 --- a/linux-user/exit.c +++ b/linux-user/exit.c @@ -34,6 +34,6 @@ void preexit_cleanup(CPUArchState *env, int code) #ifdef CONFIG_GCOV __gcov_dump(); #endif - gdb_exit(env, code); + gdb_exit(code); qemu_plugin_atexit_cb(); } diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index f7b7bff522..93360e28c7 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -1101,7 +1101,7 @@ target_ulong do_arm_semihosting(CPUARMState *env) */ ret =3D (args =3D=3D ADP_Stopped_ApplicationExit) ? 0 : 1; } - gdb_exit(env, ret); + gdb_exit(ret); exit(ret); case TARGET_SYS_SYNCCACHE: /* diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index 27600e0cc0..d919245e4f 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -195,7 +195,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr) args =3D env->dregs[1]; switch (nr) { case HOSTED_EXIT: - gdb_exit(env, env->dregs[0]); + gdb_exit(env->dregs[0]); exit(env->dregs[0]); case HOSTED_OPEN: GET_ARG(0); diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c index d7a80dd303..e508b2fafc 100644 --- a/target/nios2/nios2-semi.c +++ b/target/nios2/nios2-semi.c @@ -215,7 +215,7 @@ void do_nios2_semihosting(CPUNios2State *env) args =3D env->regs[R_ARG1]; switch (nr) { case HOSTED_EXIT: - gdb_exit(env, env->regs[R_ARG0]); + gdb_exit(env->regs[R_ARG0]); exit(env->regs[R_ARG0]); case HOSTED_OPEN: GET_ARG(0); --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608291142; cv=none; d=zohomail.com; s=zohoarc; b=IjdkbPH9jx4EqMhYXccQ30Nrlb7hEI/NSHcioRkOse5Sjz/DRZMd8ymhRpr4pvbsJitdhgKtneA4eAnMDKpC2fihJid2rL30g4YxBqzMM2vQVIGvDal4rQIzmPDkL4BCf/P/0ru6+Oeb18m/5Ta0dph8GNiyAqaD43ed73A3Y/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608291142; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yB8UJ3jgqS4qYz+f00mcHp/m9Q9/LaOQZNMtgdlHZX8=; b=awcMkOo4PwzTKc9H3TSVN7u72iD6MOrRd2L9SsZsuuGHgfkUNAdQ3RQqn37xqZehmhexlgNTaUZoKsrmy5lrpmLtbzOpAJoVIwwhQJCTsIvIfV+qzhegY5KHNYm/AMBCfaUL/hVos0URujPhC2ykc0Jo4lOrdwcdveOju4bBiNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608291142938302.99814674493666; Fri, 18 Dec 2020 03:32:22 -0800 (PST) Received: from localhost ([::1]:49980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDzh-0004qF-P6 for importer@patchew.org; Fri, 18 Dec 2020 06:32:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDut-000732-Jf for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:23 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:46216) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDur-00037v-LJ for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:23 -0500 Received: by mail-wr1-x431.google.com with SMTP id d13so1724855wrc.13 for ; Fri, 18 Dec 2020 03:27:21 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a17sm13644300wrs.20.2020.12.18.03.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 64C0D1FF93; Fri, 18 Dec 2020 11:27:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yB8UJ3jgqS4qYz+f00mcHp/m9Q9/LaOQZNMtgdlHZX8=; b=URHBHGEgkp9WV6Fb5bnoo1cMm+ZnrCfS8kPWdEEP8B4K62RUTf6zIFkCycgSAHU4DZ QrgJsA5vdtMG3DQ5iOicqYNHu9Brzv/pLhsRD+1tUDQ0muouCQoXIaSgt9+Zk1jP/q4i pOoSNabaFDOFNFXN43wMXASycDvTTV01DKSEa1y4bkO8jJlRd+sw6cNf5NcIFxNEMa9U FnSmTuH1YiWsLSRCc4b1V6ek9p0I3r/naiamUnnbDae7EMpVBu5sJb/6Cf2k7BTqJfX5 ATXn4JxIj8MKPPWu3LMk0GERphgZ5ZaAjHpid+o4vyS6twvp8SZeZDLFrVxiQF6hsYhq P8WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yB8UJ3jgqS4qYz+f00mcHp/m9Q9/LaOQZNMtgdlHZX8=; b=AqLg/uHenlmSr0gshRtqNR1qcCDp+RWKXnAxTS/NWilcgo3CEz+mleLK/ZpE1AhVTe aToi6sG44LlrVl5sIa0chZbYaBMs2MeTpxi/ZQ/iUJBcKsEzYw+DUTo9+w84hsbQZAOE YEmsRVl4DY3c6SfRDh0FugY5oDepOZ9VROy/Tpi2/JQC7mLhpQMVvV1YSzALqd9nM8pG vSaUNR4pf3IcGwFiwDL7Dl6lQjkHIX6jMq7UbG88CfX1I3FM6hVPZ0ZtxRohmZppYjb9 Uhcie0hPnCxXP/ZfSxRh63iUXcrNFZ1SdWDBFgqcHVAz90DSUbciY9zV3TzYC+8q1ytO nvmg== X-Gm-Message-State: AOAM533EzP0xbJH7xJZZEYC4M5m1GEQT5hHM+zVLLohtsAIos9eyGEup YEbPONzhnqIudLJ0O+yzon0ZOYBu+x9xEA== X-Google-Smtp-Source: ABdhPJy1mh9Z1uvlU/eDKZazlXNNwoznimOxYhmoIZG7xJkbiOZtEtspjMi2SZiLCjbiW3IEk0Yggg== X-Received: by 2002:a5d:5227:: with SMTP id i7mr4086919wra.68.1608290840147; Fri, 18 Dec 2020 03:27:20 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 7/9] gdbstub: drop gdbserver_cleanup in favour of gdb_exit Date: Fri, 18 Dec 2020 11:27:05 +0000 Message-Id: <20201218112707.28348-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Despite it's name it didn't actually clean-up so let us document gdb_exit() better and use that. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20201214153012.12723-6-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/gdbstub.h | 14 +++++++++++--- gdbstub.c | 7 ------- softmmu/runstate.c | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 492db0f512..ff0b7bc45e 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -46,7 +46,17 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const ch= ar *fmt, ...); void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list = va); int use_gdb_syscalls(void); void gdb_set_stop_cpu(CPUState *cpu); -void gdb_exit(int); + +/** + * gdb_exit: exit gdb session, reporting inferior status + * @code: exit code reported + * + * This closes the session and sends a final packet to GDB reporting + * the exit status of the program. It also cleans up any connections + * detritus before returning. + */ +void gdb_exit(int code); + #ifdef CONFIG_USER_ONLY /** * gdb_handlesig: yield control to gdb @@ -187,8 +197,6 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf= , int len) */ int gdbserver_start(const char *port_or_device); =20 -void gdbserver_cleanup(void); - /** * gdb_has_xml: * This is an ugly hack to cope with both new and old gdb. diff --git a/gdbstub.c b/gdbstub.c index afa553e8fc..bab8476357 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -3547,13 +3547,6 @@ int gdbserver_start(const char *device) return 0; } =20 -void gdbserver_cleanup(void) -{ - if (gdbserver_state.init) { - put_packet("W00"); - } -} - static void register_types(void) { type_register_static(&char_gdb_type_info); diff --git a/softmmu/runstate.c b/softmmu/runstate.c index 636aab0add..6177693a30 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -775,7 +775,7 @@ void qemu_init_subsystems(void) =20 void qemu_cleanup(void) { - gdbserver_cleanup(); + gdb_exit(0); =20 /* * cleaning up the migration object cancels any existing migration --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608291364; cv=none; d=zohomail.com; s=zohoarc; b=kR56lFtSiJRM+B4dufGqMCCJ7DlNES9g4MYgO2A51bhjobrJJVXeFInLa9pA4euGFvuy8uLm/FELsJHqjEiHoGu+Jy0jQs0Ia22bCAiaLdlxr9uN1FJ03yClNwaBV4sLvfQPrKZEtq9M0Elo1nsSe8lhfAGtC4T84ZMOFc+49O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608291364; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bivVxysPoShSEEWKqw3fiXD1Ck9vv/6yITEBjJAWoPE=; b=Q3hD4R/PtO8LfMCIDiF1f4hxrYcxENxxowgxWLp9/iCPjbJYXG9pVr+myF+RmiplXYCWddwM7DD2momSjxeZQ/EfQb270FEBQEiXHfbj0q1m9y7YtHAMJlcd/tXPsE+vJcf7AMXOof0SeTNsVp4+Cjkvhue+XkPo0sVkiVn2gck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608291364745278.45300373030864; Fri, 18 Dec 2020 03:36:04 -0800 (PST) Received: from localhost ([::1]:59558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqE3H-0000Uk-Je for importer@patchew.org; Fri, 18 Dec 2020 06:36:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDus-0006zj-8z for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:22 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:39779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDuq-00036l-HP for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:21 -0500 Received: by mail-wm1-x336.google.com with SMTP id 3so2182625wmg.4 for ; Fri, 18 Dec 2020 03:27:19 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o8sm12958307wrm.17.2020.12.18.03.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 78AE01FF96; Fri, 18 Dec 2020 11:27:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bivVxysPoShSEEWKqw3fiXD1Ck9vv/6yITEBjJAWoPE=; b=r6unnJUbLZtCcIZnGe+vkmUZMkDFaSYYlNRZI+GNlccI/7hh3C1SrX5WeCQXY5LNUQ 7ksJllMSVLUrnKP4zq6WBvBQ+/a/VNUu7P/FlWER1fDmPI/CkFysFnR6QhKpOO48mpAe ZG9U+/3iG4yc/1zybZk4lBGorbSmDcKrmsWkzfPuwQj+ej9SXTagKsPcgrvuUJYTBDfL pUl/MA3D+kCP+EvJPv8ljyKGd0SRjZIJD46DNdA5j1t1f310ojK1oivFcgb6Anc3LVvr 0dBDfJTRObwC6z4StQMVWeqlZbI6f+JN29phP5llITZ/o+A4+c1JKIXJHx2JUrK48OVU y9yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bivVxysPoShSEEWKqw3fiXD1Ck9vv/6yITEBjJAWoPE=; b=nggGmrmyzN9vgh3aS5y/VVcvuVTOAieg1ABah+sX31VRN/LTc2RXyUvFyR85Xg+dSe lAf9HPwZkoMeVY6ApWarf8qhgJo2phSyw/7X9dyLQ2jHirGIaNK7VAsxhrpYxOMXxws+ kAxPM45225JXO2ZYQ0/ztFj8cObi8fN133BYncL4jcMMQvM2/Z6X7gSSUD0flQoJlaEx n073S7aDxx6iWFx1/uwoozQkk7PfAnj+6duIn7C0tHDNnX0IkUkIw6QzA0s2tjvax5Ue p6Q0jxWiQMo0FzzSvWFtDkwJgRA9t+8FJrfMPRHefVTSosxfYuvpmtjiOnJox/qkZfeH +hhg== X-Gm-Message-State: AOAM532p9SnM0Keu1v6aiCA6uYiW8LhbrS/s0mMp845YlpEb0mKKXPeX +S1olQDA+bC+9Qd0exvZsKSfsbGJIKfF/A== X-Google-Smtp-Source: ABdhPJwFdhr8lmdbpfqGhDc7ecrds4IuT4FTzJemIXF28TVfzeko8IPeNwD8FvPZIzxbO+BxiSM+dA== X-Received: by 2002:a1c:3b02:: with SMTP id i2mr3682481wma.141.1608290838066; Fri, 18 Dec 2020 03:27:18 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 8/9] gdbstub: ensure we clean-up when terminated Date: Fri, 18 Dec 2020 11:27:06 +0000 Message-Id: <20201218112707.28348-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) If you kill the inferior from GDB we end up leaving our socket lying around. Fix this by calling gdb_exit() first. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20201214153012.12723-7-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- gdbstub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index bab8476357..8c301edf32 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1978,6 +1978,7 @@ static void handle_v_kill(GdbCmdContext *gdb_ctx, voi= d *user_ctx) /* Kill the target */ put_packet("OK"); error_report("QEMU: Terminated via GDBstub"); + gdb_exit(0); exit(0); } =20 @@ -2539,6 +2540,7 @@ static int gdb_handle_packet(const char *line_buf) case 'k': /* Kill the target */ error_report("QEMU: Terminated via GDBstub"); + gdb_exit(0); exit(0); case 'D': { --=20 2.20.1 From nobody Sat May 18 21:16:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608291156; cv=none; d=zohomail.com; s=zohoarc; b=QGAUUv+CbucP2OHvsqjuFrmf2hTNjhmSszJAhtlwsgyI7n+tfNuLh9hN5tQn2476ImNcn70ctwZ8fgJ6x2gjBjygDFI3LjveGPjUN9p8IorFTGdGUAmHyX9LPiZWbpyBvy+87jPHBD+Lf9C/Uj6SGbIL1SsxOjugh7NoMPGGZgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608291156; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6NSRnSlmnhaO7uroZIq5QNa4woFGPYOMJTjkY2C6pnY=; b=An+4B227Mx+cGnMlVcBCy3Ox8oIWx91RCs8tggoaOYkht0aw2dzi0iox2kGSfZXkd7a8ESTuEYKaSfJPpqLIO3mZZNQIXLIrpi5bhnxj7DNxV0JaOuSdrUKGEaXuqw9D8YUNt79cp/RNd7cFFUbJzRtgC52VH0p+hFerFg7Jdfs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608291156812273.0708856401209; Fri, 18 Dec 2020 03:32:36 -0800 (PST) Received: from localhost ([::1]:51246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDzv-0005Mq-NT for importer@patchew.org; Fri, 18 Dec 2020 06:32:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqDuw-00079E-Ax for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:26 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:35915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqDuu-000399-4d for qemu-devel@nongnu.org; Fri, 18 Dec 2020 06:27:26 -0500 Received: by mail-wr1-x431.google.com with SMTP id t16so1767301wra.3 for ; Fri, 18 Dec 2020 03:27:23 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o13sm10681961wmc.44.2020.12.18.03.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:27:14 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 909B31FF98; Fri, 18 Dec 2020 11:27:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6NSRnSlmnhaO7uroZIq5QNa4woFGPYOMJTjkY2C6pnY=; b=ASCm8sFei1seHt7FtJAOyREzGJQFp/ZN5JfIgwE1WYv/k1L3ePnl2W9kTzjJ1JH22/ I3qH1biEH21B+ABF0jwkWBJn3ObT/c1SH71eg71msjfvePeS4OoUgZR+BZdjO19bkbIa 67ETD98lbhL2DB3y/wEj/LE04wSxO8MFxPVyH7nBHPaAFIJNaOhhqqSumtO19e00AfHe 1C23MvzfC3kuAJ30KC9Eoy642E5RX8md/5Rtuykgia87jhZmke6Qhkg3brAqnMMbxLgO 8YCxDJQ1MktnMTfZTplk9QdW18gkQuqbpcuy5deT6/KD3GICEFg197HJh4IyhmK8sZbT 7cuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6NSRnSlmnhaO7uroZIq5QNa4woFGPYOMJTjkY2C6pnY=; b=KIrYhNIa1nnJcikiy7r/PWTFhMlP1iOlT2AFZrUNoKlL9Zcghh8CdubnvCPEVrjJ0P p4pA46YmbwROAtROE/oBB4zkQpVHfWN0J0qzPD3DTlWMNlRykEwPrNL1XktMvXeq76WY 54rJk6bIlHMDxVtfk0op3m/FT2iV1cLJQVPa2pEiCBHzBRoYUfUs3zrBt90mxju8/3i7 OACv8PCIig2feN1QNDx0E1ZFNVSk/doKdkqAAkKUjPgUEfZQFzw2a5NDsWOJMYO1KvxV Oza2EdcMNFjyf7LetsN+aKSsp64qfvzs/YJsV5WdzcRtoW+tIbAS+OYQEU0/KZ8IlRT6 HW5w== X-Gm-Message-State: AOAM532OA1rOjJYSsb+QURegC2UJisjAOZIGbMNCiSq61fXDCar5tull Adaq0KRfdgZfQHs/dLPZl//H2g== X-Google-Smtp-Source: ABdhPJx/MjkTIdE5Ra4gg3H/6bEDIbKhjhZF2+GTdhzPzCxHYYZJGNu7MgxCABNnNHNlHqvHMoqDzA== X-Received: by 2002:adf:9d49:: with SMTP id o9mr3941424wre.413.1608290842800; Fri, 18 Dec 2020 03:27:22 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 9/9] target/arm: use official org.gnu.gdb.aarch64.sve layout for registers Date: Fri, 18 Dec 2020 11:27:07 +0000 Message-Id: <20201218112707.28348-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201218112707.28348-1-alex.bennee@linaro.org> References: <20201218112707.28348-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Luis Machado , "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) While GDB can work with any XML description given to it there is special handling for SVE registers on the GDB side which makes the users life a little better. The changes aren't that major and all the registers save the $vg reported the same. All that changes is: - report org.gnu.gdb.aarch64.sve - use gdb nomenclature for names and types - minor re-ordering of the types to match reference - re-enable ieee_half (as we know gdb supports it now) - $vg is now a 64 bit int - check $vN and $zN aliasing in test [NOTE: there seems a limitation on the indexing of the pseudo $vN registers which I'm not sure if it's intentional] Signed-off-by: Alex Benn=C3=A9e Cc: Luis Machado --- target/arm/gdbstub.c | 75 ++++++++------------- target/arm/helper.c | 2 +- tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 11 +++ 3 files changed, 41 insertions(+), 47 deletions(-) diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index 866595b4f1..a8fff2a3d0 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -195,22 +195,17 @@ static const struct TypeSize vec_lanes[] =3D { { "uint128", 128, 'q', 'u' }, { "int128", 128, 'q', 's' }, /* 64 bit */ + { "ieee_double", 64, 'd', 'f' }, { "uint64", 64, 'd', 'u' }, { "int64", 64, 'd', 's' }, - { "ieee_double", 64, 'd', 'f' }, /* 32 bit */ + { "ieee_single", 32, 's', 'f' }, { "uint32", 32, 's', 'u' }, { "int32", 32, 's', 's' }, - { "ieee_single", 32, 's', 'f' }, /* 16 bit */ + { "ieee_half", 16, 'h', 'f' }, { "uint16", 16, 'h', 'u' }, { "int16", 16, 'h', 's' }, - /* - * TODO: currently there is no reliable way of telling - * if the remote gdb actually understands ieee_half so - * we don't expose it in the target description for now. - * { "ieee_half", 16, 'h', 'f' }, - */ /* bytes */ { "uint8", 8, 'b', 'u' }, { "int8", 8, 'b', 's' }, @@ -223,17 +218,16 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base= _reg) GString *s =3D g_string_new(NULL); DynamicGDBXMLInfo *info =3D &cpu->dyn_svereg_xml; g_autoptr(GString) ts =3D g_string_new(""); - int i, bits, reg_width =3D (cpu->sve_max_vq * 128); + int i, j, bits, reg_width =3D (cpu->sve_max_vq * 128); info->num =3D 0; g_string_printf(s, ""); g_string_append_printf(s, "= "); - g_string_append_printf(s, ""); + g_string_append_printf(s, ""); =20 /* First define types and totals in a whole VL */ for (i =3D 0; i < ARRAY_SIZE(vec_lanes); i++) { int count =3D reg_width / vec_lanes[i].size; - g_string_printf(ts, "vq%d%c%c", count, - vec_lanes[i].sz, vec_lanes[i].suffix); + g_string_printf(ts, "svev%c%c", vec_lanes[i].sz, vec_lanes[i].suff= ix); g_string_append_printf(s, "", ts->str, vec_lanes[i].gdb_type, count); @@ -243,39 +237,37 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base= _reg) * signed and potentially float versions of each size from 128 to * 8 bits. */ - for (bits =3D 128; bits >=3D 8; bits /=3D 2) { - int count =3D reg_width / bits; - g_string_append_printf(s, "", count); - for (i =3D 0; i < ARRAY_SIZE(vec_lanes); i++) { - if (vec_lanes[i].size =3D=3D bits) { - g_string_append_printf(s, "", - vec_lanes[i].suffix, - count, - vec_lanes[i].sz, vec_lanes[i].suffi= x); + for (bits =3D 128, i =3D 0; bits >=3D 8; bits /=3D 2, i++) { + const char suf[] =3D { 'q', 'd', 's', 'h', 'b' }; + g_string_append_printf(s, "", suf[i]); + for (j =3D 0; j < ARRAY_SIZE(vec_lanes); j++) { + if (vec_lanes[j].size =3D=3D bits) { + g_string_append_printf(s, "", + vec_lanes[j].suffix, + vec_lanes[j].sz, vec_lanes[j].suffi= x); } } g_string_append(s, ""); } /* And now the final union of unions */ - g_string_append(s, ""); - for (bits =3D 128; bits >=3D 8; bits /=3D 2) { - int count =3D reg_width / bits; - for (i =3D 0; i < ARRAY_SIZE(vec_lanes); i++) { - if (vec_lanes[i].size =3D=3D bits) { - g_string_append_printf(s, "", - vec_lanes[i].sz, count); - break; - } - } + g_string_append(s, ""); + for (bits =3D 128, i =3D 0; bits >=3D 8; bits /=3D 2, i++) { + const char suf[] =3D { 'q', 'd', 's', 'h', 'b' }; + g_string_append_printf(s, "", + suf[i], suf[i]); } g_string_append(s, ""); =20 + /* Finally the sve prefix type */ + g_string_append_printf(s, + "", + reg_width / 8); + /* Then define each register in parts for each vq */ for (i =3D 0; i < 32; i++) { g_string_append_printf(s, "", + " regnum=3D\"%d\" type=3D\"svev\"/>", i, reg_width, base_reg++); info->num++; } @@ -287,31 +279,22 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base= _reg) " regnum=3D\"%d\" group=3D\"float\"" " type=3D\"int\"/>", base_reg++); info->num +=3D 2; - /* - * Predicate registers aren't so big they are worth splitting up - * but we do need to define a type to hold the array of quad - * references. - */ - g_string_append_printf(s, - "", - cpu->sve_max_vq); + for (i =3D 0; i < 16; i++) { g_string_append_printf(s, "", + " regnum=3D\"%d\" type=3D\"svep\"/>", i, cpu->sve_max_vq * 16, base_reg++); info->num++; } g_string_append_printf(s, "", + " type=3D\"svep\"/>", cpu->sve_max_vq * 16, base_reg++); g_string_append_printf(s, "", + " regnum=3D\"%d\" type=3D\"int\"/>", base_reg++); info->num +=3D 2; g_string_append_printf(s, ""); diff --git a/target/arm/helper.c b/target/arm/helper.c index 7b8bcd6903..8633b3eef6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -276,7 +276,7 @@ static int arm_gdb_get_svereg(CPUARMState *env, GByteAr= ray *buf, int reg) * while the ZCR works in Vector Quads (VQ) which is 128bit chunks. */ int vq =3D sve_zcr_len_for_el(env, arm_current_el(env)) + 1; - return gdb_get_reg32(buf, vq * 2); + return gdb_get_reg64(buf, vq * 2); } default: /* gdbstub asked for something out our range */ diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch6= 4/gdbstub/test-sve-ioctl.py index 972cf73c31..f8cdab2e14 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py @@ -40,6 +40,17 @@ class TestBreakpoint(gdb.Breakpoint): except gdb.error: report(False, "checking zregs (out of range)") =20 + # check the v pseudo regs - I'm not sure if them capping out + # at [15] is intentional though. + try: + for i in range(0, 16): + val_z =3D gdb.parse_and_eval("$z0.b.u[%d]" % i) + val_v =3D gdb.parse_and_eval("$v0.b.u[%d]" % i) + report(int(val_z) =3D=3D int(val_v), + "v0.b.u[%d] =3D=3D z0.b.u[%d]" % (i, i)) + except gdb.error: + report(False, "checking vregs (out of range)") + =20 def run_test(): "Run through the tests one by one" --=20 2.20.1