-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gdb thread number changes, when replaying thread_create #2229
Comments
Interesting. rr doesn't control that thread number directly. That's something gdb makes up. As you can see, the tid numbers reported by rr are correct and remain stable. I suspect gdb assigns new a new thread number because we go through a state where thread 2 doesn't exist, and then it does again, so gdb treats it as a new thread. I don't see any obvious way to avoid this. |
For testing I implemented a function in gdb
If gdb implements this function (it needs still more testing and until now it can not handle thread id's with multiple debugged procceses, though. It was only for testing, what we could do in gdb), then I think, we could use this function to set the "correct" thread ID's while replaying. My Idea is, that when we are replaying a thread creation, we put the thread number in a map with the thread-id key, so we can track all the threads, and if it already exists, we could set the correct thread ID. |
How would you send the If you're going to patch gdb then I think a better approach would be to have gdb remember the (tid, thread number) pairs associated with exited threads and automatically reuse a thread number if it sees a new thread with the old tid. |
I added the ability to gdb, that it tracks over all threads and sets correct number and id, if tid already existed. |
Did you submit your changes upstream or at least file a bug in gdb Bugzilla? If so, can you post a link here? Thanks! |
Bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=23454
I sent Sourceware a patch request, maybe they patch the changes in to the gdb |
Any luck getting your changes upstreamed? I'm hitting the same problem. |
No sorry, the patch I sent was not accepted. You can use the gdb copy from my site, which has the changes but its not an actual gdb version. |
Today I debugged an application with multiple threads, with a bug in a code segment which gets called from almost every thread in the application, but only one thread triggers a bug.
While replaying, I saw the thread number shown in gdb changes everytime a thread gets created. This behavior really messed up with me, because while running back and forward I only looked at the thread number, not the real tid.
Some code to explain the behavior:
Is it possible to change this behavior in rr, that the thread number stays the same while debugging?
The text was updated successfully, but these errors were encountered: