From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id AE1833851C25 for ; Fri, 15 May 2020 10:35:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AE1833851C25 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-474-Sql5ZOpKOHyimSDgP_Nzww-1; Fri, 15 May 2020 06:35:08 -0400 X-MC-Unique: Sql5ZOpKOHyimSDgP_Nzww-1 Received: by mail-wr1-f71.google.com with SMTP id i9so999523wrx.0 for ; Fri, 15 May 2020 03:35:07 -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=OiHWQFifUKwawdFukwopuRn7C2jHB7cdyznk1NfPA7Q=; b=HvppzJQ3ws2phxhqJGVyrUmYxK8ftDB/8Qj1H/ssTCV83wPuKVV9H8HCQ2l86GoRL4 vodvlmxqjgCc9yXzHkjXnNIseOUbtn7UKAyYDPaWT1HjMR8yVRpBQdYRNL1Yk9QGLTAN YWtbbr7x2+6w6popbX+veypgopfw7/MPojuI73HSikTQk2gJlEWRA/B0iLS9NOQRBKpW RhyeinMntVMBSZMX5SK5syllUL89cb14kcrNMMKmsMOwNqD+bLq9nU9rZ+fc8S+5g8Id O5F+dpvbJTY0+nIZbF3hQHiKK+35S0I+m5QMNvzfg/zJmtiNCkO5FRJXIvIen/lapL2Z iHxw== X-Gm-Message-State: AOAM530SajzrsimVdXwFld6bFH7ozM1D2s9UncfaZuJzbvwno5UtsIZR sQTg1ZT6fq4r01SFqcSrSZ+0up+N31SsQAWqWfKKC+wwrYPgUGkWLzzQMiUozSbQvU4lonJKGVE 9oAvjr3weBmZqBzCVe7B2jQ== X-Received: by 2002:a7b:c205:: with SMTP id x5mr3461334wmi.135.1589538906767; Fri, 15 May 2020 03:35:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK37sFoSdy6CoNANVUGU2qg0AsRWHnAW/Xs+kuIRgoGqgzHtdtOqc9eDNwzHKaGJ0C1XwAUA== X-Received: by 2002:a7b:c205:: with SMTP id x5mr3461318wmi.135.1589538906582; Fri, 15 May 2020 03:35:06 -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 y3sm2915452wrm.64.2020.05.15.03.35.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 May 2020 03:35:05 -0700 (PDT) Subject: Re: [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop To: Tom de Vries , "Aktemur, Tankut Baris" , "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: <7e3fc6cd-4296-2e83-f8e3-82fbd3cccdab@redhat.com> Date: Fri, 15 May 2020 11:35:04 +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:35:10 -0000 On 5/15/20 11:17 AM, Tom de Vries wrote: > On 14-05-2020 20:58, Pedro Alves wrote: > Actually, we still need to declare the variable as a namespace variable > using: > ... > variable testpid > array set testpid {} > ... > otherwise we run into: > ... > ERROR: tcl error sourcing > /data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-kill.exp. > ERROR: can't array set "testpid": variable isn't array > while executing > "array set testpid {}" > (in namespace eval "::multi-kill" script line 36) > invoked from within > "namespace eval $testfile { > ... Whoops, sorry, and thanks. I had already merged the patch, so I went ahead and applied that fix, as below. >From 3c5c3649729ba3f94f9d28f10aa2270c8c7e4aa9 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 15 May 2020 11:22:47 +0100 Subject: [PATCH] Fix gdb.multi/multi-kill.exp The previous patch misssed declaring the 'testpid' array as namespace variable. While it at, might as well go back to having start_inferior refer to the "global" testpid, using "variable" too. gdb/testsuite/ChangeLog: 2020-05-15 Pedro Alves * gdb.multi/multi-kill.exp (start_inferior): Remove 'testpid' parameter. Refer to namespace variable directly. (testpid): Declare as namespace variable. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.multi/multi-kill.exp | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 93ad65b32a2..b35d10e01bd 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-05-15 Pedro Alves + + * gdb.multi/multi-kill.exp (start_inferior): Remove + 'testpid' parameter. Refer to namespace variable directly. + (testpid): Declare as namespace variable. + 2020-05-15 Pedro Alves * gdb.multi/multi-kill.exp: Wrap in namespace. diff --git a/gdb/testsuite/gdb.multi/multi-kill.exp b/gdb/testsuite/gdb.multi/multi-kill.exp index 03bf8449cf8..b4853a1ea40 100644 --- a/gdb/testsuite/gdb.multi/multi-kill.exp +++ b/gdb/testsuite/gdb.multi/multi-kill.exp @@ -44,9 +44,9 @@ namespace eval $testfile { # Start inferior NUM and record its PID in the TESTPID array. -proc start_inferior {num testpid} { +proc start_inferior {num} { with_test_prefix "start_inferior $num" { - upvar $testpid tpid + variable testpid global binfile srcfile if {$num != 1} { @@ -62,8 +62,8 @@ proc start_inferior {num testpid} { gdb_run_cmd gdb_test "" ".*reakpoint .*, initialized .*${srcfile}.*" "run" - set tpid($num) [get_integer_valueof "pid" -1] - if {$tpid($num) == -1} { + set testpid($num) [get_integer_valueof "pid" -1] + if {$testpid($num) == -1} { return -1 } @@ -76,10 +76,11 @@ proc start_inferior {num testpid} { set NUM_INFS 10 # The array holding each inferior's PID, indexed by inferior number. +variable testpid array set testpid {} for {set i 1} {$i <= $NUM_INFS} {incr i} { - if {[start_inferior $i testpid] < 0} { + if {[start_inferior $i] < 0} { return -1 } } base-commit: 272c36b87f81fd64e5f4669730da72c39d0716b3 -- 2.14.5