From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id E4326386F816 for ; Thu, 14 May 2020 11:16:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E4326386F816 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-209-Yh1I6weRONyP_9TX-9xRog-1; Thu, 14 May 2020 07:16:57 -0400 X-MC-Unique: Yh1I6weRONyP_9TX-9xRog-1 Received: by mail-wr1-f70.google.com with SMTP id r7so1413458wrc.13 for ; Thu, 14 May 2020 04:16:57 -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:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=sdTZjcrdrxylIBDOB/fyjCAPegech6UpkguWF1keu5U=; b=PEREBnYtVtiJyLMfm2A697MPOyb0j02NboagB5klSOXDrA8xzbYlJnuBGGLDzhk2CX j5QQkVjuw05eOBM90Xqpm8Rk3tfRWCGn1NwGu5O09UhzeJQr8ElPaIwkoGe+5awgQ1jT DdTdYPS2O4P/KOWEIsRb4zm1lXNgCS9CvwFZM3lrq1rWuH8FJtBYGvcudXSWuCIv5Tt7 6sY4xmZMhNNePAwEEHEpTAl8n5D4r3RO8J4yHNkhl7TALrH9yNAJOyRDUjWipioW3QJS jvMR355fgT/PIpO3kChm9j7sdg2qqNfvjgrO4+gGkfnuLIVhP1jeH4OHXO6Yj9gSNHXI jLTw== X-Gm-Message-State: AGi0PuZGJA6yn2vV906BbQInPoKqRSjggaqI1M6gCtoW2fKm1J7kBWIc ZsOS5kwEswg+TXS25KI7fed6js7d9sABOWHwekWBiEQakJJHwuT94Xg/NFNW+oeLSKIIKqTk3M9 f43/+dNx9O+kJSsMVoVrEYw== X-Received: by 2002:a1c:790b:: with SMTP id l11mr25173908wme.2.1589455016185; Thu, 14 May 2020 04:16:56 -0700 (PDT) X-Google-Smtp-Source: APiQypJlGazu/1OPC37zYPaDaTa/Kvjinhx353rsM+vsvoGp8IPN+BUQwzmi9OAQK7Qyj3bpLs2XtQ== X-Received: by 2002:a1c:790b:: with SMTP id l11mr25173896wme.2.1589455015984; Thu, 14 May 2020 04:16:55 -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 s17sm38551882wmc.48.2020.05.14.04.16.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 May 2020 04:16:55 -0700 (PDT) Subject: Re: [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop To: "Aktemur, Tankut Baris" References: <20200513205338.14233-1-palves@redhat.com> <20200513205338.14233-7-palves@redhat.com> Cc: gdb-patches From: Pedro Alves Message-ID: Date: Thu, 14 May 2020 12:16:54 +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.9 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: Thu, 14 May 2020 11:17:01 -0000 >> >> +/* Return true if INF only has one non-exited thread. */ >> + >> +static bool >> +single_non_exited_thread_p (inferior *inf) > Given that the return type is bool and not int, can the '_p' in the name be > discarded and a question phrase, like 'has_single_non_exited_thread', be > used? Using "_p" (for predicate) is a common idiom in GDB/GCC code, but I don't mind. > Similar to what you did in multi-kill.exp, to eliminate code duplication, > this 'with_test_prefix' code block can be removed, and the start_inferior > procedure can be used for inferior 1, too, by ... > >> + >> +# Start inferior NUM. >> + >> +proc start_inferior {num} { >> + global srcfile binfile >> + >> + gdb_test "add-inferior" "Added inferior $num.*" \ >> + "add empty inferior $num" >> + gdb_test "inferior $num" "Switching to inferior $num.*" \ >> + "switch to inferior $num" > ... guarding the statements above with 'if {$num != 1}'. And then ... > >> + >> + with_test_prefix "inf $num" { >> + gdb_load $binfile >> + >> + if {[gdb_start_cmd] < 0} { >> + fail "could not start" >> + return -1 >> + } >> + gdb_test "" ".*reakpoint .*, main .*${srcfile}.*" "start" >> + } >> + >> + return 0 >> +} >> + >> +# Sufficient inferiors to make sure that at least some other inferior >> +# exits while we're handling a process exit event. >> +set NUM_INFS 10 >> + >> +for {set i 2} {$i <= $NUM_INFS} {incr i} { > ... this loop could start from 1. > Indeed. In your update, you just missed putting the add-inferior/inferior commands under with_test_prefix as well (and then remove the inferior number from the test message), like I had done on multi-kill.exp. I.e.,: diff --git a/gdb/testsuite/gdb.multi/multi-exit.exp b/gdb/testsuite/gdb.multi/multi-exit.exp index 2e3ed39a268..393093b3784 100644 --- a/gdb/testsuite/gdb.multi/multi-exit.exp +++ b/gdb/testsuite/gdb.multi/multi-exit.exp @@ -42,16 +42,16 @@ save_vars { GDBFLAGS } { # Start inferior NUM. proc start_inferior {num} { - global srcfile binfile - - if {$num != 1} { - gdb_test "add-inferior" "Added inferior $num.*" \ - "add empty inferior $num" - gdb_test "inferior $num" "Switching to inferior $num.*" \ - "switch to inferior $num" - } + with_test_prefix "start_inferior $num" { + global srcfile binfile + + if {$num != 1} { + gdb_test "add-inferior" "Added inferior $num.*" \ + "add empty inferior" + gdb_test "inferior $num" "Switching to inferior $num.*" \ + "switch to inferior" + } - with_test_prefix "inf $num" { gdb_load $binfile if {[gdb_start_cmd] < 0} { Thanks, Pedro Alves