Change worker thread name to something mentioning original process name
Worker OS thread are renamed to ghc_worker
when spawned. This is annoying when reading debugging messages that print the process name. For example, at work I'm debugging a segfault in a Haskell program and the kernel message just says ghc_worker[21992]: segfault at 0 ip...
which doesn't tell me which of our Haskell programs is having the problem.
I'd like to change this so it mentions the original name. On Linux, we can get that from the program_invocation_name
global. pthread_setname_np
has a maximum length of 15 characters, so we'll have to truncate it. I propose the first 13 characters of the original name followed by ":w". I'd just as soon not change the name in the first place but apparently this change was made to make it easier to distinguish worker threads from the main thread when debugging processes in gdb (commit 674c631e).
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |