From patchwork Wed Oct 24 12:09:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 29869 Received: (qmail 80821 invoked by alias); 24 Oct 2018 12:09:14 -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 80789 invoked by uid 89); 24 Oct 2018 12:09:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Oct 2018 12:09:11 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 58D14AF51; Wed, 24 Oct 2018 12:09:09 +0000 (UTC) Subject: [PATCH][gdb/testsuite] Log wait status on process no longer exists error From: Tom de Vries To: Simon Marchi , Gary Benson Cc: gdb-patches@sourceware.org, Pedro Alves References: <20181005101122.GA23867@delia> <20181009135155.GB12668@blade.nx> <8f8ffb94-5a0c-8b2b-d541-eaacd7d1f42c@suse.de> <20181010092735.GA29557@blade.nx> <20181010134423.GA23926@blade.nx> <20181011074744.GA7677@delia> <20181011083318.GA13751@blade.nx> <06b38d2e3f0a9394280553e70b9dfaf8@polymtl.ca> <480ea2be-eac0-8d19-cfe7-93c56b33a7ac@suse.de> <9d0dc535-b053-5063-eb0c-d7bf3e80fe49@suse.de> <8b734739-a3c5-ad0a-9d4e-e92ccdfd72f8@suse.de> Message-ID: <10673518-aad3-7305-6b73-486f9df742eb@suse.de> Date: Wed, 24 Oct 2018 14:09:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <8b734739-a3c5-ad0a-9d4e-e92ccdfd72f8@suse.de> X-IsSubscribed: yes [ was: Re: [PATCH][gdb/testsuite] Rewrite catch-follow-exec.exp ] On 10/24/18 1:47 PM, Tom de Vries wrote: >> I'd suggest replacing >> >> gdb_test_multiple "info prog" "info prog" { >> -i "$gdb_spawn_id" eof { >> fail "info prog" >> } >> -i "$gdb_spawn_id" "No selected thread\." { >> pass "info prog" >> } >> } >> >> with the simpler >> >> gdb_test "info prog" "No selected thread." >> >> If GDB crashes as it did before your fix, the test will be unresolved, which is >> treated the same as a FAIL. > Done. > Btw, I noticed that gdb_test_multiple emits an "ERROR: Process no longer exists" preceding the unresolved message, but does not give details about the process exit status, which might be helpful. How about this patch? Thanks, - Tom [gdb/testsuite] Log wait status on process no longer exists error Proc gdb_test_multiple can run into a process no longer exists error, but when that happens it shows no details about the process: ... ERROR: Process no longer exists ... Fix this by showing the wait status of the process in the log: ... ERROR: Gdb process no longer exists Gdb process exited with wait status 8106 exp8 0 0 CHILDKILLED SIGSEGV \ {segmentation violation} ... In order to run the wait commmand we need an explicit pid, so we can't use any_spawn_id, and duplicate the "-i any_spawn_id eof" patter for gdb_spawn_id, and add the wait status logging there. Build and tested on x86_64-linux. 2018-10-24 Tom de Vries * lib/gdb.exp (gdb_test_multiple): Log wait status on process no longer exists error. --- gdb/testsuite/lib/gdb.exp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 2d197d9b5c..f68664b0ef 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -980,6 +980,16 @@ proc gdb_test_multiple { command message user_code } { set result -1 } + -i $gdb_spawn_id + eof { + perror "Gdb process no longer exists" + verbose -log "Gdb process exited with wait status [wait -i $gdb_spawn_id]" + if { $message != "" } { + fail "$message" + } + return -1 + } + # Patterns below apply to any spawn id specified. -i $any_spawn_id eof {