Skip to content
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

Retrieve Thread Names #173

Closed
Gankra opened this issue May 18, 2021 · 7 comments · Fixed by #189
Closed

Retrieve Thread Names #173

Gankra opened this issue May 18, 2021 · 7 comments · Fixed by #189

Comments

@Gankra
Copy link
Collaborator

Gankra commented May 18, 2021

In the JSON Schema this affects the threads[_].thread_name field.

Haven't yet checked where this information is stored in the minidump.

@gabrielesvelto
Copy link
Collaborator

This also comes from the .extra file, specifically the ThreadIdNameMapping annotation which contains a list of thread names and TIDs. Note that on macOS it's currently borked so it only works on Windows and Linux but that's a problem in Gecko.

The code that deals with this is here.

@jrmuizel
Copy link
Contributor

Minidumps also now have a ThreadNamesStream that contains this information. It would be nice if Gecko transitioned to using ThreadNamesStream for broader compatibility with other tools.

@Gankra
Copy link
Collaborator Author

Gankra commented Jun 3, 2021

From minidumpapiset.h on my system:

typedef enum _MINIDUMP_STREAM_TYPE {
...
    ThreadNamesStream           = 24,
}

//
// The thread names stream in a minidump, containing information
// about each thread's name/description (if available).
//

typedef struct _MINIDUMP_THREAD_NAME {
    ULONG ThreadId;
    RVA64 RvaOfThreadName;
} MINIDUMP_THREAD_NAME, *PMINIDUMP_THREAD_NAME;

typedef struct _MINIDUMP_THREAD_NAME_LIST {
    ULONG NumberOfThreadNames;
    MINIDUMP_THREAD_NAME ThreadNames[0]; // Variable size buffer
} MINIDUMP_THREAD_NAME_LIST, *PMINIDUMP_THREAD_NAME_LIST;

@gabrielesvelto
Copy link
Collaborator

Interesting. I had a look too and it seems that neither breakpad nor crashpad handle these:

    ThreadInfoListStream        = 17,
    HandleOperationListStream   = 18,
    TokenStream                 = 19,
    JavaScriptDataStream        = 20,
    SystemMemoryInfoStream      = 21,
    ProcessVmCountersStream     = 22,
    IptTraceStream              = 23,
    ThreadNamesStream           = 24,

    ceStreamNull                = 0x8000,
    ceStreamSystemInfo          = 0x8001,
    ceStreamException           = 0x8002,
    ceStreamModuleList          = 0x8003,
    ceStreamProcessList         = 0x8004,
    ceStreamThreadList          = 0x8005, 
    ceStreamThreadContextList   = 0x8006,
    ceStreamThreadCallStackList = 0x8007,
    ceStreamMemoryVirtualList   = 0x8008,
    ceStreamMemoryPhysicalList  = 0x8009,
    ceStreamBucketParameters    = 0x800A,     
    ceStreamProcessModuleMap    = 0x800B,
    ceStreamDiagnosisList       = 0x800C,

The annotation we use for storing the thread names is a bit of a hack so if we could migrate to something standard-ish it would be a big improvement.

@gabrielesvelto
Copy link
Collaborator

Note that I can't find a documented way to have MiniDumpWriteDump() populate those streams (and specifically ThreadNamesStream) but given that the format is documented we could do it ourselves in our writers :-).

@Gankra
Copy link
Collaborator Author

Gankra commented Jun 3, 2021

Some googling suggests it will use the value of SetThreadDescription.

@Gankra
Copy link
Collaborator Author

Gankra commented Jun 3, 2021

...which we use, so we have thread names!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants