Open Bug 758869 Opened 14 years ago Updated 4 years ago

Debugger attached to a running Gecko application doesn't see thread names

Categories

(Core :: XPCOM, enhancement)

All
Windows XP
enhancement

Tracking

()

People

(Reporter: mayhemer, Unassigned)

References

Details

In bug 720778 we are using new XPCOM and NSPR APIs to name most of out threads. However, on Windows, VS must be attached at the moment a tread is given a name. So, when you attach the debugger later to an already running process, there won't be the nice names in the thread list. My suggestion is to have a function NameThreads(), similar to DumpJSStack(), that, when called from the debugger, calls set-name on all threads. Advantages: - no need for any new "debugger monitoring" thread that would do this automatically - main thread could do that, but what about case we are in a deadlock state? - such function can be freely put also into release builds - cross platform
This makes me think of exposing also PR_Set/GetThreadName(PRThread*, const char* name), where _Set wouldn't necessarily be available on all platforms (OSX). And also about access to some list of all running threads. Other option would be to move this completely to NSPR level and expose the function there instead of at XPCOM level.
Honza: are you sure your proposed NameThreads() function can call set-name on all threads? The underlying PR_SetThreadName function (added in bug 758837) can only set the name of the current thread.
(In reply to Wan-Teh Chang from comment #2) > Honza: are you sure your proposed NameThreads() function > can call set-name on all threads? > > The underlying PR_SetThreadName function (added in > bug 758837) can only set the name of the current thread. See comment 1. We may have this function live at NSPR that have full access to everything needed. I also believe (have to check again!) that thread names are not visible only on Windows, since the debugger has to be there to catch the specific exception. On other platforms (linux/darwin) it seems to be stored to some info block that overlives the debugger.
OS: All → Windows XP
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.