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 threads/21117] New: Occasional wrong thread numbering when following an exec


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

            Bug ID: 21117
           Summary: Occasional wrong thread numbering when following an
                    exec
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: threads
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at ericsson dot com
  Target Milestone: ---

I was playing with the mi-nsthrexec test, and noticed something odd.

I am using the test executable like this:

  $ ./gdb -nx testsuite/outputs/gdb.mi/mi-nsthrexec/mi-nsthrexec -ex "b main"
-ex "r"

and I just use the "continue" command over and over.  The spawned thread calls
exec, so each time we just come back to main.  Post-exec, we expect to always
see thread 1 hitting the breakpoint at main.  That's what happens most of the
time, but not always.  Here's the result:

http://pastebin.com/raw/tQYnBfEV

As you can see, it goes from "Thread 1" to "Thread 12" to "Thread 49", etc. 
AFAIK, when any thread of a process execs, it's the main thread (the one for
which tgid==pid in Linux terminology, pid==lwp in GDB terminology) that
survives, so we should always preserve Thread 1.

-- 
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]