[pushed] gdb/mi: consistently notify user when GDB/MI client uses -thread-select
Jan Vrany
jan.vrany@labware.com
Wed Mar 23 15:13:06 GMT 2022
Hi,
On Wed, 2022-03-23 at 08:36 -0400, Simon Marchi wrote:
> > 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?
>
I gave it a go but I'm sorry: everything seem to work as expected
here. I do not get "[Switching to thread 1 (process 1891548)]" message
on CLI when -thread-select already selected thread.
I must be doing something differently. What commit is failing for you?
What's your ./configure incantation?
I'm happy to sit down with you and have a closer look at this, maybe using
IRC or something.
Jan
> Simon
More information about the Gdb-patches
mailing list