From patchwork Thu May 7 17:05:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 6609 Received: (qmail 53153 invoked by alias); 7 May 2015 17:05:23 -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 53071 invoked by uid 89); 7 May 2015 17:05:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 07 May 2015 17:05:21 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t47H5Hvv023488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 7 May 2015 13:05:17 -0400 Received: from localhost (unused-10-15-17-126.yyz.redhat.com [10.15.17.126]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t47H5G4F018065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO); Thu, 7 May 2015 13:05:17 -0400 From: Sergio Durigan Junior To: Luis Machado Cc: Yao Qi , Pedro Alves , Subject: [PATCH] Fix coredump-filter.exp by correctly unsetting array (was: Re: [rfc] Fix PR 18208: update /proc/pid/coredump_filter by c code) References: <1429889336-12277-1-git-send-email-qiyaoltc@gmail.com> <554A3D61.8090302@redhat.com> <554A44B9.3090503@codesourcery.com> <86sib8vjtv.fsf@gmail.com> <554B4223.1000003@codesourcery.com> <554B702F.5090006@codesourcery.com> X-URL: http://blog.sergiodj.net Date: Thu, 07 May 2015 13:05:13 -0400 In-Reply-To: <554B702F.5090006@codesourcery.com> (Luis Machado's message of "Thu, 7 May 2015 11:01:19 -0300") Message-ID: <87mw1g1fp2.fsf_-_@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes On Thursday, May 07 2015, Luis Machado wrote: > Besides that, without the conditional block i also see a problem with > the existing testcase using coredump_var_addr as an array but > declaring it as a regular variable. It causes a number of errors. Did > you notice that? Maybe it is specific to a certain version of expect. > > # Obtain the address of each variable that will be checked on each > # case. > set coredump_var_addr "" > foreach item $all_anon_corefiles { > foreach name [list [lindex $item 3] [lindex $item 4]] { > set test "print/x $name" > gdb_test_multiple $test $test { > -re " = \($hex\)\r\n$gdb_prompt $" { > set coredump_var_addr($name) $expect_out(1,string) > } > } > } > } Thanks for catching this. This is because of the discussion on: And the patch: It seems it is not possible to "clear" the variable using "" and then use as an array. I think the best way would be to call 'unset -nocomplain' in this case. The following patch does this. With it applied, the test fully passes on Fedora 20 x86_64 native. WDYT? diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp index 72f756a..c601939 100644 --- a/gdb/testsuite/gdb.base/coredump-filter.exp +++ b/gdb/testsuite/gdb.base/coredump-filter.exp @@ -170,7 +170,7 @@ gdb_test_multiple "print/x &main" "getting main's address" { # Obtain the address of each variable that will be checked on each # case. -set coredump_var_addr "" +unset -nocomplain coredump_var_addr foreach item $all_anon_corefiles { foreach name [list [lindex $item 3] [lindex $item 4]] { set test "print/x $name"