From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 519433858405 for ; Wed, 23 Mar 2022 12:37:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 519433858405 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 22NCavtk024222 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Mar 2022 08:37:02 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 22NCavtk024222 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 30A411F3B9; Wed, 23 Mar 2022 08:36:57 -0400 (EDT) Message-ID: Date: Wed, 23 Mar 2022 08:36:56 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [pushed] gdb/mi: consistently notify user when GDB/MI client uses -thread-select Content-Language: en-US To: Jan Vrany , Simon Marchi , gdb-patches@sourceware.org Cc: Andrew Burgess References: <20220316150914.1254897-1-jan.vrany@labware.com> <78570a7f-f6c0-5e1b-4178-c9ce401feab7@simark.ca> <897bd508133687e4d30994deecdd87786d71334d.camel@labware.com> <0bcb4286c01054c30c3539c76bd6426ff3b333eb.camel@labware.com> From: Simon Marchi In-Reply-To: <0bcb4286c01054c30c3539c76bd6426ff3b333eb.camel@labware.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Mar 2022 12:36:57 +0000 X-Spam-Status: No, score=-3032.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 23 Mar 2022 12:37:06 -0000 > Just tried on Ubuntu 20.04 and I do not any problem. I'm trying to look a bit more into it. The state is that we have thread 2 already selected, issue a `-thread-select 2` on the MI UI, and expect to not have a CLI notification to say that the thread changed, since we try to select the already selected thread. Before your patch I get: -thread-select 2 ^done,new-thread-id="2",frame={level="0",addr="0x00005555555551b8",func="child_sub_function",args=[],file="/home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c",fullname="/home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c",line="33",arch="i386:x86-64"} (gdb) PASS: gdb.mi/user-selected-context-sync.exp: mode=all-stop: test_mi_thread_select: thread 1.2: -thread-select again print 666 $9 = 666 (gdb) PASS: gdb.mi/user-selected-context-sync.exp: mode=all-stop: test_mi_thread_select: thread 1.2: -thread-select again, event on CLI, ensure no output CLI After: -thread-select 2 ^done,new-thread-id="2",frame={level="0",addr="0x00005555555551b8",func="child_sub_function",args=[],file="/home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c",fullname="/home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c",line="33",arch="i386:x86-64"} (gdb) PASS: gdb.mi/user-selected-context-sync.exp: mode=all-stop: test_mi_thread_select: thread 1.2: -thread-select again [Switching to thread 1.2 (Thread 0x7ffff7d99700 (LWP 1885257))] #0 child_sub_function () at /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:33 33 dummy = !dummy; /* thread loop line */ print 666 $9 = 666 (gdb) FAIL: gdb.mi/user-selected-context-sync.exp: mode=all-stop: test_mi_thread_select: thread 1.2: -thread-select again, event on CLI, ensure no output CLI So there is really a spurious "Switching to thread 1.2" notification in my case. Trying a simpler case, just an empty main program, I do this (/dev/pts/8 being the tty for my MI UI): $ ./gdb -q -nx --data-directory=data-directory a.out -ex "new-ui mi /dev/pts/8" -ex start If I then type `-thread-select 1` on the MI UI, I do get: [Switching to thread 1 (process 1891548)] ... which is unexpected. Before your patch, I don't get it. Can you give this small test a try? Simon