From patchwork Tue May 15 14:56:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 27270 Received: (qmail 50683 invoked by alias); 15 May 2018 14:56:18 -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 50667 invoked by uid 89); 15 May 2018 14:56:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=32000000000, 32.000000000 X-HELO: 9pmail.ess.barracuda.com Received: from 9pmail.ess.barracuda.com (HELO 9pmail.ess.barracuda.com) (64.235.150.224) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 May 2018 14:56:16 +0000 Received: from mipsdag02.mipstec.com (mail2.mips.com [12.201.5.32]) by mx2.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO); Tue, 15 May 2018 14:56:13 +0000 Received: from [10.20.78.107] (10.20.78.107) by mipsdag02.mipstec.com (10.20.40.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Tue, 15 May 2018 07:56:41 -0700 Date: Tue, 15 May 2018 15:56:05 +0100 From: "Maciej W. Rozycki" To: Subject: [committed] testsuite: Fix a `server_pid' access crash in gdb.server/server-kill.exp Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-ClientProxiedBy: mipsdag02.mipstec.com (10.20.40.47) To mipsdag02.mipstec.com (10.20.40.47) X-BESS-ID: 1526396173-298553-30250-44499-1 X-BESS-VER: 2018.6-r1805102334 X-BESS-Apparent-Source-IP: 12.201.5.32 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.193012 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Fix a commit f90183d7e31b ("Get GDBserver pid on remote target") bug and correctly handle the case where the PID of `gdbserver' could not have been retrieved. If that happens, $server_pid is unset causing: FAIL: gdb.server/server-kill.exp: p server_pid ERROR: tcl error sourcing .../gdb/testsuite/gdb.server/server-kill.exp. ERROR: can't read "server_pid": no such variable while executing "if {$server_pid == "" } { return -1 }" (file ".../gdb/testsuite/gdb.server/server-kill.exp" line 49) invoked from within "source .../gdb/testsuite/gdb.server/server-kill.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source .../gdb/testsuite/gdb.server/server-kill.exp" invoked from within "catch "uplevel #0 source $test_file_name"" Verify that the variable exists then rather than trying to access it. gdb/testsuite/ * gdb.server/server-kill.exp: Verify whether `server_pid' exists rather then trying to access it in determining whether the PID of `gdbserver' could have been retrieved. --- Hi, Committed as obvious. Maciej --- gdb/testsuite/gdb.server/server-kill.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) gdb-test-server-kill-pid.diff Index: gdb/gdb/testsuite/gdb.server/server-kill.exp =================================================================== --- gdb.orig/gdb/testsuite/gdb.server/server-kill.exp 2018-02-23 14:15:32.000000000 +0000 +++ gdb/gdb/testsuite/gdb.server/server-kill.exp 2018-05-11 18:39:10.143071990 +0100 @@ -46,7 +46,7 @@ gdb_test_multiple $test $test { } } -if {$server_pid == "" } { +if ![info exists server_pid] { return -1 }