public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Jan Vrany <jan.vrany@labware.com>,
	Simon Marchi <simark@simark.ca>,
	gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: Re: [pushed] gdb/mi: consistently notify user when GDB/MI client uses -thread-select
Date: Wed, 23 Mar 2022 08:36:56 -0400	[thread overview]
Message-ID: <ffd69e05-a4e7-2319-c7f9-f1ced29bc608@polymtl.ca> (raw)
In-Reply-To: <0bcb4286c01054c30c3539c76bd6426ff3b333eb.camel@labware.com>

> 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

  reply	other threads:[~2022-03-23 12:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 15:09 Jan Vrany
2022-03-21 20:35 ` Simon Marchi
2022-03-21 21:01   ` Jan Vrany
2022-03-22 14:37     ` Jan Vrany
2022-03-23 12:36       ` Simon Marchi [this message]
2022-03-23 15:13         ` Jan Vrany
2022-03-23 15:16           ` Simon Marchi
2022-03-23 16:09             ` Jan Vrany
2022-03-23 19:09               ` Andrew Burgess
2022-03-23 19:11                 ` Andrew Burgess
2022-03-23 20:33                 ` Jan Vrany
2022-03-24 14:47                 ` Simon Marchi
2022-03-24 18:52                   ` [PATCHv2] gdb/mi: fix use after free of frame_info causing spurious notifications Andrew Burgess
2022-03-24 20:32                     ` Simon Marchi
2022-03-29 10:10                       ` Andrew Burgess
2022-03-24 15:00               ` [pushed] gdb/mi: consistently notify user when GDB/MI client uses -thread-select Simon Marchi

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=ffd69e05-a4e7-2319-c7f9-f1ced29bc608@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.vrany@labware.com \
    --cc=simark@simark.ca \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).