From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id CF6D0386EC42 for ; Fri, 15 May 2020 10:14:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CF6D0386EC42 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-oNBurtxsOFmunhwLhJziOA-1; Fri, 15 May 2020 06:14:53 -0400 X-MC-Unique: oNBurtxsOFmunhwLhJziOA-1 Received: by mail-wr1-f71.google.com with SMTP id z16so940102wrq.21 for ; Fri, 15 May 2020 03:14:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=p04m1BVFXOK9HITtlqDL8MLa/SezlfQNFEwbITS2aV0=; b=NH1lb7hqEyHM0WNQXTIAcRdvS8/GF7mnDsIPTxqMfj7gW+wnOawJ8tCeBAeQTF37k0 bjT50GMaa6SabbW4ct5uA2fkLs3WqBlkvlhgMxIaddyLA9fPi9dZReihyZlvjZmOmvaE kUWWs1SMJcYM1gCtQFKFp6vz1j/FTY7j1f/B6Ox0M7lJAz3LR6DHP5dvX/dBKmWftuyK IpeVvOmXfqqgFiScFkhWHuQ+gdhSRwDVHVm0yV1Qg1BkMID9IkgtlEX0Utmo9THaAJZp AddbQEh7M54OMs8OYUcaLCnIT2hiSiwBNb2Xs9y8u3soTN/mYyYIqb96VuThPpCCaVDI FD0g== X-Gm-Message-State: AOAM5314OeBmG6cHQHHdNEAyHwOdB0fGLn3s65d9JYMjt5F27E5FFLkH 4LK7HHBM05wDYQMQxTLiCBuO+kwgwW9NGLYhvGHe07zZ3HrMFZ95GzCW5LD1mj5zkWrJefgvwRO tbsioEVTEYOOWsXLgoIcxPQ== X-Received: by 2002:a1c:9e45:: with SMTP id h66mr3260455wme.106.1589537692633; Fri, 15 May 2020 03:14:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhzF9yS9t3FyLuedE5gmNcCRPN70+PEgSPum1MjcG7SL2SaFF+in86m/m4n1cPcdfEDJEEUQ== X-Received: by 2002:a1c:9e45:: with SMTP id h66mr3260429wme.106.1589537692377; Fri, 15 May 2020 03:14:52 -0700 (PDT) Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id q18sm2825737wmk.28.2020.05.15.03.14.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 May 2020 03:14:51 -0700 (PDT) Subject: Re: [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop To: "Aktemur, Tankut Baris" , Tom de Vries , "gdb-patches@sourceware.org" References: <20200513205338.14233-1-palves@redhat.com> <20200513205338.14233-7-palves@redhat.com> <0d00b418-3c5f-4a8c-12dd-eeee8ad12b6b@suse.de> <4ade3da1-a8cd-ba29-80da-f5e742f7b52a@palves.net> From: Pedro Alves Message-ID: <9a0be7b3-f1ef-8316-912e-62ae58038970@redhat.com> Date: Fri, 15 May 2020 11:14:50 +0100 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: Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 May 2020 10:15:06 -0000 On 5/15/20 8:53 AM, Aktemur, Tankut Baris wrote: > On Thursday, May 14, 2020 8:59 PM, Pedro Alves wrote: >> >> +# Wrap the entire test in a namespace to avoid contaminating other tests. >> +namespace eval $testfile { > > TIL. Thanks. I wrote a commit log, and merged it now, as below. >From 272c36b87f81fd64e5f4669730da72c39d0716b3 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 15 May 2020 11:09:51 +0100 Subject: [PATCH] Fix global variable collision in gdb.multi/multi-kill.exp The new gdb.multi/multi-kill.exp testcase added an 'testpid' array, which may conflict with other global 'testpid' variables used by other testcases, resulting in: ... ERROR: tcl error sourcing /data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-kill.exp. ERROR: can't set "testpid(1)": variable isn't array while executing "set testpid($num) [get_integer_valueof "pid" -1]" or $ runtest gdb.threads/check-libthread-db.exp gdb.multi/multi-kill.exp ... Running /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.multi/multi-kill.exp ... Running /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.threads/check-libthread-db.exp ... ERROR: tcl error sourcing /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.threads/check-libthread-db.exp. ERROR: can't set "testpid": variable is array while executing "set testpid [spawn_id_get_pid $test_spawn_id]" ("uplevel" body line 8) Fix this with a namespace, like gdb.linespec/explicit.exp does. gdb/testsuite/ChangeLog: 2020-05-15 Pedro Alves * gdb.multi/multi-kill.exp: Wrap in namespace. (start_inferior): Add TESTPID parameter. Use it instead of the testpid global. (top level): Define empty TESTPID array, and pass it down to start_inferior. --- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.multi/multi-kill.exp | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6c025832e3b..93ad65b32a2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2020-05-15 Pedro Alves + + * gdb.multi/multi-kill.exp: Wrap in namespace. + (start_inferior): Add TESTPID parameter. Use it instead of the + testpid global. + (top level): Define empty TESTPID array, and pass it down to + start_inferior. + 2020-05-14 Tom de Vries * gdb.fortran/nested-funcs-2.exp: Use gdb_test_stdio to test inferior diff --git a/gdb/testsuite/gdb.multi/multi-kill.exp b/gdb/testsuite/gdb.multi/multi-kill.exp index ce6075045fc..03bf8449cf8 100644 --- a/gdb/testsuite/gdb.multi/multi-kill.exp +++ b/gdb/testsuite/gdb.multi/multi-kill.exp @@ -39,11 +39,15 @@ save_vars { GDBFLAGS } { clean_restart ${binfile} } +# Wrap the entire test in a namespace to avoid contaminating other tests. +namespace eval $testfile { + # Start inferior NUM and record its PID in the TESTPID array. -proc start_inferior {num} { +proc start_inferior {num testpid} { with_test_prefix "start_inferior $num" { - global testpid binfile srcfile + upvar $testpid tpid + global binfile srcfile if {$num != 1} { gdb_test "add-inferior" "Added inferior .*" \ @@ -58,8 +62,8 @@ proc start_inferior {num} { gdb_run_cmd gdb_test "" ".*reakpoint .*, initialized .*${srcfile}.*" "run" - set testpid($num) [get_integer_valueof "pid" -1] - if {$testpid($num) == -1} { + set tpid($num) [get_integer_valueof "pid" -1] + if {$tpid($num) == -1} { return -1 } @@ -71,8 +75,11 @@ proc start_inferior {num} { # is killed while we're handling a killed event. set NUM_INFS 10 +# The array holding each inferior's PID, indexed by inferior number. +array set testpid {} + for {set i 1} {$i <= $NUM_INFS} {incr i} { - if {[start_inferior $i] < 0} { + if {[start_inferior $i testpid] < 0} { return -1 } } @@ -125,3 +132,5 @@ for {set i 2} {$i <= $NUM_INFS} {incr i} { "continue to SIGKILL" } } + +} base-commit: 013707794a67269dd34fd8ae6e354e982c547dc0 -- 2.14.5