From patchwork Fri Dec 18 11:26:59 2020 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: 345456 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2063579ejs; Fri, 18 Dec 2020 03:28:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx31DwQay0v/wA5epvquXVcE0/nZakh5IlpmvVrc7akBJON6cPdTuekGNJfx9yJWmvxZEKG X-Received: by 2002:a25:253:: with SMTP id 80mr5754041ybc.385.1608290890998; Fri, 18 Dec 2020 03:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608290890; cv=none; d=google.com; s=arc-20160816; b=N3KMUA5TlRlnjKRlMTLDbpYrzODZaxKu/Qhp0kBOheQlzJP2MqgmLAX9P9CGeVMC/Z N/e/k8L7Qpxu8ZBGwKd9rhLm7yei7xA6MHTYVIUOO5r6n1psy9vsQAqSDfDi+F1CBjVN vIHPx5/lPWjiuGNWz8f3mhLMDk+67L53MB+YwXTialR31BV0SknEvktdpM1y0ci57gxe fKQ5BMFVlXllq4LMpX1s9LLSe4vwof4d21A2X1hPa6z7GkoFKSqXpq6Dsmi5xbpu9y39 hWnm5IO0EQBi0S8+Zkw95Tyf11/YKqKUaZHMQ+kIHoeDsPSkF9N7Y59ELZr9BtfFDmoH oOww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=bUNDzMEHp2bJw/cEZs6exTqnUgdBKWbnqrvMaXEkx3E=; b=xvt0uB5xtK6wpZ3MyRbx8F/n891InBBVUTmLEE8aER7Qc7UCxei3mjgoc6TcS40Mjq LLdeabJdxR+3ZaVAwxVOeuRWcrLuC4EtcHxkqq/fUDY4buiM4CtRpEDHYbKUFRUQcg1x 4YD4C2L094NrzUhF2tPYNAY+EcO1ZCqS+StjS7jBYLVk7jhhBFV40JPflf2tVRp2jn8Z 0ADJnTk7rlO9UyA/JO09QmRV5/lhejTpIC6bigHIIIqm8RwRxVifgY5f5lNMjDAjDTTP IOvEzUS92swQybvwDYe2G/qWcdKRdKIIvnY/6dMSa/yVukytiuMopqb37CtYjRIC1Yzc WhWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M4F3jxwk; 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 p3si8057864ybm.373.2020.12.18.03.28.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:28:10 -0800 (PST) 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=M4F3jxwk; 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]:35042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDve-0006pp-A0 for patch@linaro.org; Fri, 18 Dec 2020 06:28:10 -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) 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-Received: by 2002:adf:db44:: with SMTP id f4mr3847147wrj.169.1608290830704; Fri, 18 Dec 2020 03:27:10 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This helps with debugging. Signed-off-by: Alex Bennée Message-Id: <20201214153012.12723-2-alex.bennee@linaro.org> Signed-off-by: Alex Bennée --- tests/guest-debug/run-test.py | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 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__ == '__main__': cmd = "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, args.binary) + print("QEMU CMD: %s" % (cmd)) inferior = subprocess.Popen(shlex.split(cmd)) # Now launch gdb with our test and collect the result From patchwork Fri Dec 18 11:27:00 2020 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: 345455 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2063216ejs; Fri, 18 Dec 2020 03:27:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwARviY5lfEIuAqkQCEXYSNgjy+K+IrNrHZDVHz5PjU0EAbkVRMNiLXYt6uAApQ6jZc3Hce X-Received: by 2002:a5b:990:: with SMTP id c16mr5527526ybq.381.1608290852986; Fri, 18 Dec 2020 03:27:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608290852; cv=none; d=google.com; s=arc-20160816; b=0d3IDXfWsk94o20sGTs08uBR200UZ6XZiW9/dk3X2q2UmGOz1/2Zi+JZS9lxBjF20W x10LnMHSskqtw09ea0HE5iMEaiQlpO+Z8o9Zg4CcSGQVubUCwq4N2C7mr9wJkx9jzXXT S4qVPzcNr9rBFrFLccXnKSjknBTkjNgWvmvYXKBodEtjrr4NEkgMBd+WQUKjfSO3PWGl bXt0AD2CgEdN8mu33oNLsJf7gJCYimb4F5DCe+jITuV1xxoi/WwunxwH027vZvsOCBmU SpdayvqyjAwYi1RD+C4vjMs6SQZ+m7/nYaDS6lfdzfjfjDL8i5IYiaeaJKJ5jfIL0Q1W ViFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=4YR3FKqEiht5wvA3fKDaBjYa36uQEgaaAETgD0fHI+Y=; b=vxDuO7gdJgPU1Va/BQdsw2p9ii7NTsFOzkJPYJ59rAmmjGxfuFNFV3pLzjkb64RvWC YeYLyXiG6DQwGhhN1dFDrpJKWCWHzbjhazaORdwULIT0NGSbDLU3EP7oobRzSxAbbfRC rOKVlc7P1feJUgAy45B3GwpDQr3QYncTqItF6TJfpFffY0hMBb61AbDrB4UfOPxNEkwn L6G3h9WM+WpqGi5up+BGLLTZhubMZbB+bfo3J3W0AoKtaUk4L8nVcz814oeXG4bpX8bM HqVmcC4NCL9ffCCQjec6rLOiMXDdHkJB4H4IBbwzIysTAc1LK1aURDUIWmFZyyOm9SFN iLuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=koRo8mbc; 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 s23si8625234ybc.142.2020.12.18.03.27.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:27:32 -0800 (PST) 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=koRo8mbc; 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]:35072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDv2-0006qx-Bl for patch@linaro.org; Fri, 18 Dec 2020 06:27:32 -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) 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-Received: by 2002:a7b:c385:: with SMTP id s5mr3761945wmj.170.1608290832518; Fri, 18 Dec 2020 03:27:12 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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=$HOME/src/binutils-gdb.git/builds/all/install/bin/gdb Signed-off-by: Alex Bennée Message-Id: <20201214153012.12723-3-alex.bennee@linaro.org> --- v2 - reword intention --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 0e542b4c46..07df350e06 100755 --- a/configure +++ b/configure @@ -6676,8 +6676,11 @@ if test "$plugins" = "yes" ; then fi fi -if test -n "$gdb_bin" ; then - echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak +if test -n "$gdb_bin"; then + gdb_version=$($gdb_bin --version | head -n 1) + if version_ge ${gdb_version##* } 8.3.1; then + echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak + fi fi if test "$secret_keyring" = "yes" ; then From patchwork Fri Dec 18 11:27:01 2020 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: 345457 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2063649ejs; Fri, 18 Dec 2020 03:28:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzP4pnIhR9d2CEv5pyf1agBv+uhxdRKwoJKkj5RoODPA9vSOVSWcPkVM+dPNyr3V4ZV4sXT X-Received: by 2002:a25:25c2:: with SMTP id l185mr5340291ybl.140.1608290896981; Fri, 18 Dec 2020 03:28:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608290896; cv=none; d=google.com; s=arc-20160816; b=Gs2eiuwNiasEnbnJqZ/YX64M2TuEFMfPotuTxVEGAmq24vge0RYz1v202FGSnPbPyi hNohOdVp71fZgRC8WWC3G/IsPcoETEU/ijyO+TBoBbIJWX+1xIZXoOLyruL3LTVPZRsk m3+8jTdb+rILziHcl3WOhqZ48UV6pLnzz2b9T/vmIpFsC2QxP0BwK2+0SnxXl2EDsjFU AA5HHmUCLG7mUBqX+/J5eY/vgRRXsk16aGVcNl4MzvF5MBk+2//lGl2o+dnuV3Oh1jOo oex+lcdXbqOA6R3awXO/ByEc4mnjT+cJlAMPcYHZRokiDNuoNoaOvtpljea8my8siNbg O+PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=52j5UDdkQCGobtG+iJtsfKQkVY+3DyC1b4VXquCpK3c=; b=ivk0iKI0K5CxnCWklRc2mfSglOJpxSMgziX61E1EW82LFm94y9S8FgeFHIYNsBbP9j yhDZkujIecoZx0+BMKz8s3gcGgeMRcLWCg1odxh3AiZsslcZgklUSDTEegoAgSc05tOw rXfPBRDeg40AzQvTo2KEcBA30PjD/vooqZ/H5X1Jv2GNEWUXbH1T6KaUoJioq6/sT3p4 23hxF0BcYf7mYEAUnpPyMtMZOYL6Uq2FAhlBKBQGLSishTC5Fxrc2+4F986XIxmKXp5y pMKkeRUxfG/JJdL3vaWLN3vtCyuoycZ//fxLUwYBEjQpOOHf0mgnlXH8FT8zllgSPY52 5PzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H+BkBVJ1; 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 d59si9166022ybi.479.2020.12.18.03.28.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:28:16 -0800 (PST) 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=H+BkBVJ1; 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]:37936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDvk-00085I-AT for patch@linaro.org; Fri, 18 Dec 2020 06:28:16 -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) 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-Received: by 2002:a1c:8016:: with SMTP id b22mr3717021wmd.135.1608290833454; Fri, 18 Dec 2020 03:27:13 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- tests/tcg/multiarch/Makefile.target | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.20.1 diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.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") -# Disable this for now -- it provokes a gdb internal-error on -# Ubuntu gdb 8.1.1-0ubuntu1. -# EXTRA_RUNS += run-gdbstub-sha1 +EXTRA_RUNS += run-gdbstub-sha1 endif From patchwork Fri Dec 18 11:27:02 2020 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: 345461 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2066606ejs; Fri, 18 Dec 2020 03:32:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJySEgpcHSa1JGZkP08U019HUv39dD7FTp0IwRrX5tmoSmTPSrGRlahHSbBU2RoYgyMTrP3K X-Received: by 2002:a25:5f49:: with SMTP id h9mr5282354ybm.99.1608291155115; Fri, 18 Dec 2020 03:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608291155; cv=none; d=google.com; s=arc-20160816; b=kpnhNGEO6Gd7KHF2Gy7u1sfIi/we7iUeD8ak6P4dfSuhQGbkYjfoKyRBbVQ+plg3dD RQeZoQJPk8kkL7zwV7qykPzpZv3mw69Ogn/AdK6AVmKCvjpP2nyt/SjsJ7lw+m4C3Ui3 iW0wx/9+nG6CZT9cu6oxsuP4wMyXN/2JzpjYY1dIAX6/38j1nOPzf679rZPj41KCZs31 qSmMy3/JqqJtMF6Ht23dJcSVp6y3zAylXaUAl1/phVTAjIgObH802Ttif7WmbULeU7b2 gXG6jL3Rcd9qt27WojQmOAkhFzOd79XLicbW4VfwpM6G/hT8qbM7m1gsktZxGLWCXgjs H4ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=/fELguAheXJjKTQbYC8Vu+DxW5f+wKRNI1HhgpsaCyI=; b=XUXyqteGXJhuXqP9aSph7F/g02S6RJ4Ho2Wz2jQizmJ4FH15HLInK22d13kiF7n/Kr X5a/bfRtGtZtcffdb5+WGX4xk1QxSTdC3SQIORcV4Rn4A2QTcCmJvrWauNJlt55FKDmo eP/f9y0//WFHbONTgnlwRXQAvinO+EKq2RC96Xh9+gMl9YArawGwaYMjNXWjJoiRGq70 oAIwpQ2Z6kIeRD8xGPtstbfVAwMUKWUAjJCB2CRBqLmwntCl9MFTthVnwuacdP3ngdmI Svz77LtGUhJX9DdsD4Dr+W2Fac8g8dcyf02fSKrC8qLshWv4U9wyZCewBWeGp94cffmx xK4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ec69LCWQ; 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=fail (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 v8si7519089ybp.79.2020.12.18.03.32.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:32:35 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=Ec69LCWQ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDzu-0005Xt-ED for patch@linaro.org; Fri, 18 Dec 2020 06:32:34 -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) 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-Received: by 2002:a5d:4f90:: with SMTP id d16mr3902807wru.120.1608290835639; Fri, 18 Dec 2020 03:27:15 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , Richard Henderson , "open list:ARM TCG CPUs" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- 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 -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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 def get_args(): @@ -27,10 +28,21 @@ def get_args(): required=True) parser.add_argument("--test", help="GDB test script", required=True) - parser.add_argument("--gdb", help="The gdb binary to use", default=None) + parser.add_argument("--gdb", help="The gdb binary to use", + default=None) + parser.add_argument("--output", help="A file to redirect output to") return parser.parse_args() + +def log(output, msg): + if output: + output.write(msg + "\n") + output.flush() + else: + print(msg) + + if __name__ == '__main__': args = get_args() @@ -42,18 +54,25 @@ if __name__ == '__main__': if not args.gdb: print("We need gdb to run the test") exit(-1) + if args.output: + output = open(args.output, "w") + else: + output = None socket_dir = TemporaryDirectory("qemu-gdbstub") socket_name = os.path.join(socket_dir.name, "gdbstub.socket") # Launch QEMU with binary if "system" in args.qemu: - cmd = "%s %s %s -s -S" % (args.qemu, args.qargs, args.binary) + cmd = "%s %s %s -gdb unix:path=%s,server" % (args.qemu, + args.qargs, + args.binary, + socket_name) else: cmd = "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, args.binary) - print("QEMU CMD: %s" % (cmd)) + log(output, "QEMU CMD: %s" % (cmd)) inferior = subprocess.Popen(shlex.split(cmd)) # Now launch gdb with our test and collect the result @@ -63,16 +82,15 @@ if __name__ == '__main__': # disable prompts in case of crash gdb_cmd += " -ex 'set confirm off'" # connect to remote - if "system" in args.qemu: - gdb_cmd += " -ex 'target remote localhost:1234'" - else: - gdb_cmd += " -ex 'target remote %s'" % (socket_name) + gdb_cmd += " -ex 'target remote %s'" % (socket_name) # finally the test script itself gdb_cmd += " -x %s" % (args.test) - print("GDB CMD: %s" % (gdb_cmd)) - result = subprocess.call(gdb_cmd, shell=True); + sleep(1) + log(output, "GDB CMD: %s" % (gdb_cmd)) + + result = subprocess.call(gdb_cmd, shell=True, stdout=output) # 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=$(AARCH64_SYSTEM_SRC) LINK_SCRIPT=$(AARCH64_SYSTEM_SRC)/kernel.ld LDFLAGS=-Wl,-T$(LINK_SCRIPT) TESTS+=$(AARCH64_TESTS) $(MULTIARCH_TESTS) +EXTRA_RUNS+=$(MULTIARCH_RUNS) CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc diff --git a/tests/tcg/aarch64/system/boot.S b/tests/tcg/aarch64/system/boot.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 /* pass return value to sys exit */ +_exit: mov x1, x0 ldr x0, =0x20026 /* ADP_Stopped_ApplicationExit */ stp x0, x1, [sp, #-16]! diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.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+=-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc TESTS+=$(MULTIARCH_TESTS) +EXTRA_RUNS+=$(MULTIARCH_RUNS) # 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 - /* 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/gdbstub/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 = 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) + + +# +# 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 = gdb.lookup_symbol(sym_name) + bp = gdb.Breakpoint(sym_name, gdb.BP_BREAKPOINT) + + gdb.execute("c") + + # hopefully we came back + end_pc = gdb.parse_and_eval('$pc') + report(bp.hit_count == 1, + "break @ %s (%s %d hits)" % (end_pc, sym.value(), bp.hit_count)) + + bp.delete() + + +def do_one_watch(sym, wtype, text): + + wp = gdb.Breakpoint(sym, gdb.BP_WATCHPOINT, wtype) + gdb.execute("c") + report_str = "%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 = 0 + for i in range(3): + if check_step(): + step_ok += 1 + + report(step_ok == 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 = gdb.Breakpoint("_exit", gdb.BP_BREAKPOINT) + + check_break("main") + check_watches("test_data[128]") + + report(cbp.hit_count == 0, "didn't reach backstop") + +# +# 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) + +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 += 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. # -MULTIARCH_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/multiarch/system +MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch +MULTIARCH_SYSTEM_SRC=$(MULTIARCH_SRC)/system VPATH+=$(MULTIARCH_SYSTEM_SRC) MULTIARCH_TEST_SRCS=$(wildcard $(MULTIARCH_SYSTEM_SRC)/*.c) MULTIARCH_TESTS = $(patsubst $(MULTIARCH_SYSTEM_SRC)/%.c, %, $(MULTIARCH_TEST_SRCS)) + +ifneq ($(HAVE_GDB_BIN),) +GDB_SCRIPT=$(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=$<.out$(COMMA)id=output $(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \ + "softmmu gdbstub support") + +MULTIARCH_RUNS += run-gdbstub-memory +endif diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Makefile.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+=-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc TESTS+=$(MULTIARCH_TESTS) +EXTRA_RUNS+=$(MULTIARCH_RUNS) # 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 - /* 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 From patchwork Fri Dec 18 11:27:03 2020 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: 345463 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2069842ejs; Fri, 18 Dec 2020 03:37:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+nr0kOX2uoxCSgUecu1E7HzWt+66nb11vhax2uqW9hzVBnWFn8YIh2N5gsT3Ju0NgYx6o X-Received: by 2002:a25:d10f:: with SMTP id i15mr5511337ybg.244.1608291459720; Fri, 18 Dec 2020 03:37:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608291459; cv=none; d=google.com; s=arc-20160816; b=yBl3t35OxXK6VxFUAW22gRzTV4C8kcvzccVK89CE4shqbowuhH+eYjtMqSpclJKPPZ 8v0qOvbJ2thi3/4wY3+e0dAe+1K1JkLNKXYaB9sPIyE7fv6Vd1z++OxSedIvWgpiyzzJ /PbPUkEbwYI9y/0ImFk8EcsV4C0lxlkeyBhrbKIdtsjnWW8iYkg78Bobfxtmp8KLarTf 1G4kLKcJUrJuBxcKmegn5nAMFDTe8xdVn2T63l3dmrMPG2agkeFDpgy9xSL4gn3Fv+3+ iBorFgQ9RpSqI9ALmyRnJWrYxln8PeT4PrWpQtm9F7+NhP01dowtHUtqO0a4iK/ke2HS T73w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=01tFfuv0vHwkzArr4QZXoLGHaw2yUPc1Y3PaVe5R/e0=; b=vj7w8EMykkxanpFwlVgIjgHNnXuP7QclspE3wcVxytqWimRRPws+/hhsLCYSeH33lY nrkj6JilVxCY8jTh5BZuwXDekobqZuxG8zpYkXsW6U2sQAWytAvcyAo7eB7H5/pPJsiz 7ZGyvQ60BPoGz3z37jZknsyabSZywG9MdAr2qPDk6kd7jkrO1dbqMYRXqLfJ2cgYL0zd Vq1xiRvp36UB/ImL2IBe14gkaHsxQspofQNyTPj5FGsyh30v4BcAPNbxFhOeLO9VFZui 5v6HSlWZr8LsTQIiDX6G5EDhZ2cJfH3jD8Sn8g3W1tgz/ZFZNmkjsiH4O/kzoCumSnOu cshw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=N47HG5Zx; 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=fail (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 6si6576519ybe.356.2020.12.18.03.37.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:37:39 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=N47HG5Zx; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqE4p-0001W3-5G for patch@linaro.org; Fri, 18 Dec 2020 06:37:39 -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) 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-Received: by 2002:a1c:64c4:: with SMTP id y187mr3796762wmb.165.1608290841348; Fri, 18 Dec 2020 03:27:21 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= , Lirong Yuan , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Lirong Yuan This allows gdb to access the target’s 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ée 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 -- 2.20.1 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 *gdb_ctx, void *user_ctx) ";ReverseStep+;ReverseContinue+"); } +#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 = true; @@ -2233,6 +2239,46 @@ static void handle_query_xfer_features(GdbCmdContext *gdb_ctx, void *user_ctx) gdbserver_state.str_buf->len, true); } +#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 = gdb_ctx->params[0].val_ul; + len = gdb_ctx->params[1].val_ul; + ts = gdbserver_state.c_cpu->opaque; + saved_auxv = ts->info->saved_auxv; + auxv_len = ts->info->auxv_len; + mem = (const char *)(saved_auxv + offset); + if (offset > auxv_len) { + put_packet("E00"); + return; + } + + if (len > (MAX_PACKET_LENGTH - 5) / 2) { + len = (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[] = { .cmd_startswith = 1, .schema = "s:l,l0" }, +#ifdef CONFIG_USER_ONLY + { + .handler = handle_query_xfer_auxv, + .cmd = "Xfer:auxv:read::", + .cmd_startswith = 1, + .schema = "l,l0" + }, +#endif { .handler = handle_query_attached, .cmd = "Attached:", diff --git a/MAINTAINERS b/MAINTAINERS index d5ea7fbb8f..a4f04e19ca 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2311,6 +2311,7 @@ R: Philippe Mathieu-Daudé S: Maintained F: gdbstub* F: gdb-xml/ +F: tests/tcg/multiarch/gdbstub/ Memory API M: Paolo Bonzini diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.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") EXTRA_RUNS += 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 += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read endif diff --git a/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py b/tests/tcg/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 = 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 run_test(): + "Run through the tests one by one" + + auxv = 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 = 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) + +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 += 1 + pass + +print("All tests complete: %d failures" % failcount) +exit(failcount) From patchwork Fri Dec 18 11:27:04 2020 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: 345458 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2064683ejs; Fri, 18 Dec 2020 03:29:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhSn+Q15XEKR585eQqIu3yhFDQo7EN5Zn2Zi5VULOkhwdfX7DBU5D03Toq4Fci0r9FC0tx X-Received: by 2002:a25:bc09:: with SMTP id i9mr5438172ybh.141.1608290993103; Fri, 18 Dec 2020 03:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608290993; cv=none; d=google.com; s=arc-20160816; b=G9qApqAF2W4JSxzjbuXFnZOJxlXtXp23qqDOIRu6FshgGq+KpFQYSieiWyxEGJRDFN CKURrhEZYzEe7/zY7pP+WIVTatHywU2AyAjxAv/2RsT4xbc5LKo2DY2DFZrb+96BiYHH wip1lA3p7A+vfgudWHcnRY+FkTDqTYZwXJn2ALmtjbYIlvtz6SNkhbEL6lvbPel7vZKR CHI3bvwLsto3sdvOoW37MKhL+9ly8ENCP9pj0KgLjCsKIWYwGbp2l1R2DUqMlK9M/16o Tf+HStiIAjsgEnFp2vaGobqYglsFRkQe3HVV/iOVa8oUvD8mnZ5OSCI8UKEWKmzrYHn4 gedw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=qzjSb7TtaIs2FGaM8dLD/lXODxjDnZRhX0kYxDeMf/0=; b=m3JsmhhhP4Is6gL5SUJP0Sur0dFLsd6pmKwFta8QhIWQFkQyYuUG7KrVC8KwwPtVP/ KY4jSNScaHh32pKjMy0b9IpjCdYXntMssbs82/bQ8A5ukQyS3Jo2N6IJane1QJOswstE t/3bT3lPSvihdWaQnqIg6NJUQZuxCm/mwgFanFrqm+5g6t1kdwZmABUYfbjC5o4sKFZS QC0cx6AW8njFz/vUYvtuO9FK7xd+PtonnM/6IeucjP5FWPZFtxF/eo+HXCQMNEgwyc9Y XUPlDkwEcrL3UFHx4UDapKOMq42TlGDY852qoxPULI5eeLC2zDZtK8GlLaWaGbxvDMPK xaIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YNJLCJRX; 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=fail (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 p66si8063173yba.244.2020.12.18.03.29.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:29:53 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=YNJLCJRX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDxI-0001z3-Fo for patch@linaro.org; Fri, 18 Dec 2020 06:29:52 -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) 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-Received: by 2002:a1c:5410:: with SMTP id i16mr3889763wmb.30.1608290836832; Fri, 18 Dec 2020 03:27:16 -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) From: =?utf-8?q?Alex_Benn=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 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_Mathieu-Daud=C3=A9?= , Chris Wulff , Richard Henderson , Laurent Vivier , "open list:ARM TCG CPUs" , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" gdb_exit() has never needed anything from env and I doubt we are going to start now. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20201214153012.12723-5-alex.bennee@linaro.org> Signed-off-by: Alex Bennée --- 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(-) -- 2.20.1 Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé 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 char *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) } /* Tell the remote gdb that the process has exited. */ -void gdb_exit(CPUArchState *env, int code) +void gdb_exit(int code) { char buf[4]; 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 = (args == 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 = 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 = 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); From patchwork Fri Dec 18 11:27:05 2020 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: 345460 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2066002ejs; Fri, 18 Dec 2020 03:31:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAf0RvoRElFLTp3ffQE35K3AXgopqree2ObNvSLBtHA+yYMyszICJ1xbFVQcOpFYa+qPMT X-Received: by 2002:a25:7083:: with SMTP id l125mr5608651ybc.250.1608291103104; Fri, 18 Dec 2020 03:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608291103; cv=none; d=google.com; s=arc-20160816; b=05Up3vE59On9dyrDMffb2+4gYNPjB7gZuf+1f+a0rEpM+qGpMqjujSXcymHv3F0cpM d758Xrg5rA9Qh35JhdsxX6TAyL8Qd0iTHOxSA591m+uvJRKvzeNJ11qzNHNk3k4zvl2X T2YYXigeBeU05Op/EJFS552hT6mFSUC8U7suUfZNzL+3+ioE/o6192yfwuywMqpKsCdi 5lgZfBNm3m3L3bZIvVYuAF7KvEKhIrJOQZ0FBKf5sOW5oLvOXojkZmvn622r/dEPz3HN L7x9u4NoX+5qiXwspbLB7NuU0uSKm5Gs5CwfZGuSql86Y0CWqrBB2qY9J2MNTCtv/ZUn hblQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=yB8UJ3jgqS4qYz+f00mcHp/m9Q9/LaOQZNMtgdlHZX8=; b=dvJ/dNYQXmNVNGid6xopaUpPfy8O6i/5QfCyIpRKor3DBvDRB5U184iweoU7te9bcP SwhYJEND3HtCBw3q76Z6yVYbWXjhMQ2ZxtRVusLh3mSD72i178I/df0re3EPNd6NDPOH AvCl7WNV7llPXSFofanUml/WCJ/UVnAntu3Gicqh+6nLtnTbQpcoCTFWmctQzRN1eB9Q Mr7MJU/Ufit+3aEfOeALlDH3jbCIrN5AhWdbzyssxBhkW8xGM2My8Jk9sER5yk346h2K gyGgDCs/H9Js8LFjgpYtBp+AAHxn92bzXRIKKKbeooYhvm8GbENJ3trmqeto71O+u82c wQ7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=URHBHGEg; 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=fail (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 p137si7648670ybg.226.2020.12.18.03.31.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:31:43 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=URHBHGEg; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDz4-00036M-CA for patch@linaro.org; Fri, 18 Dec 2020 06:31:42 -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) 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-Received: by 2002:a5d:5227:: with SMTP id i7mr4086919wra.68.1608290840147; Fri, 18 Dec 2020 03:27:20 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Richard Henderson Message-Id: <20201214153012.12723-6-alex.bennee@linaro.org> Signed-off-by: Alex Bennée --- include/exec/gdbstub.h | 14 +++++++++++--- gdbstub.c | 7 ------- softmmu/runstate.c | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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 char *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); -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; } -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) void qemu_cleanup(void) { - gdbserver_cleanup(); + gdb_exit(0); /* * cleaning up the migration object cancels any existing migration From patchwork Fri Dec 18 11:27:06 2020 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: 345462 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2068366ejs; Fri, 18 Dec 2020 03:35:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwS25WudWDmRIZb9+w2kQMZ+IinN3cZNRBOWjhrhsnbvfV5gB7pjxRceS8j//s+EQLn25WZ X-Received: by 2002:a25:4153:: with SMTP id o80mr5214731yba.198.1608291309552; Fri, 18 Dec 2020 03:35:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608291309; cv=none; d=google.com; s=arc-20160816; b=A5yysQnKJrQObWN6T0nHzWfk1kCh2g0HyyryV3nii38cDoY27zMEK/fgUkx9UGAdkH P3llN8R27cX2jSyegRBIz1UGnEtHrWO0Gf06VCngWhz/3793gDJr/wxhMy23bSIiZ6jl oh6zKcGIBJLVRSLWIqNlc4ISui/mT+s5oQJ+Czo4d1KcAx4aaYLYmzq4p15oSVkN2qzW oJF6G+zMxxbWlOZ3x1spH5WRsDvfgEq1m3yVWgUg/QPaq7ZRRKdaTsCjzH+DLS7OR4Hg Tdqca9tSDVTKJrPulP+mnyO9e2/s4+8RDOcAtH3upd8X1pLMC9er/eXy7VVTnP312Il/ hGlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=bivVxysPoShSEEWKqw3fiXD1Ck9vv/6yITEBjJAWoPE=; b=NutgZlbzAc6LPwHmJLalA11WYySrZLAUr9C6i8RJ+Yih3zr9ZfR78c6mDfMIft/uSn H0wI4dTwDofn4arm7Gpt4pnyTjXvXjyxRYGbJLf2il1sXP002c4QW4K1fccLaVYRnaNK KC87KOn6B2sdX7O6Oxl14LrTwk2CU8kYkXtGd0JC+cV38NbbCedi0aBM0K5o5dRDZCQd 458fcbO56ppnIHI6pMPx0907TjpKMrrBa237XwU0TH8EKcMIV/3fKOaKCYCRluX3K86G mnDbWFlKxDZ8T1ls+QqcIiRCCx4W90ETbCknGIuFdjN5uxnE9961ZvYEcYHo3vwsqGHn GQHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=r6unnJUb; 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=fail (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 f1si6975104ybg.235.2020.12.18.03.35.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:35:09 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=r6unnJUb; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqE2O-0007tx-Tn for patch@linaro.org; Fri, 18 Dec 2020 06:35:08 -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) 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-Received: by 2002:a1c:3b02:: with SMTP id i2mr3682481wma.141.1608290838066; Fri, 18 Dec 2020 03:27:18 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Richard Henderson Message-Id: <20201214153012.12723-7-alex.bennee@linaro.org> Signed-off-by: Alex Bennée --- gdbstub.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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, void *user_ctx) /* Kill the target */ put_packet("OK"); error_report("QEMU: Terminated via GDBstub"); + gdb_exit(0); exit(0); } @@ -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': { From patchwork Fri Dec 18 11:27:07 2020 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: 345459 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp2065604ejs; Fri, 18 Dec 2020 03:31:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJGHJsjeY6R+BRr4V6rmB6Jqg4UJNeKdLLkfOT3tOfw/PyKYemnc57ee5aZmQL2rzS5IDt X-Received: by 2002:a25:b846:: with SMTP id b6mr5416032ybm.202.1608291070326; Fri, 18 Dec 2020 03:31:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608291070; cv=none; d=google.com; s=arc-20160816; b=WMDdLlILM2meu6kuJrmH0G9byEgMyAd/WSJPeeJTKGCSnMD/iC/IpvS5J7mNtgc1Sa ceul2/ERDTBsHeHMlqS+eLroXVfAMOREzVh1f536Cwiq2FkW4XtbB0qAfYUAsrFQMuqn 61W6zT0dv37v2nFaBDmxUrijmMz0rrEIgRAq+LZ1dcw2Qs3aNLxOmuxeNYN3IXkG8ytQ OnORQS4BbKXE4LbLesOQx/7Cw7DGLk1Cq81jzV4lWkE7A2+jTvamJAvIHWqfla4DIDBt UC01aSjAVN2beZEZxqiUWf++/1L1+y+W2IQjhG0YDp6SeOXI5GtGcgEfUq4vS6ZzO3WH ZbaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=6NSRnSlmnhaO7uroZIq5QNa4woFGPYOMJTjkY2C6pnY=; b=EVs2mJ7oufmqhZNoEds2fXXmIgvEksBi4ewsYMoekXa6j0DE8QY9MVJABvkTv4b0OQ DbHJrBT07sz5jG4j40qLqnZqEfzMfJU6em03V1j3xR9TugodQKZgLqZqeV/ZeKKFl0Ga nCS+JIDn9+sEuMIJ+0xZUM7ggFcIZQLER77ntktZVKq8e7KETITjjjYB9p3cm76O0lZv LdJdfX/l2dOoD0zjErrhFS0f0/kq+CA00EaE9kwz/msSCSfarz7M9fGs2TbKFYi8hPGU a8bZuWGpPKidIE+PPa0IEdBd29Fh9M2jJfMKbXuQwqOzUzmPE0aDHXf1yY0aj6JBArEV L1bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ASCm8sFe; 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=fail (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 w197si8093509ybe.186.2020.12.18.03.31.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Dec 2020 03:31:10 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=ASCm8sFe; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqDyX-0003fC-Kd for patch@linaro.org; Fri, 18 Dec 2020 06:31:09 -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) 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-Received: by 2002:adf:9d49:: with SMTP id o9mr3941424wre.413.1608290842800; Fri, 18 Dec 2020 03:27:22 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée 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(-) -- 2.20.1 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[] = { { "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 = g_string_new(NULL); DynamicGDBXMLInfo *info = &cpu->dyn_svereg_xml; g_autoptr(GString) ts = g_string_new(""); - int i, bits, reg_width = (cpu->sve_max_vq * 128); + int i, j, bits, reg_width = (cpu->sve_max_vq * 128); info->num = 0; g_string_printf(s, ""); g_string_append_printf(s, ""); - g_string_append_printf(s, ""); + g_string_append_printf(s, ""); /* First define types and totals in a whole VL */ for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { int count = 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].suffix); 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 = 128; bits >= 8; bits /= 2) { - int count = reg_width / bits; - g_string_append_printf(s, "", count); - for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { - if (vec_lanes[i].size == bits) { - g_string_append_printf(s, "", - vec_lanes[i].suffix, - count, - vec_lanes[i].sz, vec_lanes[i].suffix); + for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { + const char suf[] = { 'q', 'd', 's', 'h', 'b' }; + g_string_append_printf(s, "", suf[i]); + for (j = 0; j < ARRAY_SIZE(vec_lanes); j++) { + if (vec_lanes[j].size == bits) { + g_string_append_printf(s, "", + vec_lanes[j].suffix, + vec_lanes[j].sz, vec_lanes[j].suffix); } } g_string_append(s, ""); } /* And now the final union of unions */ - g_string_append(s, ""); - for (bits = 128; bits >= 8; bits /= 2) { - int count = reg_width / bits; - for (i = 0; i < ARRAY_SIZE(vec_lanes); i++) { - if (vec_lanes[i].size == bits) { - g_string_append_printf(s, "", - vec_lanes[i].sz, count); - break; - } - } + g_string_append(s, ""); + for (bits = 128, i = 0; bits >= 8; bits /= 2, i++) { + const char suf[] = { 'q', 'd', 's', 'h', 'b' }; + g_string_append_printf(s, "", + suf[i], suf[i]); } g_string_append(s, ""); + /* Finally the sve prefix type */ + g_string_append_printf(s, + "", + reg_width / 8); + /* Then define each register in parts for each vq */ for (i = 0; i < 32; i++) { g_string_append_printf(s, "", + " regnum=\"%d\" type=\"svev\"/>", i, reg_width, base_reg++); info->num++; } @@ -287,31 +279,22 @@ int arm_gen_dynamic_svereg_xml(CPUState *cs, int base_reg) " regnum=\"%d\" group=\"float\"" " type=\"int\"/>", base_reg++); info->num += 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 = 0; i < 16; i++) { g_string_append_printf(s, "", + " regnum=\"%d\" type=\"svep\"/>", i, cpu->sve_max_vq * 16, base_reg++); info->num++; } g_string_append_printf(s, "", + " type=\"svep\"/>", cpu->sve_max_vq * 16, base_reg++); g_string_append_printf(s, "", + " regnum=\"%d\" type=\"int\"/>", base_reg++); info->num += 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, GByteArray *buf, int reg) * while the ZCR works in Vector Quads (VQ) which is 128bit chunks. */ int vq = 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/aarch64/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)") + # 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 = gdb.parse_and_eval("$z0.b.u[%d]" % i) + val_v = gdb.parse_and_eval("$v0.b.u[%d]" % i) + report(int(val_z) == int(val_v), + "v0.b.u[%d] == z0.b.u[%d]" % (i, i)) + except gdb.error: + report(False, "checking vregs (out of range)") + def run_test(): "Run through the tests one by one"