From patchwork Sat Feb 8 16:57:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 37772 Received: (qmail 35965 invoked by alias); 8 Feb 2020 16:57:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 35304 invoked by uid 89); 8 Feb 2020 16:57:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH autolearn=ham version=3.3.1 spammy=sk:gdbtes, dis, sk:gdb-tes, $pc X-HELO: esa3.hgst.iphmx.com Received: from esa3.hgst.iphmx.com (HELO esa3.hgst.iphmx.com) (216.71.153.141) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Feb 2020 16:57:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1581181061; x=1612717061; h=date:from:to:subject:message-id:mime-version: content-transfer-encoding; bh=IVwn/s4R5hF4AuNdXQvnwo6Pa5ChMpvDD5I1mdF3wgo=; b=DE+NkyvTebF/SC2YwWPKDsNewZgbykQD1Dbh1eBVQKNockrUDvuzoglr BwWVAFdOLO7d4I+V8g2A3hvByL7cfxjV6ftpb9+kT72wwq7+JvQGyRPYs 7IBssooWJF/ZObH0g+mPm9+bNzHXSveBIZ2/ec4sW9M1UveqfG0k/2Oc5 /ZZGrZUsHXcV5x8GoQf894F+VOrqBrk0iA+uakYJ0u9CkKRLMw7uiAH5K 7oyKpO2XEkQ75kkQKMOt/Yd5jIOdFutbrZutjkuOyzrgP7jrt9VQIQbmc U+cUxES+a3k4HUL8Jw/Xc5G0GgnLpdqegLiiOdq064mcPVaiXZKS4vJ2I Q==; IronPort-SDR: xqCSIcyLYw1YPRg2p6KXEpI4NkGvybNTDOrsvHlUCr1PTC6vGr4MsDK6ZLlDw7KUELhuotPOAe PrYNL/2vx04tB5GTW002c7u2Eqveuoo79J6X7nVd1G4Dfx0UjIDUojQL7S8WEM7WK0VzS5pzzW dpdYd7E1NTvituI93C4C2fskX3W8/dOp1XV3woG6n7G0yxSvN7+EavkRDCKbq9rxio2gfvwvG1 dnG1oyey0NS3rkvtscz5ri4D0eumT/o4Nx3FVUpMD0I0jguYCzBSzerVY3Wic5MEqTe7OLG03/ zhw= Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2020 00:57:39 +0800 IronPort-SDR: dpTicyBjflALXo76OX/BoKNRiuTOooFunr4YUpokQ5g3OGXGEkVWotCTx4HT7A4abhFuEjDo/x B1ufG1WVYnq0qX7MY2TTxcMiNxj2wemz/xZ1V8s6xrJ3kctPk9QP2QjcclROdG99+IP+Exrma9 t3JdQE/pTFqOoV5KUf/jEyhOVZznUuIimTZjrsOfdwK/hFc1Jdg0dF+6ya0fBVYMpOAFRAHdTg zV2gMw9WcL1Ktt+V5vTPTCfL+CYN9miHHYc/yQ1y0Ew/rQVJQCq+K9IjgguTWfKgzJBigHCUkq ng9Sg65IwS8KHib7H6QKtKyh Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2020 08:50:34 -0800 IronPort-SDR: cxGpJvbS/jdyc+1DSgIZyozcOEUH55/g//xX6fdSPJ3JaHWJtxVfVZ3ZYO6QUuDSN0EXUnQY5u A/NCZ54xYdXHDoH2oLRoVTu0DsNkXaUaSDTjxnYhkiSs+0tHHtDgkaRoogQ6jHmNwMjxRZjFxy PHRIf75B8P21vVi7JOioIJPLBXm45cxJuC1RXq4rqFU7Zg5fVqefQuIByi1dUCTfdcumbuUIQK Tp2mebAataC4koPvbH7jfEeDh++lWa8aE72UFLV8O7RrYiHgDVpmKnrE97cDGjCa+XOVwyfofO fhc= WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2020 08:57:38 -0800 Date: Sat, 8 Feb 2020 16:57:30 +0000 (GMT) From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org Subject: [PATCH] GDB/testsuite: Fix a catastrophic step-over-no-symbols.exp failure Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Fix a catastrophic failure in gdb.base/step-over-no-symbols.exp where remote target communication issues cause the value of the PC retrieved to be empty: (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi p /x $pc Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f551500000056424d40435c2f7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000 (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC ERROR: tcl error sourcing .../gdb/testsuite/gdb.base/step-over-no-symbols.exp. ERROR: missing operand at _@_ in expression " _@_!= " (parsing expression " != ") invoked from within "expr $before_addr != $after_addr" ("uplevel" body line 1) invoked from within "uplevel 1 expr $condition" (procedure "gdb_assert" line 6) invoked from within "gdb_assert {$before_addr != $after_addr} "advanced"" (procedure "test_step_over" line 36) invoked from within "test_step_over $displaced" ("uplevel" body line 2) invoked from within "uplevel 1 $body" invoked from within "with_test_prefix "displaced=$displaced" { test_step_over $displaced }" ("foreach" body line 6) invoked from within "foreach displaced { "off" "on" "auto" } { if { $displaced != "off" && ![support_displaced_stepping] } { continue } with_test_prefix "dis..." (file ".../gdb/testsuite/gdb.base/step-over-no-symbols.exp" line 84) invoked from within "source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source .../gdb/testsuite/gdb.base/step-over-no-symbols.exp" invoked from within "catch "uplevel #0 source $test_file_name"" Remote debugging from host xxx.xxx.xxx.xxx, port 47130 monitor exit Killing process(es): 1092 Remote communication error. Target disconnected.: Connection reset by peer. (gdb) To do so verify first, before making an arithmetic comparison, that the values to compare are actually integers (using a string comparison would result in a false PASS if both operands were empty, as in this case), making the test script proceed normally: (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: stepi p /x $pc Remote 'g' packet reply is too long (expected 264 bytes, got 532 bytes): 00000000000000002a6f61551500000080faffff3f0000000028010000000000b03857551500000060ad5f5515000000906e615515000000802401000000000090faffff3f00000000000000000000000100000000000000e8fbffff3f000000f8fbffff3f0000000000000000000000b8faffff3f0000008a05010000000000589c6f5515000000424d40435c2f7c7c1809575515000000f0e0baaa2a0000000000000000000000f0ffbaaa2a000000f0e0baaa2a0000006804baaa2a000000000000000000000000000000000000007053baaa2a0000008252b2aa2a00000090fe01000000000048e056551500000004000000000000004000000000000000920501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000xxxxxxxxxxxxxxxx00000000 (gdb) FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced Remote debugging from host xxx.xxx.xxx.xxx, port 48404 monitor exit Killing process(es): 1795 Remote communication error. Target disconnected.: Connection reset by peer. (gdb) Note the double curly braces, to take advantage of `&&' operator's lazy evaluation. gdb/testsuite/ * gdb.base/step-over-no-symbols.exp: Verify that $before_addr and $after_addr are both integers before making a comparison. --- Hi, Observed and verified with the `riscv64-linux-gnu' target in remote testing with commit c35d018b1a5e ("RISC-V: Fix gdbserver problem with handling arch strings.") reverted. OK to apply? Maciej --- gdb/testsuite/gdb.base/step-over-no-symbols.exp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) gdb-test-step-over-no-symbols-no-pc.diff Index: binutils-gdb/gdb/testsuite/gdb.base/step-over-no-symbols.exp =================================================================== --- binutils-gdb.orig/gdb/testsuite/gdb.base/step-over-no-symbols.exp +++ binutils-gdb/gdb/testsuite/gdb.base/step-over-no-symbols.exp @@ -78,7 +78,9 @@ proc test_step_over { displaced } { set after_addr [get_pc "get after PC"] - gdb_assert {$before_addr != $after_addr} "advanced" + gdb_assert {{[string is integer -strict $before_addr] \ + && [string is integer -strict $after_addr] \ + && $before_addr != $after_addr}} "advanced" } foreach displaced { "off" "on" "auto" } {