-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Faulthandler output should include the thread name #125434
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
Comments
Sorry, It seems that there is no thread name member in |
If it's not there it obviously can't be included. Thank you very much for looking! |
I don't think that we can implement this feature. Sadly, faulthandler is very low-level. It doesn't have access to faulthandler is called in a signal handler, only "async signal-safe" function can be used, memory can only be allocated on the stack (not on the heap). I suggest to close this issue as "won't fix". |
I think I'll follow Victor's call. I had a quick look at the code to see how we could make it include the thread name but I don't think it's feasible. One possibility is to carry the latter everywhere but since only stack-allocated memory can be used I really don't think we can have a simple fix. |
One approach would be to set the thread name in the OS: #59705 and then retrieve the thread name from the OS. It might work if retrieving the name is safe in a signal handler. |
I wrote a change to set the thread name to the operating system: #127338 |
I wrote PR gh-132016 to display the thread native name in faulthandler. |
pthread_get_name_np is defined in pthread_np.h.
pthread_get_name_np is defined in pthread_np.h.
Feature or enhancement
Proposal:
Currently faulthandler just dumps the thread id.
It would be nice if the thread name would also be part of the output since this makes debugging much easier
Current output
Better output with thread name in square brackets
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: