Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop
Date: Thu, 14 May 2020 12:16:54 +0100	[thread overview]
Message-ID: <ee4f5a58-1e83-361e-6979-da6fc6e4cff8@redhat.com> (raw)
In-Reply-To: <SN6PR11MB2893642B726E31B27F9A5697C4BC0@SN6PR11MB2893.namprd11.prod.outlook.com>

>>
>> +/* 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



  reply	other threads:[~2020-05-14 11:16 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 20:53 [PATCH v8 0/6] Handle already-exited threads in 'stop_all_threads' Pedro Alves
2020-05-13 20:53 ` [PATCH v8 1/6] gdb: protect some 'regcache_read_pc' calls Pedro Alves
2020-05-13 20:53 ` [PATCH v8 2/6] gdb/infrun: move a 'regcache_read_pc' call down to first use Pedro Alves
2020-05-13 20:53 ` [PATCH v8 3/6] gdb/infrun: extract out a code piece into 'mark_non_executing_threads' function Pedro Alves
2020-05-13 20:53 ` [PATCH v8 4/6] gdb: introduce 'all_non_exited_process_targets' and 'switch_to_target_no_thread' Pedro Alves
2020-05-14  8:44   ` Aktemur, Tankut Baris
2020-05-14 11:12     ` Pedro Alves
2020-05-14 11:23       ` Aktemur, Tankut Baris
2020-05-13 20:53 ` [PATCH v8 5/6] gdb/infrun: enable/disable thread events of all targets in stop_all_threads Pedro Alves
2020-05-14  8:44   ` Aktemur, Tankut Baris
2020-05-14 11:16     ` Pedro Alves
2020-05-14 11:30       ` Aktemur, Tankut Baris
2020-05-13 20:53 ` [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop Pedro Alves
2020-05-14  8:47   ` Aktemur, Tankut Baris
2020-05-14 11:16     ` Pedro Alves [this message]
2020-05-14 11:40       ` Aktemur, Tankut Baris
2020-05-14 18:00   ` Tom de Vries
2020-05-14 18:54     ` Aktemur, Tankut Baris
2020-05-14 18:58       ` Pedro Alves
2020-05-15  7:53         ` Aktemur, Tankut Baris
2020-05-15 10:14           ` Pedro Alves
2020-05-15 10:17         ` Tom de Vries
2020-05-15 10:35           ` Pedro Alves
2020-05-15 11:53         ` Tom de Vries
2020-05-15 12:02           ` Pedro Alves
2020-05-15 14:16             ` Tom de Vries
2020-05-15 15:46               ` Pedro Alves
2020-05-15 17:17                 ` Tom de Vries
2020-05-18  6:18                   ` [PATCH][gdb/testsuite] Warn about leaked global array Tom de Vries
2020-05-18 10:41                     ` Pedro Alves
2020-05-19 16:34                       ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee4f5a58-1e83-361e-6979-da6fc6e4cff8@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tankut.baris.aktemur@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox