This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug mi/20684] New: MI commands with "--thread X" cause a switch of the user-selected thread


https://sourceware.org/bugzilla/show_bug.cgi?id=20684

            Bug ID: 20684
           Summary: MI commands with "--thread X" cause a switch of the
                    user-selected thread
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at ericsson dot com
  Target Milestone: ---

Issuing an MI command with a --thread or --thread-group flag changes the
user-selected thread.  That is a problem if the user uses a CLI in a front-end
which does MI requests in the background, as the currently selected thread can
change at any moment without warning.

For example:

Thread 1 is selected:

(gdb) 
info threads
&"info threads\n"
~"  Id   Target Id         Frame \n"
~"* 1    Thread 0x7ffff7fc5740 (LWP 12348) \"user-selected-c\" main () at
/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:56\n"
~"  2    Thread 0x7ffff77f6700 (LWP 12387) \"user-selected-c\"
0x00007ffff7bc923c in pthread_barrier_wait () from
/lib/x86_64-linux-gnu/libpthread.so.0\n"
^done

Do a command with --thread 2:

(gdb) 
-gdb-show --thread 2 non-stop
^done,value="off"

Thread 2 is now selected:

(gdb) 
info threads
&"info threads\n"
~"  Id   Target Id         Frame \n"
~"  1    Thread 0x7ffff7fc5740 (LWP 12348) \"user-selected-c\" main () at
/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.mi/user-selected-context-sync.c:56\n"
~"* 2    Thread 0x7ffff77f6700 (LWP 12387) \"user-selected-c\"
0x00007ffff7bc923c in pthread_barrier_wait () from
/lib/x86_64-linux-gnu/libpthread.so.0\n"
^done


The current plan is to fix this by decoupling the user-selected thread from the
inferior_ptid variable, and to only use inferior_ptid as the internal current
thread.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]