Useful things to put in the user stream segment of minidumps
I am interested in what useful things developers put in the user stream data structure that can be embedded in minidumps. MSDN describes the parameter for MiniDumpWriteDump as such:
PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam
and describes the parameter thusly:
UserStreamPar开发者_运维问答am [in] Pointer to an array of MINIDUMP_USER_STREAM_INFORMATION structures. If the value of this parameter is NULL, no user-defined information is included in the minidump file.
I was considering embedding the last n log lines of my program in a user stream since testers tend not to send the properly formatted logs with all bugs all the time.
Also, I could put hardware specs (memory, CPU, video, etc) in that section.
What else have people used the user stream segment for?
I like your idea of including historical log information. However, if the minidump is being produced in response to an exception of some type, it seems that stopping to read a log file to include in the dump might not always be the best plan since the stability of the system may be questionable.
Our default type is MiniDumpWithFullMemory. In that case, the user stream information does not seem particularly useful in our application because the full memory includes pretty much every possible bit of information we need (at least so far). And we have also had pretty good luck with getting all the error log files when people send us a dump file.
However, our users can change the type with a configuration parameter. I can see that with one of the smaller minidump types, the user stream information could be very useful. I had never actually given any real thought to that parameter of the minidump function until I saw this post. We have a few structures in memory with basic configuration information that would be invaluable in cases where a full memory dump is not produced. Also, the structure containing the details of the user that "caused" the exception would be handy. I will have to consider adding a few of those to be dumped out as user streams.
What may be more useful than filling in additional information here, is to include any log files you generate with WerRegisterFile.
The Breakpad library uses user streams for some bookkeeping information. It includes a stream with the thread ID of the dedicated thread that does minidump writing so that it can be excluded from stack traces. It also includes a stream with assertion information if the dump was written in response to a non-fatal callback, such as the CRT's invalid parameter handler or pure virtual call handler.
精彩评论