Add support for per-thread crash annotations
Categories
(Toolkit :: Crash Reporting, enhancement)
Tracking
()
People
(Reporter: gsvelto, Unassigned)
References
(Blocks 2 open bugs)
Details
Crash annotations have been traditionally set on a per-process basis, that is every annotation can have only one value. However we have code that would benefit from recording a set of concurrent operations happening on separate thread. Ideally during a crash all the values of the annotations that have been set concurrently should be gathered and stored in the crash report as a single value. The API might look like this:
RegisterThreadAnnotation<Type>(Annotation aAnnotation, TypePtr* aPointer)orRecordThreadAnnotation<Type>(Annotation aAnnotation, Type aValue)are used to record a per-thread annotation. The semantics are exactly the same as with the regular functions to register/record annotations, but they allow one annotation per-thread instead of per-process.UnregisterThreadAnnotation(Annotation aAnnotation)unregisters the current thread's annotation.- At crash time the values of all registered annotations are gathered and stored within the .extra file as a single annotation, with every value associated with the corresponding thread ID, in JSON array format. Like:
["<tid1>": "<value1>", "<tid2>": "<value2>", ...]
The thread IDs will have the same values as those recorded in the minidump so that the annotations can be mapped back to the thread owning it. Cleaning up an annotation when the owning thread shuts down must be done explicitly. Not unregistering an annotation at thread shutdown won't cause immediate problems apart from having leaked a bit of memory, but at crash time the annotation might end up containing bogus data if the underlying memory was reused by something else (or might be missing entirely).
Description
•