From patchwork Mon Jul 3 13:44:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 698717 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp1768070wrs; Mon, 3 Jul 2023 07:04:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHmx7fuwu/AqpdaC/ikx+7WMr8yq8pYN8t7DWZ/TqNDGB7sF5pplm0gJmg6VDGa+KcsY+5j X-Received: by 2002:a05:6000:124f:b0:314:3746:d44b with SMTP id j15-20020a056000124f00b003143746d44bmr2885684wrx.41.1688393076411; Mon, 03 Jul 2023 07:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688393076; cv=none; d=google.com; s=arc-20160816; b=YFkZyp343eF+hd5aAy9Hr4cAHP8NmQc33ag8d29xr/XRmOnTXvhX630bNhgSo09Xhk U/81IxHfXFxpqg1KAa7Fe32zEcCWLJD+5qRFoBT1/lZntuAfgAn8XPg2SDnHF4lho2+E ws31NVnDXm9cXvFjKqyyxaWYc73bm0YHVUtC0GIBc6xLyNF9S+DSQNo7Hy6Lo3OYX82D M7FqUGlEjDGOPSgQ0sASeaTe2ap2I3eAQj8uQjzD3K0axVIzud7aw6sqGxL5V/Lpiaqw cZJKCyLb9Cr9UoPWH1/NA6SnTYEpMud3X4xhIJ6mwfQReXUlT7zrE9lSV2+IYulrl3oE +ZkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L10INYSmGRMwfYRjSmnypN3cJI3i4gGGNLhvyw0OvLw=; fh=nJoHa+TEz/Iqgejv5tq02EzBq7KB5/EaExtjL3TSfSM=; b=KPHIVNs8c0HNGgVabSZjjRRK1M56IsvcTlr8CW/OEqXi4EY2wmlllO9qLaDsdIlqxH WOsIE8HpIB/p6zrhcWShoCugbAjwuJixAc6qwtJnQxuyBOVDTZkA7kxWJmxQGfQNrvUH A9oQ9DSjo21Ao4MeMoMsoPMKUjzZmrqmy7KyxrO3iRr8W/FwoFYJ4epqrRyyKHuvNEaq HPNAcPRLC8ngbvF+Cr+t3O9c+TEPanvimL9hiZSgqox9ep5ikelrajRVKyDSPFyBsn1O CFM5Jil1DAEIMm7mmtz/twAN5XqamaM2N9KVw8vPzZPwTvXubeIoOnfmeHYoK1kBKcYW nt+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q3alv+OL; 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 v5-20020a5d6b05000000b00313f92e8110si9710679wrw.90.2023.07.03.07.04.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jul 2023 07:04:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q3alv+OL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGK9R-0005f8-MY; Mon, 03 Jul 2023 10:03:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGK9P-0005eb-DI for qemu-devel@nongnu.org; Mon, 03 Jul 2023 10:03:35 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGK9J-00032D-Ps for qemu-devel@nongnu.org; Mon, 03 Jul 2023 10:03:35 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc63c2e84so41492605e9.3 for ; Mon, 03 Jul 2023 07:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688393008; x=1690985008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L10INYSmGRMwfYRjSmnypN3cJI3i4gGGNLhvyw0OvLw=; b=Q3alv+OLG6ICh/CvIFWfuaIunr1LsU3WJ9fnmjnHe7ImeagwTr3XnphHHPZ04ekts0 Es9cWPFDfS+z1i0BC+5GbGa9X1PwA3PGKFdS8QvEydJ475Z9xRfxA2tC8sKJr8moKGw2 lhQTNg2xodjYaBkCA03X2Qj3QI9B8Mf+QVnENApYS5S9p0AEfCaGLvOolZ9dSDXpYUEY Cb2e6kJ+sCCYcNBUEZsF8t9LlrMQ/nK8bUtxLaTWFTiEZu0GakUI62RKgtZOZoAsFmHl +cQtDUBXk6cVxpxmYIJ691LumioAcyBPTkNMjJSZEfyTQCChrG9vcMxh5rlG9aMuD3z8 nMhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688393008; x=1690985008; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L10INYSmGRMwfYRjSmnypN3cJI3i4gGGNLhvyw0OvLw=; b=LVlHynbmHytnLU/wLRAjmx2hPwIFYwW1JpPiuFo5PWNUq5J9DMni0jqRSWwuc3hAv8 pMh5m2ciDkhhyoxbGmarafNBr+g8A6ZjInOaixrRxqDj2Jsm+JUJfPtZ+q+O/qSxBS/h SBB+Eslc76ci04qOBQHjwMzgx2zaLky+O4Wottv07GBVpL3YSZBeR2XeJzp9gf99XBYc zWmXYea5bU0UryUwaAgaE7Rjdy4aubDj4ZudQWLeGI3TdayVnsRTTrY9i2x2GNHSytX4 V8MSEPgaRDzW9PqE95vihyS7HJJZhVodmPFnt02P2h6Xwys2Xb/NPd2CT1IEHJY3uXAA e15w== X-Gm-Message-State: ABy/qLYeuRGtTaXgrdtdzkZKl5JWqWOEXBc9dLi6s1G3nySOwssOZSWL veG0tiH5Ux6VJRj6ovWy+RF5Qg== X-Received: by 2002:adf:decb:0:b0:314:1e47:8bc2 with SMTP id i11-20020adfdecb000000b003141e478bc2mr8509635wrn.0.1688393008118; Mon, 03 Jul 2023 07:03:28 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id z11-20020adfe54b000000b0031128382ed0sm6636413wrm.83.2023.07.03.07.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 07:03:27 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 257671FFE5; Mon, 3 Jul 2023 14:44:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [PULL 38/38] tests/tcg: Add a test for info proc mappings Date: Mon, 3 Jul 2023 14:44:27 +0100 Message-Id: <20230703134427.1389440-39-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230703134427.1389440-1-alex.bennee@linaro.org> References: <20230703134427.1389440-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich Message-Id: <20230621203627.1808446-9-iii@linux.ibm.com> Signed-off-by: Alex Bennée Message-Id: <20230630180423.558337-39-alex.bennee@linaro.org> diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index 373db69648..43bddeaf21 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -81,6 +81,13 @@ run-gdbstub-qxfer-auxv-read: sha1 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ basic gdbstub qXfer:auxv:read support) +run-gdbstub-proc-mappings: sha1 + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \ + proc mappings support) + run-gdbstub-thread-breakpoint: testthread $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \ @@ -97,7 +104,7 @@ run-gdbstub-%: $(call skip-test, "gdbstub test $*", "need working gdb") endif EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \ - run-gdbstub-thread-breakpoint + run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint # ARM Compatible Semi Hosting Tests # diff --git a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py new file mode 100644 index 0000000000..7b596ac21b --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py @@ -0,0 +1,65 @@ +"""Test that gdbstub has access to proc mappings. + +This runs as a sourced script (via -x, via run-test.py).""" +from __future__ import print_function +import gdb +import sys + + +n_failures = 0 + + +def report(cond, msg): + """Report success/fail of a test""" + if cond: + print("PASS: {}".format(msg)) + else: + print("FAIL: {}".format(msg)) + global n_failures + n_failures += 1 + + +def run_test(): + """Run through the tests one by one""" + try: + mappings = gdb.execute("info proc mappings", False, True) + except gdb.error as exc: + exc_str = str(exc) + if "Not supported on this target." in exc_str: + # Detect failures due to an outstanding issue with how GDB handles + # the x86_64 QEMU's target.xml, which does not contain the + # definition of orig_rax. Skip the test in this case. + print("SKIP: {}".format(exc_str)) + return + raise + report(isinstance(mappings, str), "Fetched the mappings from the inferior") + report("/sha1" in mappings, "Found the test binary name in the mappings") + + +def main(): + """Prepare the environment and run through the tests""" + try: + inferior = gdb.selected_inferior() + print("ATTACHED: {}".format(inferior.architecture().name())) + except (gdb.error, AttributeError): + print("SKIPPING (not connected)") + 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: + report(False, "GDB Exception: {}".format(sys.exc_info()[0])) + print("All tests complete: %d failures" % n_failures) + exit(n_failures) + + +main()